X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/0138f12994f0c0dc7ee3d70d550edb67a105bd47..466838177a5891fff93eeb70d99831fab3de1c8f:/package/busybox/patches/911-ipkg.patch diff --git a/package/busybox/patches/911-ipkg.patch b/package/busybox/patches/911-ipkg.patch index 26b4b7bbd..b2fca7f9c 100644 --- a/package/busybox/patches/911-ipkg.patch +++ b/package/busybox/patches/911-ipkg.patch @@ -1,18 +1,13 @@ -diff -ruN busybox-1.00-orig/Makefile busybox-1.00+ipkg-0.99.154/Makefile ---- busybox-1.00-orig/Makefile 2004-10-08 09:45:08.000000000 +0200 -+++ busybox-1.00+ipkg-0.99.154/Makefile 2005-10-26 17:36:45.000000000 +0200 -@@ -39,7 +39,7 @@ - - include $(top_builddir)/Rules.mak - --DIRS:=applets archival archival/libunarchive coreutils console-tools \ -+DIRS:=applets archival archival/libipkg archival/libunarchive coreutils console-tools \ - debianutils editors findutils init miscutils modutils networking \ - networking/libiproute networking/udhcp procps loginutils shell \ - sysklogd util-linux libpwdgrp coreutils/libcoreutils libbb -diff -ruN busybox-1.00-orig/archival/Config.in busybox-1.00+ipkg-0.99.154/archival/Config.in ---- busybox-1.00-orig/archival/Config.in 2004-03-15 09:28:16.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/Config.in 2005-10-26 17:36:45.000000000 +0200 +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# add ipkg support to busybox +# +diff -ruN busybox-1.2.0-orig/archival/Config.in busybox-1.2.0+ipkg-0.99.162/archival/Config.in +--- busybox-1.2.0-orig/archival/Config.in 2006-07-01 00:42:04.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/Config.in 2006-07-22 16:31:25.000000000 +0200 @@ -121,6 +121,14 @@ gzip is used to compress files. It's probably the most widely used UNIX compression program. @@ -28,21 +23,10 @@ diff -ruN busybox-1.00-orig/archival/Config.in busybox-1.00+ipkg-0.99.154/archiv config CONFIG_RPM2CPIO bool "rpm2cpio" default n -diff -ruN busybox-1.00-orig/archival/Makefile.in busybox-1.00+ipkg-0.99.154/archival/Makefile.in ---- busybox-1.00-orig/archival/Makefile.in 2004-10-08 09:45:09.000000000 +0200 -+++ busybox-1.00+ipkg-0.99.154/archival/Makefile.in 2005-10-26 17:36:45.000000000 +0200 -@@ -32,6 +32,7 @@ - ARCHIVAL-$(CONFIG_DPKG_DEB) += dpkg_deb.o - ARCHIVAL-$(CONFIG_GUNZIP) += gunzip.o - ARCHIVAL-$(CONFIG_GZIP) += gzip.o -+ARCHIVAL-$(CONFIG_IPKG) += ipkg.o - ARCHIVAL-$(CONFIG_RPM2CPIO) += rpm2cpio.o - ARCHIVAL-$(CONFIG_RPM) += rpm.o - ARCHIVAL-$(CONFIG_TAR) += tar.o -diff -ruN busybox-1.00-orig/archival/dpkg.c busybox-1.00+ipkg-0.99.154/archival/dpkg.c ---- busybox-1.00-orig/archival/dpkg.c 2004-04-14 19:51:08.000000000 +0200 -+++ busybox-1.00+ipkg-0.99.154/archival/dpkg.c 2005-10-26 17:36:45.000000000 +0200 -@@ -1527,6 +1527,10 @@ +diff -ruN busybox-1.2.0-orig/archival/dpkg.c busybox-1.2.0+ipkg-0.99.162/archival/dpkg.c +--- busybox-1.2.0-orig/archival/dpkg.c 2006-07-01 00:42:04.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/dpkg.c 2006-07-22 16:31:25.000000000 +0200 +@@ -1430,6 +1430,10 @@ return(ar_handle->sub_archive->buffer); } @@ -53,7 +37,7 @@ diff -ruN busybox-1.00-orig/archival/dpkg.c busybox-1.00+ipkg-0.99.154/archival/ static void data_extract_all_prefix(archive_handle_t *archive_handle) { char *name_ptr = archive_handle->file_header->name; -@@ -1541,6 +1545,8 @@ +@@ -1442,6 +1446,8 @@ return; } @@ -62,9 +46,9 @@ diff -ruN busybox-1.00-orig/archival/dpkg.c busybox-1.00+ipkg-0.99.154/archival/ static void unpack_package(deb_file_t *deb_file) { const char *package_name = name_hashtable[package_hashtable[deb_file->package]->name]; -diff -ruN busybox-1.00-orig/archival/ipkg.c busybox-1.00+ipkg-0.99.154/archival/ipkg.c ---- busybox-1.00-orig/archival/ipkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/ipkg.c 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/ipkg.c busybox-1.2.0+ipkg-0.99.162/archival/ipkg.c +--- busybox-1.2.0-orig/archival/ipkg.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/ipkg.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,26 @@ +/* ipkg.c - the itsy package management system + @@ -92,133 +76,10 @@ diff -ruN busybox-1.00-orig/archival/ipkg.c busybox-1.00+ipkg-0.99.154/archival/ +{ + return ipkg_op(argc, argv); +} -diff -ruN busybox-1.00-orig/archival/libipkg/Makefile busybox-1.00+ipkg-0.99.154/archival/libipkg/Makefile ---- busybox-1.00-orig/archival/libipkg/Makefile 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/Makefile 2005-10-26 17:36:45.000000000 +0200 -@@ -0,0 +1,32 @@ -+# Makefile for busybox -+# -+# Copyright (C) 1999-2004 by Erik Andersen -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+# -+ -+top_srcdir=../.. -+top_builddir=../.. -+srcdir=$(top_srcdir)/archival/libipkg -+LIBIPKG_DIR:=./ -+include $(top_builddir)/Rules.mak -+include $(top_builddir)/.config -+include $(srcdir)/Makefile.in -+all: $(libraries-y) -+-include $(top_builddir)/.depend -+ -+clean: -+ rm -f *.o *.a $(AR_TARGET) -+ -diff -ruN busybox-1.00-orig/archival/libipkg/Makefile.in busybox-1.00+ipkg-0.99.154/archival/libipkg/Makefile.in ---- busybox-1.00-orig/archival/libipkg/Makefile.in 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/Makefile.in 2005-10-26 17:36:45.000000000 +0200 -@@ -0,0 +1,83 @@ -+# Makefile for busybox -+# -+# Copyright (C) 1999-2004 by Erik Andersen -+# -+# This program is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This program is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+# General Public License for more details. -+# -+# You should have received a copy of the GNU General Public License -+# along with this program; if not, write to the Free Software -+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -+# -+ -+LIBIPKG_AR:=libipkg.a -+ifndef $(LIBIPKG_DIR) -+LIBIPKG_DIR:=$(top_builddir)/archival/libipkg/ -+endif -+srcdir=$(top_srcdir)/archival/libipkg -+ -+LIBIPKG_CORE_SOURCES:= \ -+ args.c \ -+ libipkg.c \ -+ user.c \ -+ -+LIBIPKG_CMD_SOURCES:= \ -+ ipkg_cmd.c \ -+ ipkg_configure.c \ -+ ipkg_download.c \ -+ ipkg_install.c \ -+ ipkg_remove.c \ -+ ipkg_upgrade.c \ -+ -+LIBIPKG_DB_SOURCES:= \ -+ hash_table.c \ -+ ipkg_conf.c \ -+ ipkg_utils.c \ -+ pkg.c \ -+ pkg_depends.c \ -+ pkg_extract.c \ -+ pkg_hash.c \ -+ pkg_parse.c \ -+ pkg_vec.c \ -+ -+LIBIPKG_LIST_SOURCES:= \ -+ conffile.c \ -+ conffile_list.c \ -+ nv_pair.c \ -+ nv_pair_list.c \ -+ pkg_dest.c \ -+ pkg_dest_list.c \ -+ pkg_src.c \ -+ pkg_src_list.c \ -+ str_list.c \ -+ void_list.c \ -+ -+LIBIPKG_UTIL_SOURCES:= \ -+ file_util.c \ -+ ipkg_message.c \ -+ md5.c \ -+ str_util.c \ -+ xsystem.c \ -+ -+LIBIPKG-y += $(LIBIPKG_CORE_SOURCES) -+LIBIPKG-y += $(LIBIPKG_CMD_SOURCES) -+LIBIPKG-y += $(LIBIPKG_DB_SOURCES) -+LIBIPKG-y += $(LIBIPKG_LIST_SOURCES) -+LIBIPKG-y += $(LIBIPKG_UTIL_SOURCES) -+LIBIPKG_OBJS=$(patsubst %.c,$(LIBIPKG_DIR)%.o, $(LIBIPKG-y)) -+ -+libraries-y += $(LIBIPKG_DIR)$(LIBIPKG_AR) -+ -+$(LIBIPKG_DIR)$(LIBIPKG_AR): $(LIBIPKG_OBJS) -+ $(AR) -ro $@ $^ -+ -+$(LIBIPKG_OBJS): $(LIBIPKG_DIR)%.o : $(srcdir)/%.c -+ $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -DIPKG_LIB -DIPKGLIBDIR="\"/usr/lib\"" -DHOST_CPU_STR="\"$(ARCH)\"" -c -o $@ $< -+ -diff -ruN busybox-1.00-orig/archival/libipkg/args.c busybox-1.00+ipkg-0.99.154/archival/libipkg/args.c ---- busybox-1.00-orig/archival/libipkg/args.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/args.c 2005-10-26 17:36:45.000000000 +0200 -@@ -0,0 +1,241 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/args.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/args.c +--- busybox-1.2.0-orig/archival/libipkg/args.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/args.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,242 @@ +/* args.c - parse command-line args + + Carl D. Worth @@ -300,6 +161,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/args.c busybox-1.00+ipkg-0.99.154/a + args->offline_root_post_script_cmd = ARGS_DEFAULT_OFFLINE_ROOT_POST_SCRIPT_CMD; + args->multiple_providers = 0; + args->nocheckfordirorfile = 0; ++ args->noreadfeedsfile = 0; + + return 1; +} @@ -460,10 +322,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/args.c busybox-1.00+ipkg-0.99.154/a +{ + bb_error_msg("version %s\n", IPKG_VERSION); +} -diff -ruN busybox-1.00-orig/archival/libipkg/args.h busybox-1.00+ipkg-0.99.154/archival/libipkg/args.h ---- busybox-1.00-orig/archival/libipkg/args.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/args.h 2005-10-26 17:36:45.000000000 +0200 -@@ -0,0 +1,71 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/args.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/args.h +--- busybox-1.2.0-orig/archival/libipkg/args.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/args.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,72 @@ +/* args.h - parse command-line args + + Carl D. Worth @@ -504,6 +366,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/args.h busybox-1.00+ipkg-0.99.154/a + int verbose_wget; + int verbosity; + int nocheckfordirorfile; ++ int noreadfeedsfile; + char *offline_root; + char *offline_root_pre_script_cmd; + char *offline_root_post_script_cmd; @@ -535,9 +398,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/args.h busybox-1.00+ipkg-0.99.154/a +void args_usage(char *complaint); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/conffile.c busybox-1.00+ipkg-0.99.154/archival/libipkg/conffile.c ---- busybox-1.00-orig/archival/libipkg/conffile.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/conffile.c 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/conffile.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile.c +--- busybox-1.2.0-orig/archival/libipkg/conffile.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,64 @@ +/* conffile.c - the itsy package management system + @@ -603,9 +466,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/conffile.c busybox-1.00+ipkg-0.99.1 + + return ret; +} -diff -ruN busybox-1.00-orig/archival/libipkg/conffile.h busybox-1.00+ipkg-0.99.154/archival/libipkg/conffile.h ---- busybox-1.00-orig/archival/libipkg/conffile.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/conffile.h 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/conffile.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile.h +--- busybox-1.2.0-orig/archival/libipkg/conffile.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,30 @@ +/* conffile.h - the itsy package management system + @@ -637,9 +500,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/conffile.h busybox-1.00+ipkg-0.99.1 + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/conffile_list.c busybox-1.00+ipkg-0.99.154/archival/libipkg/conffile_list.c ---- busybox-1.00-orig/archival/libipkg/conffile_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/conffile_list.c 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/conffile_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile_list.c +--- busybox-1.2.0-orig/archival/libipkg/conffile_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile_list.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,47 @@ +/* conffile_list.c - the itsy package management system + @@ -688,9 +551,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/conffile_list.c busybox-1.00+ipkg-0 + return nv_pair_list_pop(list); +} + -diff -ruN busybox-1.00-orig/archival/libipkg/conffile_list.h busybox-1.00+ipkg-0.99.154/archival/libipkg/conffile_list.h ---- busybox-1.00-orig/archival/libipkg/conffile_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/conffile_list.h 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/conffile_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile_list.h +--- busybox-1.2.0-orig/archival/libipkg/conffile_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/conffile_list.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,36 @@ +/* conffile_list.h - the itsy package management system + @@ -728,9 +591,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/conffile_list.h busybox-1.00+ipkg-0 + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/file_util.c busybox-1.00+ipkg-0.99.154/archival/libipkg/file_util.c ---- busybox-1.00-orig/archival/libipkg/file_util.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/file_util.c 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/file_util.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/file_util.c +--- busybox-1.2.0-orig/archival/libipkg/file_util.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/file_util.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,177 @@ +/* file_util.c - convenience routines for common stat operations + @@ -909,9 +772,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/file_util.c busybox-1.00+ipkg-0.99. + return md5sum_hex; +} + -diff -ruN busybox-1.00-orig/archival/libipkg/file_util.h busybox-1.00+ipkg-0.99.154/archival/libipkg/file_util.h ---- busybox-1.00-orig/archival/libipkg/file_util.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/file_util.h 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/file_util.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/file_util.h +--- busybox-1.2.0-orig/archival/libipkg/file_util.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/file_util.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,29 @@ +/* file_util.h - convenience routines for common file operations + @@ -942,9 +805,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/file_util.h busybox-1.00+ipkg-0.99. +char *file_md5sum_alloc(const char *file_name); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/hash_table.c busybox-1.00+ipkg-0.99.154/archival/libipkg/hash_table.c ---- busybox-1.00-orig/archival/libipkg/hash_table.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/hash_table.c 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/hash_table.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/hash_table.c +--- busybox-1.2.0-orig/archival/libipkg/hash_table.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/hash_table.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,155 @@ +/* hash.c - hash tables for ipkg + @@ -1101,9 +964,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/hash_table.c busybox-1.00+ipkg-0.99 + } +} + -diff -ruN busybox-1.00-orig/archival/libipkg/hash_table.h busybox-1.00+ipkg-0.99.154/archival/libipkg/hash_table.h ---- busybox-1.00-orig/archival/libipkg/hash_table.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/hash_table.h 2005-10-26 17:36:45.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/hash_table.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/hash_table.h +--- busybox-1.2.0-orig/archival/libipkg/hash_table.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/hash_table.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,44 @@ +/* hash.h - hash tables for ipkg + @@ -1149,88 +1012,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/hash_table.h busybox-1.00+ipkg-0.99 +void hash_table_foreach(hash_table_t *hash, void (*f)(const char *key, void *entry, void *data), void *data); + +#endif /* _HASH_TABLE_H_ */ -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg.h ---- busybox-1.00-orig/archival/libipkg/ipkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg.h 2005-10-26 17:45:05.000000000 +0200 -@@ -0,0 +1,74 @@ -+/* ipkg.h - the itsy package management system -+ -+ Carl D. Worth -+ -+ Copyright (C) 2001 University of Southern California -+ -+ This program is free software; you can redistribute it and/or -+ modify it under the terms of the GNU General Public License as -+ published by the Free Software Foundation; either version 2, or (at -+ your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, but -+ WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ General Public License for more details. -+*/ -+ -+#ifndef IPKG_H -+#define IPKG_H -+ -+/* -+#ifdef HAVE_CONFIG_H -+#include "config.h" -+#endif -+*/ -+ -+#if 0 -+#define IPKG_DEBUG_NO_TMP_CLEANUP -+#endif -+ -+#include "ipkg_includes.h" -+#include "ipkg_conf.h" -+#include "ipkg_message.h" -+ -+#define IPKG_PKG_EXTENSION ".ipk" -+#define DPKG_PKG_EXTENSION ".deb" -+ -+#define IPKG_LEGAL_PKG_NAME_CHARS "abcdefghijklmnopqrstuvwxyz0123456789.+-" -+#define IPKG_PKG_VERSION_SEP_CHAR '_' -+ -+#define IPKG_STATE_DIR_PREFIX IPKGLIBDIR"/ipkg" -+#define IPKG_LISTS_DIR_SUFFIX "lists" -+#define IPKG_INFO_DIR_SUFFIX "info" -+#define IPKG_STATUS_FILE_SUFFIX "status" -+ -+#define IPKG_BACKUP_SUFFIX "-ipkg.backup" -+ -+#define IPKG_LIST_DESCRIPTION_LENGTH 128 -+ -+#define IPKG_VERSION "0.99.154" -+ -+ -+enum ipkg_error { -+ IPKG_SUCCESS = 0, -+ IPKG_PKG_DEPS_UNSATISFIED, -+ IPKG_PKG_IS_ESSENTIAL, -+ IPKG_PKG_HAS_DEPENDENTS, -+ IPKG_PKG_HAS_NO_CANDIDATE -+}; -+typedef enum ipkg_error ipkg_error_t; -+ -+extern int ipkg_state_changed; -+ -+ -+struct errlist { -+ char * errmsg; -+ struct errlist * next; -+} ; -+ -+extern struct errlist* error_list; -+ -+extern ipkg_conf_t *global_conf; -+ -+#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_cmd.c ---- busybox-1.00-orig/archival/libipkg/ipkg_cmd.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_cmd.c 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,1344 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_cmd.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_cmd.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_cmd.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_cmd.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,1431 @@ +/* ipkg_cmd.c - the itsy package management system + + Carl D. Worth @@ -1258,6 +1043,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 +#include +#include +#include ++#include + +#include "ipkg_conf.h" +#include "ipkg_cmd.h" @@ -1425,13 +1211,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 + pkg_src_t *src; + + -+ if (conf->offline_root) { -+ sprintf_alloc(&lists_dir, "%s/%s", -+ conf->offline_root, -+ conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir); -+ } else { -+ sprintf_alloc(&lists_dir, "%s", conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir); -+ } ++ sprintf_alloc(&lists_dir, "%s", conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir); + + if (! file_is_dir(lists_dir)) { + if (file_exists(lists_dir)) { @@ -1561,6 +1341,8 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 + //if (strcmp (tmp + (tmplen - strlen (DPKG_PKG_EXTENSION)), DPKG_PKG_EXTENSION) != 0) + // continue; + ++ ipkg_message(conf, IPKG_DEBUG2, "Debug mfs: %s \n",filename ); ++ + err = ipkg_prepare_url_for_install(conf, filename, &argv[i]); + if (err) + return err; @@ -1568,11 +1350,90 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 + return 0; +} + ++struct ipkg_intercept ++{ ++ char *oldpath; ++ char *statedir; ++}; ++ ++typedef struct ipkg_intercept *ipkg_intercept_t; ++ ++ipkg_intercept_t ipkg_prep_intercepts(ipkg_conf_t *conf) ++{ ++ ipkg_intercept_t ctx; ++ char *newpath; ++ int gen; ++ ++ ctx = malloc (sizeof (*ctx)); ++ ctx->oldpath = strdup (getenv ("PATH")); ++ ++ sprintf_alloc (&newpath, "%s/ipkg/intercept:%s", IPKGLIBDIR, ctx->oldpath); ++ setenv ("PATH", newpath, 1); ++ free (newpath); ++ ++ gen = 0; ++ retry: ++ sprintf_alloc (&ctx->statedir, "/tmp/ipkg-intercept-%d-%d", getpid (), gen); ++ if (mkdir (ctx->statedir, 0770) < 0) { ++ if (errno == EEXIST) { ++ free (ctx->statedir); ++ gen++; ++ goto retry; ++ } ++ perror (ctx->statedir); ++ return NULL; ++ } ++ setenv ("IPKG_INTERCEPT_DIR", ctx->statedir, 1); ++ return ctx; ++} ++ ++int ipkg_finalize_intercepts(ipkg_intercept_t ctx) ++{ ++ char *cmd; ++ DIR *dir; ++ int err = 0; ++ ++ setenv ("PATH", ctx->oldpath, 1); ++ free (ctx->oldpath); ++ ++ dir = opendir (ctx->statedir); ++ if (dir) { ++ struct dirent *de; ++ while (de = readdir (dir), de != NULL) { ++ char *path; ++ ++ if (de->d_name[0] == '.') ++ continue; ++ ++ sprintf_alloc (&path, "%s/%s", ctx->statedir, de->d_name); ++ if (access (path, X_OK) == 0) { ++ if (system (path)) { ++ err = errno; ++ perror (de->d_name); ++ } ++ } ++ free (path); ++ } ++ } else ++ perror (ctx->statedir); ++ ++ sprintf_alloc (&cmd, "rm -rf %s", ctx->statedir); ++ system (cmd); ++ free (cmd); ++ ++ free (ctx->statedir); ++ free (ctx); ++ ++ return err; ++} ++ +int ipkg_configure_packages(ipkg_conf_t *conf, char *pkg_name) +{ + pkg_vec_t *all; + int i; + pkg_t *pkg; ++ ipkg_intercept_t ic; ++ int r, err = 0; + + ipkg_message(conf, IPKG_INFO, + "Configuring unpacked packages\n"); @@ -1581,6 +1442,8 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 + all = pkg_vec_alloc(); + pkg_hash_fetch_available(&conf->pkg_hash, all); + ++ ic = ipkg_prep_intercepts (conf); ++ + for(i = 0; i < all->len; i++) { + pkg = all->pkgs[i]; + @@ -1591,16 +1454,24 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 + ipkg_message(conf, IPKG_NOTICE, + "Configuring %s\n", pkg->name); + fflush( stdout ); -+ if (ipkg_configure(conf, pkg) == 0) { ++ r = ipkg_configure(conf, pkg); ++ if (r == 0) { + pkg->state_status = SS_INSTALLED; + pkg->parent->state_status = SS_INSTALLED; + pkg->state_flag &= ~SF_PREFER; ++ } else { ++ if (!err) ++ err = r; + } + } + } + ++ r = ipkg_finalize_intercepts (ic); ++ if (r && !err) ++ err = r; ++ + pkg_vec_free(all); -+ return 0; ++ return err; +} + +static void sigint_handler(int sig) @@ -1627,6 +1498,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 + for (i=0; i < argc; i++) { + arg = argv[i]; + ++ ipkg_message(conf, IPKG_DEBUG2, "Debug install_cmd: %s \n",arg ); + err = ipkg_prepare_url_for_install(conf, arg, &argv[i]); + if (err != EINVAL && err != 0) + return err; @@ -2032,7 +1904,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 + ipkg_message(conf, IPKG_ERROR, "Package seems to be %s not installed (STATUS = NOT_INSTALLED).\n", pkg->name); + continue; + } -+ ipkg_remove_pkg(conf, pkg_to_remove); ++ ipkg_remove_pkg(conf, pkg_to_remove,0); + done = 1; + } + free (pkg_name); @@ -2072,7 +1944,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 + && !pkg_has_installed_dependents(conf, pkg->parent, pkg, NULL)) { + removed++; + ipkg_message(conf, IPKG_NOTICE, "Removing non-user leaf package %s\n"); -+ ipkg_remove_pkg(conf, pkg); ++ ipkg_remove_pkg(conf, pkg,0); + done = 1; + } + } @@ -2575,9 +2447,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.c busybox-1.00+ipkg-0.99.1 +} + + -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_cmd.h ---- busybox-1.00-orig/archival/libipkg/ipkg_cmd.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_cmd.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_cmd.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_cmd.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_cmd.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_cmd.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,46 @@ +/* ipkg_cmd.h - the itsy package management system + @@ -2625,10 +2497,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_cmd.h busybox-1.00+ipkg-0.99.1 +int pkg_mark_provides(pkg_t *pkg); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_conf.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_conf.c ---- busybox-1.00-orig/archival/libipkg/ipkg_conf.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_conf.c 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,709 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_conf.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_conf.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_conf.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_conf.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,711 @@ +/* ipkg_conf.c - the itsy package management system + + Carl D. Worth @@ -2814,6 +2686,13 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_conf.c busybox-1.00+ipkg-0.99. + sprintf (lists_dir,"%s",IPKG_CONF_LISTS_DIR); + } + ++ if (args->offline_root) { ++ char *tmp = malloc(strlen(lists_dir) + strlen(args->offline_root) + 1); ++ sprintf_alloc(&tmp, "%s/%s",args->offline_root,lists_dir); ++ free(lists_dir); ++ lists_dir = tmp; ++ } ++ + pending_dir = malloc(strlen(lists_dir)+strlen("/pending")+5); + snprintf(pending_dir,strlen(lists_dir)+strlen("/pending") ,"%s%s",lists_dir,"/pending"); + @@ -2910,7 +2789,8 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_conf.c busybox-1.00+ipkg-0.99. +*/ + if ( !(args->nocheckfordirorfile)){ + /* need to run load the source list before dest list -Jamey */ -+ set_and_load_pkg_src_list(conf, &conf->pkg_src_list); ++ if ( !(args->noreadfeedsfile)) ++ set_and_load_pkg_src_list(conf, &conf->pkg_src_list); + + /* Now that we have resolved conf->offline_root, we can commit to + the directory names for the dests and load in all the package @@ -3031,16 +2911,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_conf.c busybox-1.00+ipkg-0.99. + if (src == NULL) { + continue; + } -+ if (conf->offline_root) { -+ sprintf_alloc(&list_file, "%s/%s/%s", -+ conf->offline_root, -+ conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir, -+ src->name); -+ } else { -+ sprintf_alloc(&list_file, "%s/%s", -+ conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir, -+ src->name); -+ } ++ ++ sprintf_alloc(&list_file, "%s/%s", ++ conf->restrict_to_default_dest ? conf->default_dest->lists_dir : conf->lists_dir, ++ src->name); + + if (file_exists(list_file)) { + pkg_hash_add_from_file(conf, list_file, src, NULL, 0); @@ -3338,9 +3212,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_conf.c busybox-1.00+ipkg-0.99. + sprintf_alloc(&root_filename, "%s%s", (conf->offline_root ? conf->offline_root : ""), filename); + return root_filename; +} -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_conf.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_conf.h ---- busybox-1.00-orig/archival/libipkg/ipkg_conf.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_conf.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_conf.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_conf.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_conf.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_conf.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,107 @@ +/* ipkg_conf.h - the itsy package management system + @@ -3449,9 +3323,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_conf.h busybox-1.00+ipkg-0.99. +char *root_filename_alloc(ipkg_conf_t *conf, char *filename); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_configure.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_configure.c ---- busybox-1.00-orig/archival/libipkg/ipkg_configure.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_configure.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_configure.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_configure.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_configure.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_configure.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,40 @@ +/* ipkg_configure.c - the itsy package management system + @@ -3493,9 +3367,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_configure.c busybox-1.00+ipkg- + return 0; +} + -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_configure.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_configure.h ---- busybox-1.00-orig/archival/libipkg/ipkg_configure.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_configure.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_configure.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_configure.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_configure.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_configure.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,25 @@ +/* ipkg_configure.h - the itsy package management system + @@ -3522,10 +3396,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_configure.h busybox-1.00+ipkg- +int ipkg_configure(ipkg_conf_t *ipkg_conf, pkg_t *pkg); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_download.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_download.c ---- busybox-1.00-orig/archival/libipkg/ipkg_download.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_download.c 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,191 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_download.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_download.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_download.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_download.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,190 @@ +/* ipkg_download.c - the itsy package management system + + Carl D. Worth @@ -3597,12 +3471,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_download.c busybox-1.00+ipkg-0 + } + + /* XXX: BUG rewrite to use execvp or else busybox's internal wget -Jamey 7/23/2002 */ -+ sprintf_alloc(&cmd, "wget --passive-ftp %s %s%s %s%s %s -P %s %s", -+ (conf->http_proxy || conf->ftp_proxy) ? "--proxy=on" : "", -+ conf->proxy_user ? "--proxy-user=" : "", -+ conf->proxy_user ? conf->proxy_user : "", -+ conf->proxy_passwd ? "--proxy-passwd=" : "", -+ conf->proxy_passwd ? conf->proxy_passwd : "", ++ sprintf_alloc(&cmd, "wget %s -P %s %s", + conf->verbose_wget ? "" : "-q", + conf->tmp_dir, + src); @@ -3694,8 +3563,12 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_download.c busybox-1.00+ipkg-0 + if (err) + return err; + pkg->local_filename = strdup(url); ++ ipkg_message(conf, IPKG_DEBUG2, "Package %s provided by hand \(%s\).\n", pkg->name,pkg->local_filename); ++ pkg->provided_by_hand = 1; + + } else { ++ pkg_deinit(pkg); ++ free(pkg); + return 0; + } + @@ -3713,13 +3586,13 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_download.c busybox-1.00+ipkg-0 + return 0; + } + if (namep) { -+ *namep = pkg->name; ++ *namep = strdup(pkg->name); + } + return 0; +} -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_download.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_download.h ---- busybox-1.00-orig/archival/libipkg/ipkg_download.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_download.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_download.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_download.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_download.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_download.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,30 @@ +/* ipkg_download.h - the itsy package management system + @@ -3751,24 +3624,102 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_download.h busybox-1.00+ipkg-0 +int ipkg_prepare_url_for_install(ipkg_conf_t *conf, const char *url, char **namep); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_includes.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_includes.h ---- busybox-1.00-orig/archival/libipkg/ipkg_includes.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_includes.h 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,79 @@ -+#ifndef IPKG_INCLUDES_H -+#define IPKG_INCLUDES_H +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,74 @@ ++/* ipkg.h - the itsy package management system + -+/* Define to 1 if you have the header file. */ -+#define HAVE_MEMORY_H 1 ++ Carl D. Worth + -+/* Define to 1 if you have the header file. */ -+#define HAVE_REGEX_H 1 ++ Copyright (C) 2001 University of Southern California + -+/* Define to 1 if you have the header file. */ -+#define HAVE_STDLIB_H 1 ++ This program is free software; you can redistribute it and/or ++ modify it under the terms of the GNU General Public License as ++ published by the Free Software Foundation; either version 2, or (at ++ your option) any later version. + -+/* Define to 1 if you have the header file. */ -+#define HAVE_STRINGS_H 1 ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef IPKG_H ++#define IPKG_H ++ ++/* ++#ifdef HAVE_CONFIG_H ++#include "config.h" ++#endif ++*/ ++ ++#if 0 ++#define IPKG_DEBUG_NO_TMP_CLEANUP ++#endif ++ ++#include "ipkg_includes.h" ++#include "ipkg_conf.h" ++#include "ipkg_message.h" ++ ++#define IPKG_PKG_EXTENSION ".ipk" ++#define DPKG_PKG_EXTENSION ".deb" ++ ++#define IPKG_LEGAL_PKG_NAME_CHARS "abcdefghijklmnopqrstuvwxyz0123456789.+-" ++#define IPKG_PKG_VERSION_SEP_CHAR '_' ++ ++#define IPKG_STATE_DIR_PREFIX IPKGLIBDIR"/ipkg" ++#define IPKG_LISTS_DIR_SUFFIX "lists" ++#define IPKG_INFO_DIR_SUFFIX "info" ++#define IPKG_STATUS_FILE_SUFFIX "status" ++ ++#define IPKG_BACKUP_SUFFIX "-ipkg.backup" ++ ++#define IPKG_LIST_DESCRIPTION_LENGTH 128 ++ ++#define IPKG_VERSION "0.99.162" ++ ++ ++enum ipkg_error { ++ IPKG_SUCCESS = 0, ++ IPKG_PKG_DEPS_UNSATISFIED, ++ IPKG_PKG_IS_ESSENTIAL, ++ IPKG_PKG_HAS_DEPENDENTS, ++ IPKG_PKG_HAS_NO_CANDIDATE ++}; ++typedef enum ipkg_error ipkg_error_t; ++ ++extern int ipkg_state_changed; ++ ++ ++struct errlist { ++ char * errmsg; ++ struct errlist * next; ++} ; ++ ++extern struct errlist* error_list; ++ ++extern ipkg_conf_t *global_conf; ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_includes.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_includes.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_includes.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_includes.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,79 @@ ++#ifndef IPKG_INCLUDES_H ++#define IPKG_INCLUDES_H ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_MEMORY_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_REGEX_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STDLIB_H 1 ++ ++/* Define to 1 if you have the header file. */ ++#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 @@ -3834,10 +3785,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_includes.h busybox-1.00+ipkg-0 +#endif + +#endif /* IPKG_INCLUDES_H */ -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_install.c ---- busybox-1.00-orig/archival/libipkg/ipkg_install.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_install.c 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,1823 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_install.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_install.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_install.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_install.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,1942 @@ +/* ipkg_install.c - the itsy package management system + + Carl D. Worth @@ -3892,6 +3843,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. +static int preinst_configure(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); +static int preinst_configure_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); +static int check_data_file_clashes(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); ++static int check_data_file_clashes_change(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); +static int check_data_file_clashes_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); +static int backup_modified_conffiles(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); +static int backup_modified_conffiles_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg); @@ -3969,7 +3921,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + } + + ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__); -+ return ipkg_install_pkg(conf, pkg); ++ return ipkg_install_pkg(conf, pkg,0); +} + +ipkg_error_t ipkg_install_by_name(ipkg_conf_t *conf, const char *pkg_name) @@ -3978,9 +3930,29 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + pkg_t *old, *new; + char *old_version, *new_version; + ++ ipkg_message(conf, IPKG_DEBUG2, " Getting old from pkg_hash_fetch \n" ); + old = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg_name); ++ if ( old ) ++ ipkg_message(conf, IPKG_DEBUG2, " Old versions from pkg_hash_fetch %s \n", old->version ); + ++ ipkg_message(conf, IPKG_DEBUG2, " Getting new from pkg_hash_fetch \n" ); + new = pkg_hash_fetch_best_installation_candidate_by_name(conf, pkg_name); ++ if ( new ) ++ ipkg_message(conf, IPKG_DEBUG2, " New versions from pkg_hash_fetch %s \n", new->version ); ++ ++/* Pigi Basically here is broken the version stuff. ++ What's happening is that nothing provide the version to differents ++ functions, so the returned struct is always the latest. ++ That's why the install by name don't work. ++*/ ++ ipkg_message(conf, IPKG_DEBUG2, " Versions from pkg_hash_fetch in %s ", __FUNCTION__ ); ++ ++ if ( old ) ++ ipkg_message(conf, IPKG_DEBUG2, " old %s ", old->version ); ++ if ( new ) ++ ipkg_message(conf, IPKG_DEBUG2, " new %s ", new->version ); ++ ipkg_message(conf, IPKG_DEBUG2, " \n"); ++ + if (new == NULL) { + return IPKG_PKG_HAS_NO_CANDIDATE; + } @@ -3998,7 +3970,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + /* reinstall, and some check could fail asking the "force-reinstall" option */ + } + ipkg_message(conf, IPKG_DEBUG, -+ "comparing visible versions of pkg %s:" ++ "Comparing visible versions of pkg %s:" + "\n\t%s is installed " + "\n\t%s is available " + "\n\t%d was comparison result\n", @@ -4030,7 +4002,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + anyone ever wants to make a nice libipkg. */ + + ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__); -+ return ipkg_install_pkg(conf, new); ++ return ipkg_install_pkg(conf, new,0); +} + +ipkg_error_t ipkg_install_multi_by_name(ipkg_conf_t *conf, const char *pkg_name) @@ -4231,7 +4203,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + if ((dep->state_status != SS_INSTALLED) + && (dep->state_status != SS_UNPACKED)) { + ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__); -+ err = ipkg_install_pkg(conf, dep); ++ err = ipkg_install_pkg(conf, dep,0); + if (err) { + pkg_vec_free(depends); + return err; @@ -4464,7 +4436,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + pkg_t *replacee = replacees->pkgs[i]; + int err; + replacee->state_flag |= SF_REPLACE; /* flag it so remove won't complain */ -+ err = ipkg_remove_pkg(conf, replacee); ++ err = ipkg_remove_pkg(conf, replacee,0); + if (err) + return err; + } @@ -4480,7 +4452,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + pkg_t *replacee = replacees->pkgs[i]; + if (replacee->state_status != SS_INSTALLED) { + ipkg_message(conf, IPKG_DEBUG2,"Function: %s calling ipkg_install_pkg \n",__FUNCTION__); -+ err = ipkg_install_pkg(conf, replacee); ++ err = ipkg_install_pkg(conf, replacee,0); + if (err) + return err; + } @@ -4495,7 +4467,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. +} + +/* compares versions of pkg and old_pkg, returns 0 if OK to proceed with installation of pkg, 1 otherwise */ -+static int ipkg_install_check_downgrade(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++static int ipkg_install_check_downgrade(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg, int message) +{ + if (old_pkg) { + char message_out[15]; @@ -4504,10 +4476,11 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + int cmp = pkg_compare_versions(old_pkg, pkg); + int rc = 0; + -+ strncpy (message_out,"Upgrading ",13); ++ memset(message_out,'\x0',15); ++ strncpy (message_out,"Upgrading ",strlen("Upgrading ")); + if ( (conf->force_downgrade==1) && (cmp > 0) ){ /* We've been asked to allow downgrade and version is precedent */ + cmp = -1 ; /* then we force ipkg to downgrade */ -+ strncpy (message_out,"Downgrading ",13); /* We need to use a value < 0 because in the 0 case we are asking to */ ++ strncpy (message_out,"Downgrading ",strlen("Downgrading ")); /* We need to use a value < 0 because in the 0 case we are asking to */ + /* reinstall, and some check could fail asking the "force-reinstall" option */ + } + @@ -4518,7 +4491,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + rc = 1; + } else if (cmp < 0) { + ipkg_message(conf, IPKG_NOTICE, -+ "%s %s on %s from %s to %s...\n", ++ "%s%s on %s from %s to %s...\n", + message_out, pkg->name, old_pkg->dest->name, old_version, new_version); + pkg->dest = old_pkg->dest; + rc = 0; @@ -4540,9 +4513,16 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + free(new_version); + return rc; + } else { ++ char message_out[15] ; ++ memset(message_out,'\x0',15); ++ if ( message ) ++ strncpy( message_out,"Upgrading ",strlen("Upgrading ") ); ++ else ++ strncpy( message_out,"Installing ",strlen("Installing ") ); + char *version = pkg_version_str_alloc(pkg); ++ + ipkg_message(conf, IPKG_NOTICE, -+ "Installing %s (%s) to %s...\n", ++ "%s%s (%s) to %s...\n", message_out, + pkg->name, version, pkg->dest->name); + free(version); + return 0; @@ -4550,13 +4530,19 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. +} + +/* and now the meat... */ -+int ipkg_install_pkg(ipkg_conf_t *conf, pkg_t *pkg) ++int ipkg_install_pkg(ipkg_conf_t *conf, pkg_t *pkg, int from_upgrade) +{ + int err = 0; ++ int message = 0; + pkg_t *old_pkg = NULL; + pkg_vec_t *replacees; + abstract_pkg_t *ab_pkg = NULL; + int old_state_flag; ++ char* file_md5; ++ ++ ++ if ( from_upgrade ) ++ message = 1; /* Coming from an upgrade, and should change the output message */ + + if (!pkg) { + ipkg_message(conf, IPKG_ERROR, @@ -4587,11 +4573,14 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + + old_pkg = pkg_hash_fetch_installed_by_name(&conf->pkg_hash, pkg->name); + -+ err = ipkg_install_check_downgrade(conf, pkg, old_pkg); ++ err = ipkg_install_check_downgrade(conf, pkg, old_pkg, message); + if (err) { return err; } + + pkg->state_want = SW_INSTALL; -+ if (old_pkg) old_pkg->state_want = SW_DEINSTALL; /* needed for check_data_file_clashes of dependences */ ++ if (old_pkg){ ++ old_pkg->state_want = SW_DEINSTALL; /* needed for check_data_file_clashes of dependences */ ++ } ++ + + /* Abhaya: conflicts check */ + err = check_conflicts_for(conf, pkg); @@ -4616,11 +4605,29 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + return err; + } + } ++ ++/* Check for md5 values */ ++ if (pkg->md5sum) ++ { ++ file_md5 = file_md5sum_alloc(pkg->local_filename); ++ if (strcmp(file_md5, pkg->md5sum)) ++ { ++ ipkg_message(conf, IPKG_ERROR, ++ "Package %s md5sum mismatch. Either the ipkg or the package index are corrupt. Try 'ipkg update'.\n", ++ pkg->name); ++ free(file_md5); ++ return err; ++ } ++ free(file_md5); ++ } ++ + if (pkg->tmp_unpack_dir == NULL) { + unpack_pkg_control_files(conf, pkg); + } + + /* We should update the filelist here, so that upgrades of packages that split will not fail. -Jamey 27-MAR-03 */ ++/* Pigi: check if it will pass from here when replacing. It seems to fail */ ++/* That's rather strange that files don't change owner. Investigate !!!!!!*/ + err = update_file_ownership(conf, pkg, old_pkg); + if (err) { return err; } + @@ -4687,7 +4694,16 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + " removing obsolesced files\n"); + remove_obsolesced_files(conf, pkg, old_pkg); + } ++ /* removing files from old package, to avoid ghost files */ ++ remove_data_files_and_list(conf, old_pkg); ++/* Pigi : It should be better to remove also maintainer and postrem scripts here, just in case*/ ++ remove_maintainer_scripts_except_postrm(conf, old_pkg); ++ remove_postrm(conf, old_pkg); ++/* Pigi */ ++ + } ++ ++ + ipkg_message(conf, IPKG_INFO, + " installing maintainer scripts\n"); + install_maintainer_scripts(conf, pkg, old_pkg); @@ -4699,6 +4715,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + " installing data files\n"); + install_data_files(conf, pkg); + ++/* read comments from function for detail but I will execute this here as all other tests are ok.*/ ++ err = check_data_file_clashes_change(conf, pkg, old_pkg); ++ + ipkg_message(conf, IPKG_INFO, + " resolving conf files\n"); + resolve_conffiles(conf, pkg); @@ -4926,6 +4945,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + return 0; +} + ++ +static int check_data_file_clashes(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) +{ + /* DPKG_INCOMPATIBILITY: @@ -4978,8 +4998,8 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + + /* Pre-existing files are OK if owned by a package replaced by new pkg. */ + if (owner) { ++ ipkg_message(conf, IPKG_DEBUG2, "Checking for replaces for %s in package %s\n", filename, owner->name); + if (pkg_replaces(pkg, owner)) { -+ ipkg_message(conf, IPKG_INFO, "Replacing pre-existing file %s owned by package %s\n", filename, owner->name); + continue; + } +/* If the file that would be installed is owned by the same package, ( as per a reinstall or similar ) @@ -5018,6 +5038,56 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + return clashes; +} + ++static int check_data_file_clashes_change(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) ++{ ++ /* Basically that's the worst hack I could do to be able to change ownership of ++ file list, but, being that we have no way to unwind the mods, due to structure ++ of hash table, probably is the quickest hack too, whishing it would not slow-up thing too much. ++ What we do here is change the ownership of file in hash if a replace ( or similar events ++ happens ) ++ Only the action that are needed to change name should be considered. ++ @@@ To change after 1.0 release. ++ */ ++ str_list_t *files_list; ++ str_list_elt_t *iter; ++ ++ int clashes = 0; ++ ++ files_list = pkg_get_installed_files(pkg); ++ for (iter = files_list->head; iter; iter = iter->next) { ++ char *root_filename; ++ char *filename = iter->data; ++ root_filename = root_filename_alloc(conf, filename); ++ if (file_exists(root_filename) && (! file_is_dir(root_filename))) { ++ pkg_t *owner; ++ ++ if (conf->force_overwrite) { ++ /* but we need to change who owns this file */ ++ file_hash_set_file_owner(conf, filename, pkg); ++ continue; ++ } ++ ++ owner = file_hash_get_file_owner(conf, filename); ++ ++ /* Pre-existing files are OK if owned by a package replaced by new pkg. */ ++ if (owner) { ++ if (pkg_replaces(pkg, owner)) { ++/* It's now time to change the owner of that file. ++ It has been "replaced" from the new "Replaces", then I need to inform lists file about that. */ ++ ipkg_message(conf, IPKG_INFO, "Replacing pre-existing file %s owned by package %s\n", filename, owner->name); ++ file_hash_set_file_owner(conf, filename, pkg); ++ continue; ++ } ++ } ++ ++ } ++ free(root_filename); ++ } ++ pkg_free_installed_files(pkg); ++ ++ return clashes; ++} ++ +static int check_data_file_clashes_unwind(ipkg_conf_t *conf, pkg_t *pkg, pkg_t *old_pkg) +{ + /* Nothing to do since check_data_file_clashes doesn't change state */ @@ -5422,7 +5492,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. + /* first, remove the packages that need removing */ + for (i = 0 ; i < pkgs_to_remove->len; i++ ) { + pkg_t *pkg = pkgs_to_remove->pkgs[i]; -+ err = ipkg_remove_pkg(conf, pkg); ++ err = ipkg_remove_pkg(conf, pkg,0); + if (err) return err; + } + return 0; @@ -5661,9 +5731,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.c busybox-1.00+ipkg-0. +} + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_install.h ---- busybox-1.00-orig/archival/libipkg/ipkg_install.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_install.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_install.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_install.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_install.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_install.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,35 @@ +/* ipkg_install.h - the itsy package management system + @@ -5691,7 +5761,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.h busybox-1.00+ipkg-0. +ipkg_error_t ipkg_install_by_name(ipkg_conf_t *conf, const char *pkg_name); +ipkg_error_t ipkg_install_multi_by_name(ipkg_conf_t *conf, const char *pkg_name); +int ipkg_install_from_file(ipkg_conf_t *conf, const char *filename); -+int ipkg_install_pkg(ipkg_conf_t *conf, pkg_t *pkg); ++int ipkg_install_pkg(ipkg_conf_t *conf, pkg_t *pkg,int from_upgrading); +int satisfy_dependencies_for(ipkg_conf_t *conf, pkg_t *pkg); + +int ipkg_satisfy_all_dependences(ipkg_conf_t *conf); @@ -5700,9 +5770,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_install.h busybox-1.00+ipkg-0. +int name_mark_dependencies_for_installation(ipkg_conf_t *conf, const char *pkg_name, pkg_vec_t *pkgs_needed); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_message.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_message.c ---- busybox-1.00-orig/archival/libipkg/ipkg_message.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_message.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_message.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_message.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_message.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_message.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,61 @@ +/* ipkg_message.c - the itsy package management system + @@ -5765,9 +5835,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_message.c busybox-1.00+ipkg-0. + } +} +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_message.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_message.h ---- busybox-1.00-orig/archival/libipkg/ipkg_message.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_message.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_message.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_message.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_message.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_message.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,32 @@ +/* ipkg_message.h - the itsy package management system + @@ -5801,10 +5871,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_message.h busybox-1.00+ipkg-0. +extern void ipkg_message(ipkg_conf_t *conf, message_level_t level, char *fmt, ...); + +#endif /* _IPKG_MESSAGE_H_ */ -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_remove.c ---- busybox-1.00-orig/archival/libipkg/ipkg_remove.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_remove.c 2005-10-26 17:45:58.000000000 +0200 -@@ -0,0 +1,381 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_remove.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_remove.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_remove.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_remove.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,383 @@ +/* ipkg_remove.c - the itsy package management system + + Carl D. Worth @@ -5835,10 +5905,6 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + +#include "ipkg_cmd.h" + -+static int remove_data_files_and_list(ipkg_conf_t *conf, pkg_t *pkg); -+static int remove_maintainer_scripts_except_postrm(ipkg_conf_t *conf, pkg_t *pkg); -+static int remove_postrm(ipkg_conf_t *conf, pkg_t *pkg); -+ +/* + * Returns number of the number of packages depending on the packages provided by this package. + * Every package implicitly provides itself. @@ -5947,7 +6013,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + + + for (i = 0; i < dependent_pkgs->len; i++) { -+ int err = ipkg_remove_pkg(conf, dependent_pkgs->pkgs[i]); ++ int err = ipkg_remove_pkg(conf, dependent_pkgs->pkgs[i],0); + if (err) + return err; + } @@ -5972,12 +6038,16 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + return 0; +} + -+int ipkg_remove_pkg(ipkg_conf_t *conf, pkg_t *pkg) ++int ipkg_remove_pkg(ipkg_conf_t *conf, pkg_t *pkg,int message) +{ ++/* Actually, when "message == 1" I have been called from an upgrade, and not from a normal remove ++ thus I wan't check for essential, as I'm upgrading. ++ I hope it won't break anything :) ++*/ + int err; + abstract_pkg_t *parent_pkg = NULL; + -+ if (pkg->essential) { ++ if (pkg->essential && !message) { + if (conf->force_removal_of_essential_packages) { + fprintf(stderr, "WARNING: Removing essential package %s under your coercion.\n" + "\tIf your system breaks, you get to keep both pieces\n", @@ -6023,9 +6093,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + } + } + -+ printf("Removing package %s from %s...\n", pkg->name, pkg->dest->name); -+ fflush(stdout); -+ ++ if ( message==0 ){ ++ printf("Removing package %s from %s...\n", pkg->name, pkg->dest->name); ++ fflush(stdout); ++ } + pkg->state_flag |= SF_FILELIST_CHANGED; + + pkg->state_want = SW_DEINSTALL; @@ -6060,11 +6131,11 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + +int ipkg_purge_pkg(ipkg_conf_t *conf, pkg_t *pkg) +{ -+ ipkg_remove_pkg(conf, pkg); ++ ipkg_remove_pkg(conf, pkg,0); + return 0; +} + -+static int remove_data_files_and_list(ipkg_conf_t *conf, pkg_t *pkg) ++int remove_data_files_and_list(ipkg_conf_t *conf, pkg_t *pkg) +{ + str_list_t installed_dirs; + str_list_t *installed_files; @@ -6146,7 +6217,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + return 0; +} + -+static int remove_maintainer_scripts_except_postrm(ipkg_conf_t *conf, pkg_t *pkg) ++int remove_maintainer_scripts_except_postrm(ipkg_conf_t *conf, pkg_t *pkg) +{ + int i, err; + char *globpattern; @@ -6166,6 +6237,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + if (str_ends_with(globbuf.gl_pathv[i], ".postrm")) { + continue; + } ++ ipkg_message(conf, IPKG_INFO, " deleting %s\n", globbuf.gl_pathv[i]); + unlink(globbuf.gl_pathv[i]); + } + globfree(&globbuf); @@ -6173,7 +6245,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + return 0; +} + -+static int remove_postrm(ipkg_conf_t *conf, pkg_t *pkg) ++int remove_postrm(ipkg_conf_t *conf, pkg_t *pkg) +{ + char *postrm_file_name; + @@ -6186,10 +6258,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.c busybox-1.00+ipkg-0.9 + + return 0; +} -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_remove.h ---- busybox-1.00-orig/archival/libipkg/ipkg_remove.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_remove.h 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,29 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_remove.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_remove.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_remove.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_remove.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,33 @@ +/* ipkg_remove.h - the itsy package management system + + Carl D. Worth @@ -6213,15 +6285,19 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_remove.h busybox-1.00+ipkg-0.9 +#include "pkg.h" +#include "ipkg_conf.h" + -+int ipkg_remove_pkg(ipkg_conf_t *conf, pkg_t *pkg); ++int ipkg_remove_pkg(ipkg_conf_t *conf, pkg_t *pkg,int message); +int ipkg_purge_pkg(ipkg_conf_t *conf, pkg_t *pkg); +int possible_broken_removal_of_packages (ipkg_conf_t *conf, pkg_t *pkg); +int pkg_has_installed_dependents(ipkg_conf_t *conf, abstract_pkg_t *parent_apkg, pkg_t *pkg, abstract_pkg_t *** pdependents); ++int remove_data_files_and_list(ipkg_conf_t *conf, pkg_t *pkg); ++int remove_maintainer_scripts_except_postrm (ipkg_conf_t *conf, pkg_t *pkg); ++int remove_postrm (ipkg_conf_t *conf, pkg_t *pkg); ++ + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_upgrade.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_upgrade.c ---- busybox-1.00-orig/archival/libipkg/ipkg_upgrade.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_upgrade.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_upgrade.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_upgrade.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_upgrade.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_upgrade.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,77 @@ +/* ipkg_upgrade.c - the itsy package management system + @@ -6298,11 +6374,11 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_upgrade.c busybox-1.00+ipkg-0. + } + + new->state_flag |= SF_USER; -+ return ipkg_install_pkg(conf, new); ++ return ipkg_install_pkg(conf, new,1); +} -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_upgrade.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_upgrade.h ---- busybox-1.00-orig/archival/libipkg/ipkg_upgrade.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_upgrade.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_upgrade.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_upgrade.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_upgrade.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_upgrade.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,18 @@ +/* ipkg_upgrade.c - the itsy package management system + @@ -6322,9 +6398,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_upgrade.h busybox-1.00+ipkg-0. +#include "ipkg.h" + +int ipkg_upgrade_pkg(ipkg_conf_t *conf, pkg_t *old); -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_utils.c busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_utils.c ---- busybox-1.00-orig/archival/libipkg/ipkg_utils.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_utils.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_utils.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_utils.c +--- busybox-1.2.0-orig/archival/libipkg/ipkg_utils.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_utils.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,181 @@ +/* ipkg_utils.c - the itsy package management system + @@ -6507,9 +6583,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_utils.c busybox-1.00+ipkg-0.99 +} + + -diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_utils.h busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_utils.h ---- busybox-1.00-orig/archival/libipkg/ipkg_utils.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/ipkg_utils.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/ipkg_utils.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_utils.h +--- busybox-1.2.0-orig/archival/libipkg/ipkg_utils.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/ipkg_utils.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,29 @@ +/* ipkg_utils.h - the itsy package management system + @@ -6540,10 +6616,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/ipkg_utils.h busybox-1.00+ipkg-0.99 +int line_is_blank(const char *line); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/libipkg.c busybox-1.00+ipkg-0.99.154/archival/libipkg/libipkg.c ---- busybox-1.00-orig/archival/libipkg/libipkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/libipkg.c 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,512 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/libipkg.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/libipkg.c +--- busybox-1.2.0-orig/archival/libipkg/libipkg.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/libipkg.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,527 @@ +/* ipkglib.c - the itsy package management system + + Florina Boor @@ -7015,6 +7091,21 @@ diff -ruN busybox-1.00-orig/archival/libipkg/libipkg.c busybox-1.00+ipkg-0.99.15 + !strcmp(cmd_name,"print_installation_architecture") ) + args.nocheckfordirorfile = 1; + ++/* Pigi: added a flag to disable the reading of feed files if the command does not need to ++ read anything from there. ++*/ ++ if ( !strcmp(cmd_name,"flag") || ++ !strcmp(cmd_name,"configure") || ++ !strcmp(cmd_name,"remove") || ++ !strcmp(cmd_name,"files") || ++ !strcmp(cmd_name,"search") || ++ !strcmp(cmd_name,"compare_versions") || ++ !strcmp(cmd_name,"compare-versions") || ++ !strcmp(cmd_name,"list_installed") || ++ !strcmp(cmd_name,"list-installed") || ++ !strcmp(cmd_name,"status") ) ++ args.noreadfeedsfile = 1; ++ + + err = ipkg_conf_init (&ipkg_conf, &args); + if (err) @@ -7056,9 +7147,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/libipkg.c busybox-1.00+ipkg-0.99.15 +} + +#endif /* IPKG_LIB */ -diff -ruN busybox-1.00-orig/archival/libipkg/libipkg.h busybox-1.00+ipkg-0.99.154/archival/libipkg/libipkg.h ---- busybox-1.00-orig/archival/libipkg/libipkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/libipkg.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/libipkg.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/libipkg.h +--- busybox-1.2.0-orig/archival/libipkg/libipkg.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/libipkg.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,87 @@ +/* ipkglib.h - the itsy package management system + @@ -7147,65 +7238,190 @@ diff -ruN busybox-1.00-orig/archival/libipkg/libipkg.h busybox-1.00+ipkg-0.99.15 + + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/md5.c busybox-1.00+ipkg-0.99.154/archival/libipkg/md5.c ---- busybox-1.00-orig/archival/libipkg/md5.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/md5.c 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,48 @@ -+/* md5.c - wrappers to busybox md5 functions -+ * -+ * Copyright (C) 1995-1999 Free Software Foundation, Inc. -+ * -+ * This program is free software; you can redistribute it and/or modify -+ * it under the terms of the GNU General Public License as published by -+ * the Free Software Foundation; either version 2, or (at your option) -+ * any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU General Public License for more details. -+ * -+ * You should have received a copy of the GNU General Public License -+ * along with this program; if not, write to the Free Software Foundation, -+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -+ */ -+ -+#include -+#include "libbb.h" +diff -ruN busybox-1.2.0-orig/archival/libipkg/Makefile busybox-1.2.0+ipkg-0.99.162/archival/libipkg/Makefile +--- busybox-1.2.0-orig/archival/libipkg/Makefile 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/Makefile 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,32 @@ ++# Makefile for busybox ++# ++# Copyright (C) 1999-2004 by Erik Andersen ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++# + -+#include "md5.h" ++top_srcdir=../.. ++top_builddir=../.. ++srcdir=$(top_srcdir)/archival/libipkg ++LIBIPKG_DIR:=./ ++include $(top_builddir)/Rules.mak ++include $(top_builddir)/.config ++include $(srcdir)/Makefile.in ++all: $(libraries-y) ++-include $(top_builddir)/.depend + -+int md5_stream(FILE *stream, void *resblock) -+{ -+ int fd; -+ int sum; -+ -+ if( (fd = fileno(stream)) == -1 ) { -+ bb_error_msg("bad file descriptor"); -+ return 1; -+ } ++clean: ++ rm -f *.o *.a $(AR_TARGET) + -+ hash_fd(fd, -1, HASH_MD5, (uint8_t *)resblock); +diff -ruN busybox-1.2.0-orig/archival/libipkg/Makefile.in busybox-1.2.0+ipkg-0.99.162/archival/libipkg/Makefile.in +--- busybox-1.2.0-orig/archival/libipkg/Makefile.in 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/Makefile.in 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,85 @@ ++# Makefile for busybox ++# ++# Copyright (C) 1999-2004 by Erik Andersen ++# ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 2 of the License, or ++# (at your option) any later version. ++# ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++# General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with this program; if not, write to the Free Software ++# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++# + -+ return 0; -+} ++LIBIPKG_AR:=libipkg.a ++ifndef $(LIBIPKG_DIR) ++LIBIPKG_DIR:=$(top_builddir)/archival/libipkg/ ++endif ++srcdir=$(top_srcdir)/archival/libipkg + -+void *md5_buffer(const char *buffer, size_t len, void *resblock) -+{ -+ struct md5_ctx_t md5_cx; ++LIBIPKG_CORE_SOURCES:= \ ++ args.c \ ++ libipkg.c \ ++ user.c \ + -+ md5_begin(&md5_cx); -+ md5_hash(buffer, len, &md5_cx); -+ return md5_end(resblock, &md5_cx); -+} ++LIBIPKG_CMD_SOURCES:= \ ++ ipkg_cmd.c \ ++ ipkg_configure.c \ ++ ipkg_download.c \ ++ ipkg_install.c \ ++ ipkg_remove.c \ ++ ipkg_upgrade.c \ + -diff -ruN busybox-1.00-orig/archival/libipkg/md5.h busybox-1.00+ipkg-0.99.154/archival/libipkg/md5.h ---- busybox-1.00-orig/archival/libipkg/md5.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/md5.h 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,35 @@ -+/* md5.h - Compute MD5 checksum of files or strings according to the -+ * definition of MD5 in RFC 1321 from April 1992. -+ * Copyright (C) 1995-1999 Free Software Foundation, Inc. ++LIBIPKG_DB_SOURCES:= \ ++ hash_table.c \ ++ ipkg_conf.c \ ++ ipkg_utils.c \ ++ pkg.c \ ++ pkg_depends.c \ ++ pkg_extract.c \ ++ pkg_hash.c \ ++ pkg_parse.c \ ++ pkg_vec.c \ ++ ++LIBIPKG_LIST_SOURCES:= \ ++ conffile.c \ ++ conffile_list.c \ ++ nv_pair.c \ ++ nv_pair_list.c \ ++ pkg_dest.c \ ++ pkg_dest_list.c \ ++ pkg_src.c \ ++ pkg_src_list.c \ ++ str_list.c \ ++ void_list.c \ ++ ++LIBIPKG_UTIL_SOURCES:= \ ++ file_util.c \ ++ ipkg_message.c \ ++ md5.c \ ++ str_util.c \ ++ xsystem.c \ ++ ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_CORE_SOURCES) ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_CMD_SOURCES) ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_DB_SOURCES) ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_LIST_SOURCES) ++LIBIPKG-$(CONFIG_IPKG) += $(LIBIPKG_UTIL_SOURCES) ++LIBIPKG_OBJS=$(patsubst %.c,$(LIBIPKG_DIR)%.o, $(LIBIPKG-y)) ++ ++CFLAGS += -DIPKG_LIB -DIPKGLIBDIR="\"/usr/lib\"" -DHOST_CPU_STR="\"$(TARGET_ARCH)\"" ++ ++libraries-$(CONFIG_IPKG) += $(LIBIPKG_DIR)$(LIBIPKG_AR) ++ ++$(LIBIPKG_DIR)$(LIBIPKG_AR): $(LIBIPKG_OBJS) ++ $(do_ar) ++ ++$(LIBIPKG_OBJS): $(LIBIPKG_DIR)%.o : $(srcdir)/%.c ++ $(compile.c) ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/md5.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/md5.c +--- busybox-1.2.0-orig/archival/libipkg/md5.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/md5.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,48 @@ ++/* md5.c - wrappers to busybox md5 functions ++ * ++ * Copyright (C) 1995-1999 Free Software Foundation, Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2, or (at your option) ++ * any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software Foundation, ++ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ++ */ ++ ++#include ++#include "libbb.h" ++ ++#include "md5.h" ++ ++int md5_stream(FILE *stream, void *resblock) ++{ ++ int fd; ++ int sum; ++ ++ if( (fd = fileno(stream)) == -1 ) { ++ bb_error_msg("bad file descriptor"); ++ return 1; ++ } ++ ++ hash_fd(fd, HASH_MD5, (uint8_t *)resblock); ++ ++ return 0; ++} ++ ++void *md5_buffer(const char *buffer, size_t len, void *resblock) ++{ ++ md5_ctx_t md5_cx; ++ ++ md5_begin(&md5_cx); ++ md5_hash(buffer, len, &md5_cx); ++ return md5_end(resblock, &md5_cx); ++} ++ +diff -ruN busybox-1.2.0-orig/archival/libipkg/md5.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/md5.h +--- busybox-1.2.0-orig/archival/libipkg/md5.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/md5.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,35 @@ ++/* md5.h - Compute MD5 checksum of files or strings according to the ++ * definition of MD5 in RFC 1321 from April 1992. ++ * Copyright (C) 1995-1999 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by @@ -7238,9 +7454,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/md5.h busybox-1.00+ipkg-0.99.154/ar + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/nv_pair.c busybox-1.00+ipkg-0.99.154/archival/libipkg/nv_pair.c ---- busybox-1.00-orig/archival/libipkg/nv_pair.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/nv_pair.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/nv_pair.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair.c +--- busybox-1.2.0-orig/archival/libipkg/nv_pair.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,40 @@ +/* nv_pair.c - the itsy package management system + @@ -7282,9 +7498,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/nv_pair.c busybox-1.00+ipkg-0.99.15 +} + + -diff -ruN busybox-1.00-orig/archival/libipkg/nv_pair.h busybox-1.00+ipkg-0.99.154/archival/libipkg/nv_pair.h ---- busybox-1.00-orig/archival/libipkg/nv_pair.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/nv_pair.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/nv_pair.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair.h +--- busybox-1.2.0-orig/archival/libipkg/nv_pair.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,32 @@ +/* nv_pair.h - the itsy package management system + @@ -7318,9 +7534,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/nv_pair.h busybox-1.00+ipkg-0.99.15 + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/nv_pair_list.c busybox-1.00+ipkg-0.99.154/archival/libipkg/nv_pair_list.c ---- busybox-1.00-orig/archival/libipkg/nv_pair_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/nv_pair_list.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/nv_pair_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair_list.c +--- busybox-1.2.0-orig/archival/libipkg/nv_pair_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair_list.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,98 @@ +/* nv_pair_list.c - the itsy package management system + @@ -7420,9 +7636,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/nv_pair_list.c busybox-1.00+ipkg-0. + } + return NULL; +} -diff -ruN busybox-1.00-orig/archival/libipkg/nv_pair_list.h busybox-1.00+ipkg-0.99.154/archival/libipkg/nv_pair_list.h ---- busybox-1.00-orig/archival/libipkg/nv_pair_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/nv_pair_list.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/nv_pair_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair_list.h +--- busybox-1.2.0-orig/archival/libipkg/nv_pair_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/nv_pair_list.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,60 @@ +/* nv_pair_list.h - the itsy package management system + @@ -7484,10 +7700,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/nv_pair_list.h busybox-1.00+ipkg-0. + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/pkg.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg.c ---- busybox-1.00-orig/archival/libipkg/pkg.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg.c 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,1753 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg.c +--- busybox-1.2.0-orig/archival/libipkg/pkg.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,1754 @@ +/* pkg.c - the itsy package management system + + Carl D. Worth @@ -7627,6 +7843,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg.c busybox-1.00+ipkg-0.99.154/ar + pkg->installed_files = NULL; + pkg->installed_files_ref_cnt = 0; + pkg->essential = 0; ++ pkg->provided_by_hand = 0; + + return 0; +} @@ -9241,15 +9458,15 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg.c busybox-1.00+ipkg-0.99.154/ar + } + return 0; +} -diff -ruN busybox-1.00-orig/archival/libipkg/pkg.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg.h ---- busybox-1.00-orig/archival/libipkg/pkg.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg.h 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,230 @@ -+/* pkg.h - the itsy package management system -+ -+ Carl D. Worth +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_depends.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_depends.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_depends.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_depends.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,1033 @@ ++/* pkg_depends.c - the itsy package management system + -+ Copyright (C) 2001 University of Southern California ++ Steven M. Ayer ++ ++ Copyright (C) 2002 Compaq Computer Corporation + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as @@ -9262,329 +9479,95 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg.h busybox-1.00+ipkg-0.99.154/ar + General Public License for more details. +*/ + -+#ifndef PKG_H -+#define PKG_H -+ -+#include -+#include -+#include -+ -+#include "pkg_vec.h" -+#include "str_list.h" -+#include "pkg_src.h" -+#include "pkg_dest.h" -+#include "ipkg_conf.h" -+#include "conffile_list.h" -+ -+struct ipkg_conf; -+ -+ -+#define ARRAY_SIZE(array) sizeof(array) / sizeof((array)[0]) -+ -+/* I think "Size" is currently the shortest field name */ -+#define PKG_MINIMUM_FIELD_NAME_LEN 4 ++#include "ipkg.h" ++#include ++#include ++ ++#include "pkg.h" ++#include "ipkg_utils.h" ++#include "pkg_hash.h" ++#include "ipkg_message.h" ++#include "pkg_parse.h" ++#include "hash_table.h" + -+enum pkg_state_want -+{ -+ SW_UNKNOWN = 1, -+ SW_INSTALL, -+ SW_DEINSTALL, -+ SW_PURGE, -+ SW_LAST_STATE_WANT -+}; -+typedef enum pkg_state_want pkg_state_want_t; ++static int parseDepends(compound_depend_t *compound_depend, hash_table_t * hash, char * depend_str); ++static depend_t * depend_init(void); ++static void depend_deinit(depend_t *d); ++static char ** add_unresolved_dep(pkg_t * pkg, char ** the_lost, int ref_ndx); ++static char ** merge_unresolved(char ** oldstuff, char ** newstuff); ++static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); + -+enum pkg_state_flag ++static int pkg_installed_and_constraint_satisfied(pkg_t *pkg, void *cdata) +{ -+ SF_OK = 0, -+ SF_REINSTREQ = 1, -+ SF_HOLD = 2, /* do not upgrade version */ -+ SF_REPLACE = 4, /* replace this package */ -+ SF_NOPRUNE = 8, /* do not remove obsolete files */ -+ SF_PREFER = 16, /* prefer this version */ -+ SF_OBSOLETE = 32, /* old package in upgrade pair */ -+ SF_MARKED = 64, /* temporary mark */ -+ SF_FILELIST_CHANGED = 128, /* needs filelist written */ -+ SF_USER = 256, -+ SF_LAST_STATE_FLAG -+}; -+typedef enum pkg_state_flag pkg_state_flag_t; -+#define SF_NONVOLATILE_FLAGS (SF_HOLD|SF_NOPRUNE|SF_PREFER|SF_OBSOLETE|SF_USER) ++ depend_t *depend = (depend_t *)cdata; ++ if ((pkg->state_status == SS_INSTALLED || pkg->state_status == SS_UNPACKED) && version_constraints_satisfied(depend, pkg)) ++ return 1; ++ else ++ return 0; ++} + -+enum pkg_state_status ++static int pkg_constraint_satisfied(pkg_t *pkg, void *cdata) +{ -+ SS_NOT_INSTALLED = 1, -+ SS_UNPACKED, -+ SS_HALF_CONFIGURED, -+ SS_INSTALLED, -+ SS_HALF_INSTALLED, -+ SS_CONFIG_FILES, -+ SS_POST_INST_FAILED, -+ SS_REMOVAL_FAILED, -+ SS_LAST_STATE_STATUS -+}; -+typedef enum pkg_state_status pkg_state_status_t; -+ -+struct abstract_pkg{ -+ char * name; -+ int dependencies_checked; -+ pkg_vec_t * pkgs; -+ pkg_state_status_t state_status; -+ pkg_state_flag_t state_flag; -+ struct abstract_pkg ** depended_upon_by; /* @@@@ this should be abstract_pkg_vec_t -Jamey */ -+ abstract_pkg_vec_t * provided_by; -+ abstract_pkg_vec_t * replaced_by; -+}; ++ depend_t *depend = (depend_t *)cdata; ++#if 0 ++ pkg_t * temp = pkg_new(); ++ int comparison; ++ parseVersion(temp, depend->version); ++ comparison = pkg_compare_versions(pkg, temp); ++ free(temp); + -+#include "pkg_depends.h" ++ fprintf(stderr, "%s: pkg=%s pkg->version=%s constraint=%p type=%d version=%s comparison=%d satisfied=%d\n", ++ __FUNCTION__, pkg->name, pkg->version, ++ depend, depend->constraint, depend->version, ++ comparison, version_constraints_satisfied(depend, pkg)); ++#endif ++ if (version_constraints_satisfied(depend, pkg)) ++ return 1; ++ else ++ return 0; ++} + -+/* XXX: CLEANUP: I'd like to clean up pkg_t in several ways: ++/* returns ndependences or negative error value */ ++int pkg_hash_fetch_unsatisfied_dependencies(ipkg_conf_t *conf, pkg_t * pkg, ++ pkg_vec_t *unsatisfied, char *** unresolved) ++{ ++ pkg_t * satisfier_entry_pkg; ++ register int i, j, k; ++ int count, found; ++ char ** the_lost; ++ abstract_pkg_t * ab_pkg; + -+ The 3 version fields should go into a single version struct. (This -+ is especially important since, currently, pkg->version can easily -+ be mistaken for pkg_verson_str_alloc(pkg) although they are very -+ distinct. This has been the source of multiple bugs. ++ /* ++ * this is a setup to check for redundant/cyclic dependency checks, ++ * which are marked at the abstract_pkg level ++ */ ++ if (!(ab_pkg = pkg->parent)) { ++ fprintf(stderr, "%s:%d: something terribly wrong with pkg %s\n", __FUNCTION__, __LINE__, pkg->name); ++ *unresolved = NULL; ++ return 0; ++ } ++ if (ab_pkg->dependencies_checked) { /* avoid duplicate or cyclic checks */ ++ *unresolved = NULL; ++ return 0; ++ } else { ++ ab_pkg->dependencies_checked = 1; /* mark it for subsequent visits */ ++ } ++ /**/ + -+ The 3 state fields could possibly also go into their own struct. ++ count = pkg->pre_depends_count + pkg->depends_count + pkg->recommends_count + pkg->suggests_count; ++ if (!count){ ++ *unresolved = NULL; ++ return 0; ++ } + -+ All fields which deal with lists of packages, (Depends, -+ Pre-Depends, Provides, Suggests, Recommends, Enhances), should each -+ be handled by a single struct in pkg_t -+ -+ All string fields for which there is a small set of possible -+ values, (section, maintainer, architecture, maybe version?), that -+ are reused among different packages -- for all such packages we -+ should move from "char *"s to some atom datatype to share data -+ storage and use less memory. We might even do reference counting, -+ but probably not since most often we only create new pkg_t structs, -+ we don't often free them. */ -+struct pkg -+{ -+ char *name; -+ unsigned long epoch; -+ char *version; -+ char *revision; -+ char *familiar_revision; -+ pkg_src_t *src; -+ pkg_dest_t *dest; -+ char *architecture; -+ char *section; -+ char *maintainer; -+ char *description; -+ pkg_state_want_t state_want; -+ pkg_state_flag_t state_flag; -+ pkg_state_status_t state_status; -+ char **depends_str; -+ int depends_count; -+ char **pre_depends_str; -+ int pre_depends_count; -+ char **recommends_str; -+ int recommends_count; -+ char **suggests_str; -+ int suggests_count; -+ compound_depend_t * depends; -+ -+ /* Abhaya: new conflicts */ -+ char **conflicts_str; -+ compound_depend_t * conflicts; -+ int conflicts_count; -+ -+ char **replaces_str; -+ int replaces_count; -+ abstract_pkg_t ** replaces; -+ -+ char **provides_str; -+ int provides_count; -+ abstract_pkg_t ** provides; -+ -+ abstract_pkg_t *parent; -+ -+ pkg_t *old_pkg; /* during upgrade, points from installee to previously installed */ -+ -+ char *filename; -+ char *local_filename; -+ char *url; -+ char *tmp_unpack_dir; -+ char *md5sum; -+ char *size; -+ char *installed_size; -+ char *priority; -+ char *source; -+ conffile_list_t conffiles; -+ time_t installed_time; -+ /* As pointer for lazy evaluation */ -+ str_list_t *installed_files; -+ /* XXX: CLEANUP: I'd like to perhaps come up with a better -+ mechanism to avoid the problem here, (which is that the -+ installed_files list was being freed from an inner loop while -+ still being used within an outer loop. */ -+ int installed_files_ref_cnt; -+ int essential; -+ int arch_priority; -+}; -+ -+pkg_t *pkg_new(void); -+int pkg_init(pkg_t *pkg); -+void pkg_deinit(pkg_t *pkg); -+int pkg_init_from_file(pkg_t *pkg, const char *filename); -+abstract_pkg_t *abstract_pkg_new(void); -+int abstract_pkg_init(abstract_pkg_t *ab_pkg); -+ -+/* -+ * merges fields from newpkg into oldpkg. -+ * Forcibly sets oldpkg state_status, state_want and state_flags if set_status is nonzero -+ */ -+int pkg_merge(pkg_t *oldpkg, pkg_t *newpkg, int set_status); -+ -+char *pkg_version_str_alloc(pkg_t *pkg); -+ -+int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg); -+int pkg_name_version_and_architecture_compare(void *a, void *b); -+int abstract_pkg_name_compare(void *a, void *b); -+ -+char * pkg_formatted_info(pkg_t *pkg ); -+char * pkg_formatted_field(pkg_t *pkg, const char *field ); -+ -+void set_flags_from_control(ipkg_conf_t *conf, pkg_t *pkg); -+ -+void pkg_print_info(pkg_t *pkg, FILE *file); -+void pkg_print_status(pkg_t * pkg, FILE * file); -+void pkg_print_field(pkg_t *pkg, FILE *file, const char *field); -+str_list_t *pkg_get_installed_files(pkg_t *pkg); -+int pkg_free_installed_files(pkg_t *pkg); -+int pkg_remove_installed_files_list(ipkg_conf_t *conf, pkg_t *pkg); -+conffile_t *pkg_get_conffile(pkg_t *pkg, const char *file_name); -+int pkg_run_script(struct ipkg_conf *conf, pkg_t *pkg, -+ const char *script, const char *args); -+ -+/* enum mappings */ -+char *pkg_state_want_to_str(pkg_state_want_t sw); -+pkg_state_want_t pkg_state_want_from_str(char *str); -+char *pkg_state_flag_to_str(pkg_state_flag_t sf); -+pkg_state_flag_t pkg_state_flag_from_str(char *str); -+char *pkg_state_status_to_str(pkg_state_status_t ss); -+pkg_state_status_t pkg_state_status_from_str(char *str); -+ -+int pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op); -+ -+int pkg_arch_supported(ipkg_conf_t *conf, pkg_t *pkg); -+int pkg_info_preinstall_check(ipkg_conf_t *conf); -+int pkg_free_installed_files(pkg_t *pkg); -+ -+int pkg_write_filelist(ipkg_conf_t *conf, pkg_t *pkg); -+int pkg_write_changed_filelists(ipkg_conf_t *conf); -+ -+#endif -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_depends.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_depends.c ---- busybox-1.00-orig/archival/libipkg/pkg_depends.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_depends.c 2005-10-26 17:45:58.000000000 +0200 -@@ -0,0 +1,1029 @@ -+/* pkg_depends.c - the itsy package management system -+ -+ Steven M. Ayer -+ -+ Copyright (C) 2002 Compaq Computer Corporation -+ -+ This program is free software; you can redistribute it and/or -+ modify it under the terms of the GNU General Public License as -+ published by the Free Software Foundation; either version 2, or (at -+ your option) any later version. -+ -+ This program is distributed in the hope that it will be useful, but -+ WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ General Public License for more details. -+*/ -+ -+#include "ipkg.h" -+#include -+#include -+ -+#include "pkg.h" -+#include "ipkg_utils.h" -+#include "pkg_hash.h" -+#include "ipkg_message.h" -+#include "pkg_parse.h" -+#include "hash_table.h" -+ -+static int parseDepends(compound_depend_t *compound_depend, hash_table_t * hash, char * depend_str); -+static depend_t * depend_init(void); -+static void depend_deinit(depend_t *d); -+static char ** add_unresolved_dep(pkg_t * pkg, char ** the_lost, int ref_ndx); -+static char ** merge_unresolved(char ** oldstuff, char ** newstuff); -+static int is_pkg_in_pkg_vec(pkg_vec_t * vec, pkg_t * pkg); -+ -+static int pkg_installed_and_constraint_satisfied(pkg_t *pkg, void *cdata) -+{ -+ depend_t *depend = (depend_t *)cdata; -+ if ((pkg->state_status == SS_INSTALLED || pkg->state_status == SS_UNPACKED) && version_constraints_satisfied(depend, pkg)) -+ return 1; -+ else -+ return 0; -+} -+ -+static int pkg_constraint_satisfied(pkg_t *pkg, void *cdata) -+{ -+ depend_t *depend = (depend_t *)cdata; -+#if 0 -+ pkg_t * temp = pkg_new(); -+ int comparison; -+ parseVersion(temp, depend->version); -+ comparison = pkg_compare_versions(pkg, temp); -+ free(temp); -+ -+ fprintf(stderr, "%s: pkg=%s pkg->version=%s constraint=%p type=%d version=%s comparison=%d satisfied=%d\n", -+ __FUNCTION__, pkg->name, pkg->version, -+ depend, depend->constraint, depend->version, -+ comparison, version_constraints_satisfied(depend, pkg)); -+#endif -+ if (version_constraints_satisfied(depend, pkg)) -+ return 1; -+ else -+ return 0; -+} -+ -+/* returns ndependences or negative error value */ -+int pkg_hash_fetch_unsatisfied_dependencies(ipkg_conf_t *conf, pkg_t * pkg, -+ pkg_vec_t *unsatisfied, char *** unresolved) -+{ -+ pkg_t * satisfier_entry_pkg; -+ register int i, j, k; -+ int count, found; -+ char ** the_lost; -+ abstract_pkg_t * ab_pkg; -+ -+ /* -+ * this is a setup to check for redundant/cyclic dependency checks, -+ * which are marked at the abstract_pkg level -+ */ -+ if (!(ab_pkg = pkg->parent)) { -+ fprintf(stderr, "%s:%d: something terribly wrong with pkg %s\n", __FUNCTION__, __LINE__, pkg->name); -+ *unresolved = NULL; -+ return 0; -+ } -+ if (ab_pkg->dependencies_checked) { /* avoid duplicate or cyclic checks */ -+ *unresolved = NULL; -+ return 0; -+ } else { -+ ab_pkg->dependencies_checked = 1; /* mark it for subsequent visits */ -+ } -+ /**/ -+ -+ count = pkg->pre_depends_count + pkg->depends_count + pkg->recommends_count + pkg->suggests_count; -+ if (!count){ -+ *unresolved = NULL; -+ return 0; -+ } -+ -+ the_lost = NULL; -+ -+ /* foreach dependency */ -+ for (i = 0; i < count; i++) { -+ compound_depend_t * compound_depend = &pkg->depends[i]; -+ depend_t ** possible_satisfiers = compound_depend->possibilities;; -+ found = 0; -+ satisfier_entry_pkg = NULL; ++ the_lost = NULL; ++ ++ /* foreach dependency */ ++ for (i = 0; i < count; i++) { ++ compound_depend_t * compound_depend = &pkg->depends[i]; ++ depend_t ** possible_satisfiers = compound_depend->possibilities;; ++ found = 0; ++ satisfier_entry_pkg = NULL; + + if (compound_depend->type == GREEDY_DEPEND) { + /* foreach possible satisfier */ @@ -9756,8 +9739,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_depends.c busybox-1.00+ipkg-0.9 + replaces = pkg->replaces; + + for (i = 0; i < replaces_count; i++) { -+ if (strcmp(pkg_scout->name,pkg->replaces[i]->name)==0) // Found ++ if (strcmp(pkg_scout->name,pkg->replaces[i]->name)==0) { // Found ++ ipkg_message(NULL, IPKG_DEBUG2, "Seems I've found a replace %s %s \n",pkg_scout->name,pkg->replaces[i]->name); + return 1; ++ } + } + return 0; + @@ -9987,13 +9972,15 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_depends.c busybox-1.00+ipkg-0.9 +{ + abstract_pkg_t **replaces = pkg->replaces; + int replaces_count = pkg->replaces_count; -+ abstract_pkg_t **replacee_provides = pkg->provides; -+ int replacee_provides_count = pkg->provides_count; ++ /* abstract_pkg_t **replacee_provides = pkg->provides; ++ int replacee_provides_count = pkg->provides_count; */ + int i, j; + for (i = 0; i < replaces_count; i++) { + abstract_pkg_t *abstract_replacee = replaces[i]; -+ for (j = 0; j < replacee_provides_count; j++) { -+ if (replacee_provides[j] == abstract_replacee) ++ for (j = 0; j < replaces_count; j++) { ++ /* ipkg_message(NULL, IPKG_DEBUG2, "Searching pkg-name %s repprovname %s absrepname %s \n", ++ pkg->name,replacee->provides[j]->name, abstract_replacee->name); */ ++ if (replacee->provides[j] == abstract_replacee) + return 1; + } + } @@ -10508,9 +10495,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_depends.c busybox-1.00+ipkg-0.9 + + return 0; +} -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_depends.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_depends.h ---- busybox-1.00-orig/archival/libipkg/pkg_depends.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_depends.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_depends.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_depends.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_depends.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_depends.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,105 @@ +/* pkg_depends.h - the itsy package management system + @@ -10617,9 +10604,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_depends.h busybox-1.00+ipkg-0.9 +int pkg_dependence_satisfied(ipkg_conf_t *conf, depend_t *depend); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_dest.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_dest.c ---- busybox-1.00-orig/archival/libipkg/pkg_dest.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_dest.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_dest.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_dest.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,92 @@ +/* pkg_dest.c - the itsy package management system + @@ -10713,9 +10700,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_dest.c busybox-1.00+ipkg-0.99.1 + + dest->root_dir = NULL; +} -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_dest.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_dest.h ---- busybox-1.00-orig/archival/libipkg/pkg_dest.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_dest.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_dest.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_dest.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,38 @@ +/* pkg_dest.h - the itsy package management system + @@ -10755,9 +10742,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_dest.h busybox-1.00+ipkg-0.99.1 + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_dest_list.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_dest_list.c ---- busybox-1.00-orig/archival/libipkg/pkg_dest_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_dest_list.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_dest_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest_list.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_dest_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest_list.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,85 @@ +/* pkg_dest_list.c - the itsy package management system + @@ -10844,9 +10831,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_dest_list.c busybox-1.00+ipkg-0 +{ + return (pkg_dest_list_elt_t *) void_list_pop((void_list_t *) list); +} -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_dest_list.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_dest_list.h ---- busybox-1.00-orig/archival/libipkg/pkg_dest_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_dest_list.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_dest_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest_list.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_dest_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_dest_list.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,50 @@ +/* pkg_dest_list.h - the itsy package management system + @@ -10898,9 +10885,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_dest_list.h busybox-1.00+ipkg-0 + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_extract.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_extract.c ---- busybox-1.00-orig/archival/libipkg/pkg_extract.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_extract.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_extract.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_extract.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_extract.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_extract.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,224 @@ +/* pkg_extract.c - the itsy package management system + @@ -10944,7 +10931,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_extract.c busybox-1.00+ipkg-0.9 + archive = init_handle(); + archive->src_fd = bb_xopen(pkg->local_filename, O_RDONLY); + archive->filter = filter_accept_list; -+ archive->accept = llist_add_to(NULL, (char *)filename); ++ llist_add_to(&(archive->accept), (char *)filename); + archive->buffer = path; + archive->action_data = data_extract_all_prefix; + archive->flags |= ARCHIVE_EXTRACT_UNCONDITIONAL; @@ -10981,7 +10968,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_extract.c busybox-1.00+ipkg-0.9 + archive = init_handle(); + archive->src_fd = bb_xopen(name, O_RDONLY); + archive->filter = filter_accept_list; -+ archive->accept = llist_add_to(NULL, "./" IPKG_CONTROL_FILE); ++ llist_add_to(&(archive->accept), "./" IPKG_CONTROL_FILE); + archive->action_data = data_extract_to_buffer; + while( get_header_tar_gz(archive) == EXIT_SUCCESS ); + close(archive->src_fd); @@ -11044,128 +11031,364 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_extract.c busybox-1.00+ipkg-0.9 + free(path); + free(name); + -+ return 0; -+} ++ return 0; ++} ++ ++int pkg_extract_data_file_names_to_file(pkg_t *pkg, const char *file_name) ++{ ++ int err=0; ++ char *line, *data_file; ++ FILE *file; ++ FILE *tmp; ++ ++ file = fopen(file_name, "w"); ++ if (file == NULL) { ++ fprintf(stderr, "%s: ERROR: Failed to open %s for writing.\n", ++ __FUNCTION__, file_name); ++ return EINVAL; ++ } ++ ++ tmp = tmpfile(); ++ if (pkg->installed_files) { ++ str_list_elt_t *elt; ++ for (elt = pkg->installed_files->head; elt; elt = elt->next) { ++ fprintf(file, "%s\n", elt->data); ++ } ++ } else { ++ err = pkg_extract_data_file_names_to_stream(pkg, tmp); ++ if (err) { ++ fclose(file); ++ fclose(tmp); ++ return err; ++ } ++ ++ /* Fixup data file names by removing the initial '.' */ ++ rewind(tmp); ++ while (1) { ++ line = file_read_line_alloc(tmp); ++ if (line == NULL) { ++ break; ++ } ++ ++ data_file = line; ++ if (*data_file == '.') { ++ data_file++; ++ } ++ ++ if (*data_file != '/') { ++ fputs("/", file); ++ } ++ ++ /* I have no idea why, but this is what dpkg does */ ++ if (strcmp(data_file, "/\n") == 0) { ++ fputs("/.\n", file); ++ } else { ++ fputs(data_file, file); ++ } ++ } ++ } ++ fclose(tmp); ++ fclose(file); ++ ++ return err; ++} ++ ++int pkg_extract_data_file_names_to_stream(pkg_t *pkg, FILE *file) ++{ ++ archive_handle_t *archive; ++ char *name; ++ ++ extract_ipkg_file_to_dir(pkg, global_conf->tmp_dir, "./" IPKG_DATA_ARCHIVE); ++ sprintf_alloc(&name, "%s/%s", global_conf->tmp_dir, IPKG_DATA_ARCHIVE); ++ archive = init_handle(); ++ archive->src_fd = bb_xopen(name, O_RDONLY); ++ archive->filter = filter_accept_all; ++ archive->action_data = data_extract_file_name_to_buffer; ++ while( get_header_tar_gz(archive) == EXIT_SUCCESS ); ++ close(archive->src_fd); ++ fputs(archive->buffer, file); ++ free(archive->buffer); ++ free(archive); ++ free(name); ++ ++ return 0; ++} +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_extract.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_extract.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_extract.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_extract.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,32 @@ ++/* pkg_extract.c - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ This program is free software; you can redistribute it and/or ++ modify it under the terms of the GNU General Public License as ++ published by the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_EXTRACT_H ++#define PKG_EXTRACT_H ++ ++#include "pkg.h" ++ ++int pkg_extract_control_file_to_stream(pkg_t *pkg, FILE *stream); ++int pkg_extract_control_files_to_dir(pkg_t *pkg, const char *dir); ++int pkg_extract_control_files_to_dir_with_prefix(pkg_t *pkg, ++ const char *dir, ++ const char *prefix); ++int pkg_extract_data_files_to_dir(pkg_t *pkg, const char *dir); ++int pkg_extract_data_file_names_to_file(pkg_t *pkg, const char *file_name); ++int pkg_extract_data_file_names_to_stream(pkg_t *pkg, FILE *file); ++ ++#endif +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg.h +--- busybox-1.2.0-orig/archival/libipkg/pkg.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg.h 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,232 @@ ++/* pkg.h - the itsy package management system ++ ++ Carl D. Worth ++ ++ Copyright (C) 2001 University of Southern California ++ ++ This program is free software; you can redistribute it and/or ++ modify it under the terms of the GNU General Public License as ++ published by the Free Software Foundation; either version 2, or (at ++ your option) any later version. ++ ++ This program is distributed in the hope that it will be useful, but ++ WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ General Public License for more details. ++*/ ++ ++#ifndef PKG_H ++#define PKG_H ++ ++#include ++#include ++#include ++ ++#include "pkg_vec.h" ++#include "str_list.h" ++#include "pkg_src.h" ++#include "pkg_dest.h" ++#include "ipkg_conf.h" ++#include "conffile_list.h" ++ ++struct ipkg_conf; ++ ++ ++#define ARRAY_SIZE(array) sizeof(array) / sizeof((array)[0]) ++ ++/* I think "Size" is currently the shortest field name */ ++#define PKG_MINIMUM_FIELD_NAME_LEN 4 ++ ++enum pkg_state_want ++{ ++ SW_UNKNOWN = 1, ++ SW_INSTALL, ++ SW_DEINSTALL, ++ SW_PURGE, ++ SW_LAST_STATE_WANT ++}; ++typedef enum pkg_state_want pkg_state_want_t; ++ ++enum pkg_state_flag ++{ ++ SF_OK = 0, ++ SF_REINSTREQ = 1, ++ SF_HOLD = 2, /* do not upgrade version */ ++ SF_REPLACE = 4, /* replace this package */ ++ SF_NOPRUNE = 8, /* do not remove obsolete files */ ++ SF_PREFER = 16, /* prefer this version */ ++ SF_OBSOLETE = 32, /* old package in upgrade pair */ ++ SF_MARKED = 64, /* temporary mark */ ++ SF_FILELIST_CHANGED = 128, /* needs filelist written */ ++ SF_USER = 256, ++ SF_LAST_STATE_FLAG ++}; ++typedef enum pkg_state_flag pkg_state_flag_t; ++#define SF_NONVOLATILE_FLAGS (SF_HOLD|SF_NOPRUNE|SF_PREFER|SF_OBSOLETE|SF_USER) ++ ++enum pkg_state_status ++{ ++ SS_NOT_INSTALLED = 1, ++ SS_UNPACKED, ++ SS_HALF_CONFIGURED, ++ SS_INSTALLED, ++ SS_HALF_INSTALLED, ++ SS_CONFIG_FILES, ++ SS_POST_INST_FAILED, ++ SS_REMOVAL_FAILED, ++ SS_LAST_STATE_STATUS ++}; ++typedef enum pkg_state_status pkg_state_status_t; ++ ++struct abstract_pkg{ ++ char * name; ++ int dependencies_checked; ++ pkg_vec_t * pkgs; ++ pkg_state_status_t state_status; ++ pkg_state_flag_t state_flag; ++ struct abstract_pkg ** depended_upon_by; /* @@@@ this should be abstract_pkg_vec_t -Jamey */ ++ abstract_pkg_vec_t * provided_by; ++ abstract_pkg_vec_t * replaced_by; ++}; ++ ++#include "pkg_depends.h" ++ ++/* XXX: CLEANUP: I'd like to clean up pkg_t in several ways: ++ ++ The 3 version fields should go into a single version struct. (This ++ is especially important since, currently, pkg->version can easily ++ be mistaken for pkg_verson_str_alloc(pkg) although they are very ++ distinct. This has been the source of multiple bugs. ++ ++ The 3 state fields could possibly also go into their own struct. + -+int pkg_extract_data_file_names_to_file(pkg_t *pkg, const char *file_name) ++ All fields which deal with lists of packages, (Depends, ++ Pre-Depends, Provides, Suggests, Recommends, Enhances), should each ++ be handled by a single struct in pkg_t ++ ++ All string fields for which there is a small set of possible ++ values, (section, maintainer, architecture, maybe version?), that ++ are reused among different packages -- for all such packages we ++ should move from "char *"s to some atom datatype to share data ++ storage and use less memory. We might even do reference counting, ++ but probably not since most often we only create new pkg_t structs, ++ we don't often free them. */ ++struct pkg +{ -+ int err=0; -+ char *line, *data_file; -+ FILE *file; -+ FILE *tmp; ++ char *name; ++ unsigned long epoch; ++ char *version; ++ char *revision; ++ char *familiar_revision; ++ pkg_src_t *src; ++ pkg_dest_t *dest; ++ char *architecture; ++ char *section; ++ char *maintainer; ++ char *description; ++ pkg_state_want_t state_want; ++ pkg_state_flag_t state_flag; ++ pkg_state_status_t state_status; ++ char **depends_str; ++ int depends_count; ++ char **pre_depends_str; ++ int pre_depends_count; ++ char **recommends_str; ++ int recommends_count; ++ char **suggests_str; ++ int suggests_count; ++ compound_depend_t * depends; + -+ file = fopen(file_name, "w"); -+ if (file == NULL) { -+ fprintf(stderr, "%s: ERROR: Failed to open %s for writing.\n", -+ __FUNCTION__, file_name); -+ return EINVAL; -+ } ++ /* Abhaya: new conflicts */ ++ char **conflicts_str; ++ compound_depend_t * conflicts; ++ int conflicts_count; ++ ++ char **replaces_str; ++ int replaces_count; ++ abstract_pkg_t ** replaces; + -+ tmp = tmpfile(); -+ if (pkg->installed_files) { -+ str_list_elt_t *elt; -+ for (elt = pkg->installed_files->head; elt; elt = elt->next) { -+ fprintf(file, "%s\n", elt->data); -+ } -+ } else { -+ err = pkg_extract_data_file_names_to_stream(pkg, tmp); -+ if (err) { -+ fclose(file); -+ fclose(tmp); -+ return err; -+ } ++ char **provides_str; ++ int provides_count; ++ abstract_pkg_t ** provides; + -+ /* Fixup data file names by removing the initial '.' */ -+ rewind(tmp); -+ while (1) { -+ line = file_read_line_alloc(tmp); -+ if (line == NULL) { -+ break; -+ } ++ abstract_pkg_t *parent; + -+ data_file = line; -+ if (*data_file == '.') { -+ data_file++; -+ } ++ pkg_t *old_pkg; /* during upgrade, points from installee to previously installed */ + -+ if (*data_file != '/') { -+ fputs("/", file); -+ } ++ char *filename; ++ char *local_filename; ++ char *url; ++ char *tmp_unpack_dir; ++ char *md5sum; ++ char *size; ++ char *installed_size; ++ char *priority; ++ char *source; ++ conffile_list_t conffiles; ++ time_t installed_time; ++ /* As pointer for lazy evaluation */ ++ str_list_t *installed_files; ++ /* XXX: CLEANUP: I'd like to perhaps come up with a better ++ mechanism to avoid the problem here, (which is that the ++ installed_files list was being freed from an inner loop while ++ still being used within an outer loop. */ ++ int installed_files_ref_cnt; ++ int essential; ++ int arch_priority; ++/* Adding this flag, to "force" ipkg to choose a "provided_by_hand" package, if there are multiple choice */ ++ int provided_by_hand; ++}; + -+ /* I have no idea why, but this is what dpkg does */ -+ if (strcmp(data_file, "/\n") == 0) { -+ fputs("/.\n", file); -+ } else { -+ fputs(data_file, file); -+ } -+ } -+ } -+ fclose(tmp); -+ fclose(file); ++pkg_t *pkg_new(void); ++int pkg_init(pkg_t *pkg); ++void pkg_deinit(pkg_t *pkg); ++int pkg_init_from_file(pkg_t *pkg, const char *filename); ++abstract_pkg_t *abstract_pkg_new(void); ++int abstract_pkg_init(abstract_pkg_t *ab_pkg); + -+ return err; -+} ++/* ++ * merges fields from newpkg into oldpkg. ++ * Forcibly sets oldpkg state_status, state_want and state_flags if set_status is nonzero ++ */ ++int pkg_merge(pkg_t *oldpkg, pkg_t *newpkg, int set_status); + -+int pkg_extract_data_file_names_to_stream(pkg_t *pkg, FILE *file) -+{ -+ archive_handle_t *archive; -+ char *name; -+ -+ extract_ipkg_file_to_dir(pkg, global_conf->tmp_dir, "./" IPKG_DATA_ARCHIVE); -+ sprintf_alloc(&name, "%s/%s", global_conf->tmp_dir, IPKG_DATA_ARCHIVE); -+ archive = init_handle(); -+ archive->src_fd = bb_xopen(name, O_RDONLY); -+ archive->filter = filter_accept_all; -+ archive->action_data = data_extract_file_name_to_buffer; -+ while( get_header_tar_gz(archive) == EXIT_SUCCESS ); -+ close(archive->src_fd); -+ fputs(archive->buffer, file); -+ free(archive->buffer); -+ free(archive); -+ free(name); -+ -+ return 0; -+} -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_extract.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_extract.h ---- busybox-1.00-orig/archival/libipkg/pkg_extract.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_extract.h 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,32 @@ -+/* pkg_extract.c - the itsy package management system ++char *pkg_version_str_alloc(pkg_t *pkg); + -+ Carl D. Worth ++int pkg_compare_versions(const pkg_t *pkg, const pkg_t *ref_pkg); ++int pkg_name_version_and_architecture_compare(void *a, void *b); ++int abstract_pkg_name_compare(void *a, void *b); + -+ Copyright (C) 2001 University of Southern California ++char * pkg_formatted_info(pkg_t *pkg ); ++char * pkg_formatted_field(pkg_t *pkg, const char *field ); + -+ This program is free software; you can redistribute it and/or -+ modify it under the terms of the GNU General Public License as -+ published by the Free Software Foundation; either version 2, or (at -+ your option) any later version. ++void set_flags_from_control(ipkg_conf_t *conf, pkg_t *pkg); + -+ This program is distributed in the hope that it will be useful, but -+ WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ General Public License for more details. -+*/ ++void pkg_print_info(pkg_t *pkg, FILE *file); ++void pkg_print_status(pkg_t * pkg, FILE * file); ++void pkg_print_field(pkg_t *pkg, FILE *file, const char *field); ++str_list_t *pkg_get_installed_files(pkg_t *pkg); ++int pkg_free_installed_files(pkg_t *pkg); ++int pkg_remove_installed_files_list(ipkg_conf_t *conf, pkg_t *pkg); ++conffile_t *pkg_get_conffile(pkg_t *pkg, const char *file_name); ++int pkg_run_script(struct ipkg_conf *conf, pkg_t *pkg, ++ const char *script, const char *args); + -+#ifndef PKG_EXTRACT_H -+#define PKG_EXTRACT_H ++/* enum mappings */ ++char *pkg_state_want_to_str(pkg_state_want_t sw); ++pkg_state_want_t pkg_state_want_from_str(char *str); ++char *pkg_state_flag_to_str(pkg_state_flag_t sf); ++pkg_state_flag_t pkg_state_flag_from_str(char *str); ++char *pkg_state_status_to_str(pkg_state_status_t ss); ++pkg_state_status_t pkg_state_status_from_str(char *str); + -+#include "pkg.h" ++int pkg_version_satisfied(pkg_t *it, pkg_t *ref, const char *op); + -+int pkg_extract_control_file_to_stream(pkg_t *pkg, FILE *stream); -+int pkg_extract_control_files_to_dir(pkg_t *pkg, const char *dir); -+int pkg_extract_control_files_to_dir_with_prefix(pkg_t *pkg, -+ const char *dir, -+ const char *prefix); -+int pkg_extract_data_files_to_dir(pkg_t *pkg, const char *dir); -+int pkg_extract_data_file_names_to_file(pkg_t *pkg, const char *file_name); -+int pkg_extract_data_file_names_to_stream(pkg_t *pkg, FILE *file); ++int pkg_arch_supported(ipkg_conf_t *conf, pkg_t *pkg); ++int pkg_info_preinstall_check(ipkg_conf_t *conf); ++int pkg_free_installed_files(pkg_t *pkg); ++ ++int pkg_write_filelist(ipkg_conf_t *conf, pkg_t *pkg); ++int pkg_write_changed_filelists(ipkg_conf_t *conf); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_hash.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_hash.c ---- busybox-1.00-orig/archival/libipkg/pkg_hash.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_hash.c 2005-10-26 17:45:58.000000000 +0200 -@@ -0,0 +1,608 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_hash.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_hash.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_hash.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_hash.c 2006-07-22 16:31:25.000000000 +0200 +@@ -0,0 +1,617 @@ +/* ipkg_hash.c - the itsy package management system + + Steven M. Ayer @@ -11382,8 +11605,8 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_hash.c busybox-1.00+ipkg-0.99.1 + /* count packages matching max arch priority and keep track of last one */ + for (i = 0; i < vec->len; i++) { + pkg_t *maybe = vec->pkgs[i]; -+ ipkg_message(conf, IPKG_DEBUG, " %s arch=%s arch_priority=%d \n", -+ maybe->name, maybe->architecture, maybe->arch_priority); ++ ipkg_message(conf, IPKG_DEBUG, " %s arch=%s arch_priority=%d version=%s \n", ++ maybe->name, maybe->architecture, maybe->arch_priority, maybe->version); + if (maybe->arch_priority > 0) { + max_count++; + abstract_pkg_vec_insert(matching_apkgs, maybe->parent); @@ -11400,12 +11623,21 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_hash.c busybox-1.00+ipkg-0.99.1 + +/* Here it is usefull, if ( matching_apkgs->len > 1 ), to test if one of this matching packages has the same name of the + needed package. In this case, I would return it for install, otherwise I will continue with the procedure */ ++/* The problem is what to do when there are more than a mathing package, with the same name and several version ? ++ Until now I always got the latest, but that breaks the downgrade option. ++ If I stop at the first one, I would probably miss the new ones ++ Maybe the way is to have some kind of flag somewhere, to see if the package been asked to install is from a file, ++ or from a Packages feed. ++ It it is from a file it always need to be checked whatever version I have in feeds or everywhere, according to force-down or whatever options*/ ++/*Pigi*/ + + for (i = 0; i < matching_pkgs->len; i++) { + pkg_t *matching = matching_pkgs->pkgs[i]; + if (constraint_fcn(matching, cdata)) { /* We found it */ -+ ipkg_message(conf, IPKG_DEBUG, " Found a valid candidate for the install: %s \n", matching->name) ; ++ ipkg_message(conf, IPKG_DEBUG, " Found a valid candidate for the install: %s %s \n", matching->name, matching->version) ; + good_pkg_by_name = matching; ++ if ( matching->provided_by_hand == 1 ) /* It has been provided by hand, so it is what user want */ ++ break; + } + } + @@ -11478,7 +11710,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_hash.c busybox-1.00+ipkg-0.99.1 + if (strcmp(pkg->name, name) == 0) + return 1; + else -+ return 0; /* Pigi */ ++ return 0; +} + +pkg_t *pkg_hash_fetch_best_installation_candidate_by_name(ipkg_conf_t *conf, const char *name) @@ -11774,9 +12006,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_hash.c busybox-1.00+ipkg-0.99.1 +} + + -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_hash.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_hash.h ---- busybox-1.00-orig/archival/libipkg/pkg_hash.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_hash.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_hash.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_hash.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_hash.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_hash.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,61 @@ +/* pkg_hash.h - the itsy package management system + @@ -11839,9 +12071,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_hash.h busybox-1.00+ipkg-0.99.1 + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_parse.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_parse.c ---- busybox-1.00-orig/archival/libipkg/pkg_parse.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_parse.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_parse.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_parse.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_parse.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_parse.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,366 @@ +/* pkg_parse.c - the itsy package management system + @@ -12209,9 +12441,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_parse.c busybox-1.00+ipkg-0.99. + + return 0; +} -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_parse.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_parse.h ---- busybox-1.00-orig/archival/libipkg/pkg_parse.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_parse.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_parse.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_parse.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_parse.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_parse.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,31 @@ +/* pkg_parse.h - the itsy package management system + @@ -12244,9 +12476,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_parse.h busybox-1.00+ipkg-0.99. +int pkg_valorize_other_field(pkg_t *pkg, char ***raw); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_src.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_src.c ---- busybox-1.00-orig/archival/libipkg/pkg_src.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_src.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_src.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_src.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,43 @@ +/* pkg_src.c - the itsy package management system + @@ -12291,9 +12523,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_src.c busybox-1.00+ipkg-0.99.15 +} + + -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_src.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_src.h ---- busybox-1.00-orig/archival/libipkg/pkg_src.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_src.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_src.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_src.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,34 @@ +/* pkg_src.h - the itsy package management system + @@ -12329,9 +12561,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_src.h busybox-1.00+ipkg-0.99.15 +void pkg_src_deinit(pkg_src_t *src); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_src_list.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_src_list.c ---- busybox-1.00-orig/archival/libipkg/pkg_src_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_src_list.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_src_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src_list.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_src_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src_list.c 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,75 @@ +/* pkg_src_list.c - the itsy package management system + @@ -12408,9 +12640,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_src_list.c busybox-1.00+ipkg-0. +{ + return (pkg_src_list_elt_t *) void_list_pop((void_list_t *) list); +} -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_src_list.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_src_list.h ---- busybox-1.00-orig/archival/libipkg/pkg_src_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_src_list.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_src_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src_list.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_src_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_src_list.h 2006-07-22 16:31:25.000000000 +0200 @@ -0,0 +1,57 @@ +/* pkg_src_list.h - the itsy package management system + @@ -12469,10 +12701,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_src_list.h busybox-1.00+ipkg-0. + +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_vec.c busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_vec.c ---- busybox-1.00-orig/archival/libipkg/pkg_vec.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_vec.c 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,226 @@ +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_vec.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_vec.c +--- busybox-1.2.0-orig/archival/libipkg/pkg_vec.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_vec.c 2006-07-22 16:31:26.000000000 +0200 +@@ -0,0 +1,230 @@ +/* pkg_vec.c - the itsy package management system + + Steven M. Ayer @@ -12527,7 +12759,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_vec.c busybox-1.00+ipkg-0.99.15 + int found = 0; + + /* look for a duplicate pkg by name, version, and architecture */ -+ for (i = 0; i < vec->len; i++) ++ for (i = 0; i < vec->len; i++){ ++ ipkg_message(conf, IPKG_DEBUG2, "Function: %s. Found pkg=%s version=%s arch=%s cmp=%s version=%s arch=%s \n", ++ __FUNCTION__, pkg->name, pkg->version, pkg->architecture, ++ vec->pkgs[i]->name, vec->pkgs[i]->version,vec->pkgs[i]->architecture ); + if ((strcmp(pkg->name, vec->pkgs[i]->name) == 0) + && (pkg_compare_versions(pkg, vec->pkgs[i]) == 0) + && (strcmp(pkg->architecture, vec->pkgs[i]->architecture) == 0)) { @@ -12536,6 +12771,7 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_vec.c busybox-1.00+ipkg-0.99.15 + __FUNCTION__, pkg->name, pkg->version, pkg->architecture); + break; + } ++ } + + /* we didn't find one, add it */ + if (!found){ @@ -12699,9 +12935,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_vec.c busybox-1.00+ipkg-0.99.15 + qsort(vec->pkgs, vec->len, sizeof(pkg_t *), (compare_fcn_t)compar); +} + -diff -ruN busybox-1.00-orig/archival/libipkg/pkg_vec.h busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_vec.h ---- busybox-1.00-orig/archival/libipkg/pkg_vec.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/pkg_vec.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/pkg_vec.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_vec.h +--- busybox-1.2.0-orig/archival/libipkg/pkg_vec.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/pkg_vec.h 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,62 @@ +/* pkg_vec.h - the itsy package management system + @@ -12765,9 +13001,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/pkg_vec.h busybox-1.00+ipkg-0.99.15 +void abstract_pkg_vec_sort(pkg_vec_t *vec, int (*compar)(abstract_pkg_t *, abstract_pkg_t *)); +#endif + -diff -ruN busybox-1.00-orig/archival/libipkg/sprintf_alloc.h busybox-1.00+ipkg-0.99.154/archival/libipkg/sprintf_alloc.h ---- busybox-1.00-orig/archival/libipkg/sprintf_alloc.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/sprintf_alloc.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/sprintf_alloc.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/sprintf_alloc.h +--- busybox-1.2.0-orig/archival/libipkg/sprintf_alloc.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/sprintf_alloc.h 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,25 @@ +/* sprintf_alloca.c -- like sprintf with memory allocation + @@ -12791,12 +13027,12 @@ diff -ruN busybox-1.00-orig/archival/libipkg/sprintf_alloc.h busybox-1.00+ipkg-0 + +#include "libbb.h" + -+#define sprintf_alloc bb_xasprintf ++#define sprintf_alloc(str, fmt, args...) *str = bb_xasprintf(fmt, ## args) + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/str_list.c busybox-1.00+ipkg-0.99.154/archival/libipkg/str_list.c ---- busybox-1.00-orig/archival/libipkg/str_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/str_list.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/str_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_list.c +--- busybox-1.2.0-orig/archival/libipkg/str_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_list.c 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,76 @@ +/* str_list.c - the itsy package management system + @@ -12874,9 +13110,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/str_list.c busybox-1.00+ipkg-0.99.1 + (void *)target_str, + (void_list_cmp_t)strcmp); +} -diff -ruN busybox-1.00-orig/archival/libipkg/str_list.h busybox-1.00+ipkg-0.99.154/archival/libipkg/str_list.h ---- busybox-1.00-orig/archival/libipkg/str_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/str_list.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/str_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_list.h +--- busybox-1.2.0-orig/archival/libipkg/str_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_list.h 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,51 @@ +/* str_list.h - the itsy package management system + @@ -12929,9 +13165,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/str_list.h busybox-1.00+ipkg-0.99.1 +char *str_list_remove_elt(str_list_t *list, const char *target_str); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/str_util.c busybox-1.00+ipkg-0.99.154/archival/libipkg/str_util.c ---- busybox-1.00-orig/archival/libipkg/str_util.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/str_util.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/str_util.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_util.c +--- busybox-1.2.0-orig/archival/libipkg/str_util.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_util.c 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,73 @@ +/* str_utils.c - the itsy package management system + @@ -13006,9 +13242,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/str_util.c busybox-1.00+ipkg-0.99.1 + return str ? strdup(str) : NULL; +} + -diff -ruN busybox-1.00-orig/archival/libipkg/str_util.h busybox-1.00+ipkg-0.99.154/archival/libipkg/str_util.h ---- busybox-1.00-orig/archival/libipkg/str_util.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/str_util.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/str_util.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_util.h +--- busybox-1.2.0-orig/archival/libipkg/str_util.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/str_util.h 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,28 @@ +/* str_utils.h - the itsy package management system + @@ -13038,9 +13274,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/str_util.h busybox-1.00+ipkg-0.99.1 +char *str_dup_safe(const char *str); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/user.c busybox-1.00+ipkg-0.99.154/archival/libipkg/user.c ---- busybox-1.00-orig/archival/libipkg/user.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/user.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/user.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/user.c +--- busybox-1.2.0-orig/archival/libipkg/user.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/user.c 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,58 @@ +/* user.c - the itsy package management system + @@ -13100,9 +13336,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/user.c busybox-1.00+ipkg-0.99.154/a + + return response; +} -diff -ruN busybox-1.00-orig/archival/libipkg/user.h busybox-1.00+ipkg-0.99.154/archival/libipkg/user.h ---- busybox-1.00-orig/archival/libipkg/user.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/user.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/user.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/user.h +--- busybox-1.2.0-orig/archival/libipkg/user.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/user.h 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,23 @@ +/* user.c - the itsy package management system + @@ -13127,9 +13363,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/user.h busybox-1.00+ipkg-0.99.154/a + +char *get_user_response(const char *format, ...); + -diff -ruN busybox-1.00-orig/archival/libipkg/void_list.c busybox-1.00+ipkg-0.99.154/archival/libipkg/void_list.c ---- busybox-1.00-orig/archival/libipkg/void_list.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/void_list.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/void_list.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/void_list.c +--- busybox-1.2.0-orig/archival/libipkg/void_list.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/void_list.c 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,194 @@ +/* void_list.c - the itsy package management system + @@ -13325,9 +13561,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/void_list.c busybox-1.00+ipkg-0.99. + else + return NULL; +} -diff -ruN busybox-1.00-orig/archival/libipkg/void_list.h busybox-1.00+ipkg-0.99.154/archival/libipkg/void_list.h ---- busybox-1.00-orig/archival/libipkg/void_list.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/void_list.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/void_list.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/void_list.h +--- busybox-1.2.0-orig/archival/libipkg/void_list.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/void_list.h 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,59 @@ +/* void_list.h - the itsy package management system + @@ -13388,42 +13624,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/void_list.h busybox-1.00+ipkg-0.99. +void *void_list_remove_elt(void_list_t *list, const void *target_data, void_list_cmp_t cmp); + +#endif -diff -ruN busybox-1.00-orig/archival/libipkg/xregex.h busybox-1.00+ipkg-0.99.154/archival/libipkg/xregex.h ---- busybox-1.00-orig/archival/libipkg/xregex.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/xregex.h 2005-10-26 17:36:46.000000000 +0200 -@@ -0,0 +1,29 @@ -+/* xregex.h - regex functions with error messages -+ -+ Carl D. Worth -+ -+ Copyright (C) 2001 University of Southern California -+ -+ This program is free software; you can redistribute it and/or modify -+ it under the terms of the GNU General Public License as published by -+ the Free Software Foundation; either version 2, or (at your option) -+ any later version. -+ -+ This program is distributed in the hope that it will be useful, -+ but WITHOUT ANY WARRANTY; without even the implied warranty of -+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ GNU General Public License for more details. -+*/ -+ -+#ifndef XREGEX_H -+#define XREGEX_H -+ -+#include "libbb.h" -+ -+static inline void xregfree(regex_t *preg) -+{ -+ regfree(preg); -+} -+ -+ -+#endif -diff -ruN busybox-1.00-orig/archival/libipkg/xsystem.c busybox-1.00+ipkg-0.99.154/archival/libipkg/xsystem.c ---- busybox-1.00-orig/archival/libipkg/xsystem.c 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/xsystem.c 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/xsystem.c busybox-1.2.0+ipkg-0.99.162/archival/libipkg/xsystem.c +--- busybox-1.2.0-orig/archival/libipkg/xsystem.c 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/xsystem.c 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,64 @@ +/* xsystem.c - system(3) with error messages + @@ -13489,9 +13692,9 @@ diff -ruN busybox-1.00-orig/archival/libipkg/xsystem.c busybox-1.00+ipkg-0.99.15 + return -1; +} + -diff -ruN busybox-1.00-orig/archival/libipkg/xsystem.h busybox-1.00+ipkg-0.99.154/archival/libipkg/xsystem.h ---- busybox-1.00-orig/archival/libipkg/xsystem.h 1970-01-01 01:00:00.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/archival/libipkg/xsystem.h 2005-10-26 17:36:46.000000000 +0200 +diff -ruN busybox-1.2.0-orig/archival/libipkg/xsystem.h busybox-1.2.0+ipkg-0.99.162/archival/libipkg/xsystem.h +--- busybox-1.2.0-orig/archival/libipkg/xsystem.h 1970-01-01 01:00:00.000000000 +0100 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libipkg/xsystem.h 2006-07-22 16:31:26.000000000 +0200 @@ -0,0 +1,34 @@ +/* xsystem.h - system(3) with error messages + @@ -13527,10 +13730,10 @@ diff -ruN busybox-1.00-orig/archival/libipkg/xsystem.h busybox-1.00+ipkg-0.99.15 + +#endif + -diff -ruN busybox-1.00-orig/archival/libunarchive/data_extract_all.c busybox-1.00+ipkg-0.99.154/archival/libunarchive/data_extract_all.c ---- busybox-1.00-orig/archival/libunarchive/data_extract_all.c 2004-10-13 08:25:51.000000000 +0200 -+++ busybox-1.00+ipkg-0.99.154/archival/libunarchive/data_extract_all.c 2005-10-26 17:36:46.000000000 +0200 -@@ -122,3 +122,17 @@ +diff -ruN busybox-1.2.0-orig/archival/libunarchive/data_extract_all.c busybox-1.2.0+ipkg-0.99.162/archival/libunarchive/data_extract_all.c +--- busybox-1.2.0-orig/archival/libunarchive/data_extract_all.c 2006-07-01 00:42:04.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libunarchive/data_extract_all.c 2006-07-22 16:31:26.000000000 +0200 +@@ -126,3 +126,17 @@ utime(file_header->name, &t); } } @@ -13548,44 +13751,43 @@ diff -ruN busybox-1.00-orig/archival/libunarchive/data_extract_all.c busybox-1.0 + } +} + -diff -ruN busybox-1.00-orig/include/applets.h busybox-1.00+ipkg-0.99.154/include/applets.h ---- busybox-1.00-orig/include/applets.h 2004-08-27 01:01:34.000000000 +0200 -+++ busybox-1.00+ipkg-0.99.154/include/applets.h 2005-10-26 17:36:46.000000000 +0200 -@@ -298,6 +298,9 @@ - #ifdef CONFIG_IPCALC - APPLET(ipcalc, ipcalc_main, _BB_DIR_BIN, _BB_SUID_NEVER) - #endif -+#ifdef CONFIG_IPKG -+ APPLET(ipkg, ipkg_main, _BB_DIR_USR_BIN, _BB_SUID_NEVER) -+#endif - #ifdef CONFIG_IPLINK - APPLET(iplink, iplink_main, _BB_DIR_BIN, _BB_SUID_NEVER) - #endif -diff -ruN busybox-1.00-orig/include/libbb.h busybox-1.00+ipkg-0.99.154/include/libbb.h ---- busybox-1.00-orig/include/libbb.h 2004-09-15 05:04:07.000000000 +0200 -+++ busybox-1.00+ipkg-0.99.154/include/libbb.h 2005-10-26 17:36:46.000000000 +0200 -@@ -484,4 +484,17 @@ - #define HASH_MD5 2 - extern int hash_fd(int fd, const size_t size, const uint8_t hash_algo, uint8_t *hashval); - -+struct md5_ctx_t { -+ uint32_t A; -+ uint32_t B; -+ uint32_t C; -+ uint32_t D; -+ uint32_t total[2]; -+ uint32_t buflen; -+ char buffer[128]; -+}; -+extern void md5_begin(struct md5_ctx_t *ctx); -+extern void md5_hash(const void *buffer, size_t length, void *md5_ctx); -+extern void *md5_end(void *resbuf, struct md5_ctx_t *ctx); -+ - #endif /* __LIBCONFIG_H__ */ -diff -ruN busybox-1.00-orig/include/unarchive.h busybox-1.00+ipkg-0.99.154/include/unarchive.h ---- busybox-1.00-orig/include/unarchive.h 2004-03-15 09:28:38.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/include/unarchive.h 2005-10-26 17:36:46.000000000 +0200 -@@ -72,6 +72,7 @@ +diff -ruN busybox-1.2.0-orig/archival/libunarchive/Makefile.in busybox-1.2.0+ipkg-0.99.162/archival/libunarchive/Makefile.in +--- busybox-1.2.0-orig/archival/libunarchive/Makefile.in 2006-07-01 00:42:03.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/libunarchive/Makefile.in 2006-07-22 16:31:26.000000000 +0200 +@@ -58,6 +58,7 @@ + LIBUNARCHIVE-$(CONFIG_FEATURE_DEB_TAR_LZMA) += decompress_unlzma.o get_header_tar_lzma.o + LIBUNARCHIVE-$(CONFIG_GUNZIP) += $(GUNZIP_FILES) + LIBUNARCHIVE-$(CONFIG_FEATURE_GUNZIP_UNCOMPRESS) += decompress_uncompress.o ++LIBUNARCHIVE-$(CONFIG_IPKG) += $(GUNZIP_FILES) get_header_tar.o get_header_tar_gz.o + LIBUNARCHIVE-$(CONFIG_RPM2CPIO) += $(GUNZIP_FILES) get_header_cpio.o + LIBUNARCHIVE-$(CONFIG_RPM) += $(GUNZIP_FILES) get_header_cpio.o + LIBUNARCHIVE-$(CONFIG_TAR) += get_header_tar.o +diff -ruN busybox-1.2.0-orig/archival/Makefile.in busybox-1.2.0+ipkg-0.99.162/archival/Makefile.in +--- busybox-1.2.0-orig/archival/Makefile.in 2006-07-01 00:42:04.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/archival/Makefile.in 2006-07-22 16:31:25.000000000 +0200 +@@ -20,6 +20,7 @@ + ARCHIVAL-$(CONFIG_DPKG_DEB) += dpkg_deb.o + ARCHIVAL-$(CONFIG_GUNZIP) += gunzip.o + ARCHIVAL-$(CONFIG_GZIP) += gzip.o ++ARCHIVAL-$(CONFIG_IPKG) += ipkg.o + ARCHIVAL-$(CONFIG_RPM2CPIO) += rpm2cpio.o + ARCHIVAL-$(CONFIG_RPM) += rpm.o + ARCHIVAL-$(CONFIG_TAR) += tar.o +diff -ruN busybox-1.2.0-orig/include/applets.h busybox-1.2.0+ipkg-0.99.162/include/applets.h +--- busybox-1.2.0-orig/include/applets.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/include/applets.h 2006-07-22 16:35:35.000000000 +0200 +@@ -152,6 +152,7 @@ + USE_IPCALC(APPLET(ipcalc, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_IPCRM(APPLET(ipcrm, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)) + USE_IPCS(APPLET(ipcs, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS)) ++USE_IPKG(APPLET(ipkg, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) + USE_IPLINK(APPLET(iplink, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_IPROUTE(APPLET(iproute, _BB_DIR_BIN, _BB_SUID_NEVER)) + USE_IPTUNNEL(APPLET(iptunnel, _BB_DIR_BIN, _BB_SUID_NEVER)) +diff -ruN busybox-1.2.0-orig/include/unarchive.h busybox-1.2.0+ipkg-0.99.162/include/unarchive.h +--- busybox-1.2.0-orig/include/unarchive.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/include/unarchive.h 2006-07-22 16:31:26.000000000 +0200 +@@ -77,6 +77,7 @@ extern void data_skip(archive_handle_t *archive_handle); extern void data_extract_all(archive_handle_t *archive_handle); @@ -13593,15 +13795,15 @@ diff -ruN busybox-1.00-orig/include/unarchive.h busybox-1.00+ipkg-0.99.154/inclu extern void data_extract_to_stdout(archive_handle_t *archive_handle); extern void data_extract_to_buffer(archive_handle_t *archive_handle); -diff -ruN busybox-1.00-orig/include/usage.h busybox-1.00+ipkg-0.99.154/include/usage.h ---- busybox-1.00-orig/include/usage.h 2004-09-14 18:23:56.000000000 +0200 -+++ busybox-1.00+ipkg-0.99.154/include/usage.h 2005-10-26 17:36:46.000000000 +0200 -@@ -836,6 +836,82 @@ +diff -ruN busybox-1.2.0-orig/include/usage.h busybox-1.2.0+ipkg-0.99.162/include/usage.h +--- busybox-1.2.0-orig/include/usage.h 2006-07-01 00:42:10.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/include/usage.h 2006-07-22 16:31:26.000000000 +0200 +@@ -982,6 +982,82 @@ "$ ls -la /tmp/busybox*\n" \ "-rw-rw-r-- 1 andersen andersen 554058 Apr 14 17:49 /tmp/busybox.tar.gz\n" +#define ipkg_trivial_usage \ -+ "[options...] sub-command [arguments...]" ++ "[options]... sub-command [arguments]..." +#define ipkg_full_usage \ + "ipkg is an utility to install, remove and manage .ipk packages.\n" \ + "\n" \ @@ -13677,49 +13879,17 @@ diff -ruN busybox-1.00-orig/include/usage.h busybox-1.00+ipkg-0.99.154/include/u + "\teg: ipkg info 'libstd*' or ipkg search '*libop*' or ipkg remove 'libncur*'\n" + #define halt_trivial_usage \ - "[-d]" + "[-d] [-n] [-f]" #define halt_full_usage \ -diff -ruN busybox-1.00-orig/libbb/hash_fd.c busybox-1.00+ipkg-0.99.154/libbb/hash_fd.c ---- busybox-1.00-orig/libbb/hash_fd.c 2004-03-15 09:28:42.000000000 +0100 -+++ busybox-1.00+ipkg-0.99.154/libbb/hash_fd.c 2005-10-26 17:36:46.000000000 +0200 -@@ -288,21 +288,10 @@ - static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; - # endif /* MD5SUM_SIZE_VS_SPEED == 0 */ - --/* Structure to save state of computation between the single steps. */ --struct md5_ctx_t { -- uint32_t A; -- uint32_t B; -- uint32_t C; -- uint32_t D; -- uint32_t total[2]; -- uint32_t buflen; -- char buffer[128]; --}; -- - /* Initialize structure containing state of computation. - * (RFC 1321, 3.3: Step 3) - */ --static void md5_begin(struct md5_ctx_t *ctx) -+extern void md5_begin(struct md5_ctx_t *ctx) - { - ctx->A = 0x67452301; - ctx->B = 0xefcdab89; -@@ -706,7 +695,7 @@ - } - } +diff -ruN busybox-1.2.0-orig/Makefile busybox-1.2.0+ipkg-0.99.162/Makefile +--- busybox-1.2.0-orig/Makefile 2006-07-01 00:42:13.000000000 +0200 ++++ busybox-1.2.0+ipkg-0.99.162/Makefile 2006-07-22 16:31:25.000000000 +0200 +@@ -31,7 +31,7 @@ + export srctree=$(top_srcdir) + vpath %/Config.in $(srctree) --static void md5_hash(const void *buffer, size_t length, void *md5_ctx) -+extern void md5_hash(const void *buffer, size_t length, void *md5_ctx) - { - if (length % 64 == 0) { - md5_hash_block(buffer, length, md5_ctx); -@@ -723,7 +712,7 @@ - * IMPORTANT: On some systems it is required that RESBUF is correctly - * aligned for a 32 bits value. - */ --static void *md5_end(void *resbuf, struct md5_ctx_t *ctx) -+extern void *md5_end(void *resbuf, struct md5_ctx_t *ctx) - { - /* Take yet unprocessed bytes into account. */ - uint32_t bytes = ctx->buflen; +-DIRS:=applets archival archival/libunarchive coreutils console-tools \ ++DIRS:=applets archival archival/libipkg archival/libunarchive coreutils console-tools \ + debianutils editors findutils init miscutils modutils networking \ + networking/libiproute networking/udhcp procps loginutils shell \ + sysklogd util-linux e2fsprogs libpwdgrp coreutils/libcoreutils libbb