+++ /dev/null
-Index: installer/poldek/Makefile.am
-diff -u installer/poldek/Makefile.am:1.54 installer/poldek/Makefile.am:1.54.4.2
---- installer/poldek/Makefile.am:1.54 Thu Nov 7 17:43:25 2002
-+++ installer/poldek/Makefile.am Fri Dec 19 02:29:31 2003
-@@ -1,4 +1,4 @@
--# $Id$
-+# $Id$
-
- AUTOMAKE_OPTIONS =
- ACLOCAL_AMFLAGS = -I m4
-@@ -42,6 +42,7 @@
- pkgset-load.c pkgset-load.h \
- pkgset.c pkgset.h \
- pkgset-req.c pkgset-req.h \
-+ pkgset-merge.c \
- pkgset-order.c \
- pkgset-install.c \
- dbdep.c dbdep.h \
-@@ -66,11 +67,11 @@
-
- SHELL_MOD = shell/libshell.a
-
--poldek_DEPENDENCIES_ = libpoldek.a \
-- sigint/libsigint.a \
-- vfile/libvfile.a \
-+poldek_DEPENDENCIES_ = libpoldek.a \
-+ vfile/libvfile.a \
- vfile/vftp/libvftp.a \
-- vfile/vhttp/libvhttp.a
-+ vfile/vhttp/libvhttp.a \
-+ sigint/libsigint.a
-
- if ENABLE_INTERACTIVE_MODE
- SHELL_MOD_ = $(SHELL_MOD)
-@@ -83,11 +84,12 @@
- LDADD_ = @INTLLIBS@
-
- bin_PROGRAMS = poldek rpmvercmp
--dist_bin_SCRIPTS = mkpackagedir vfjuggle vfuncompr
-+dist_bin_SCRIPTS = mkpackagedir vfjuggle vfcompr
- poldek_SOURCES = main.c
--poldek_LDADD = libpoldek.a sigint/libsigint.a vfile/libvfile.a \
-- vfile/vftp/libvftp.a vfile/vhttp/libvhttp.a \
-- $(SHELL_MOD_) $(LDADD_)
-+poldek_LDADD = libpoldek.a vfile/libvfile.a \
-+ vfile/vftp/libvftp.a vfile/vhttp/libvhttp.a \
-+ sigint/libsigint.a \
-+ $(SHELL_MOD_) $(LDADD_)
-
- rpmvercmp_SOURCES = rpmvercmp.c
- rpmvercmp_LDADD = $(LDADD_)
-@@ -97,7 +99,7 @@
- noinst_PROGRAMS = test_match
- test_match_SOURCES = test_match.c
- test_match_LDADD = $(poldek_LDADD)
--
-+test_match_DEPENDENCIES = $(poldek_DEPENDENCIES)
-
- EXTRA_DIST = \
- poldek.1 poldek.pod \
-Index: installer/poldek/NEWS
-diff -u installer/poldek/NEWS:1.56 installer/poldek/NEWS:1.56.4.2
---- installer/poldek/NEWS:1.56 Wed Nov 27 19:56:09 2002
-+++ installer/poldek/NEWS Sun Dec 7 22:07:32 2003
-@@ -1,3 +1,9 @@
-+0.18.2 (minor bugfix && improvements release; 2003/07/23)
-+
-+* support for RPM 4.2/4.3
-+* dependency processing bugfix
-+* RPM 4.1 related fixes
-+
- 0.18.1 (major bugfix release; 2002/11/27)
-
- * ability of creation empty indexes
-@@ -13,7 +19,7 @@
-
- 0.18 (bugfix/minor enhancements release; 2002/11/07)
-
--* support for RPM 4.1 (with help of Artur Frysiak <wiget@pld.org.pl>)
-+* support for RPM 4.1 (with help of Artur Frysiak <wiget at pld-linux org>)
-
- * few dependency processing improvements:
- - greedy upgrades are performed instead of marking different versions
-@@ -35,9 +41,9 @@
- * fixed available package list management in interactive mode
-
- * AM/AC stuff cleanup and adaptation to their new versions (automake 1.7 and autoconf 2.54)
-- (Artur Frysiak <wiget@pld.org.pl>)
-+ (Artur Frysiak <wiget at pld-linux org>)
-
--* Polish translation of manual page (GoTaR <gotar@pld.org.pl>)
-+* Polish translation of manual page (GoTaR <gotar at pld-linux org>)
-
- * fix: progress bar isn't refreshed so frequently (#367)
-
-@@ -55,9 +61,9 @@
- 0.17.8 (major bugfix release; 2002/08/18)
-
- * package installation is verified with rpm database if rpm reports failure
--* fixed obsoletes matching (Jakub Bogusz <qboosh@pld.org.pl>)
-+* fixed obsoletes matching (Jakub Bogusz <qboosh at pld-linux org>)
- * improved and fixed file based conflicts detection
--* fixed size units display (GoTaR <gotar@poczta.onet.pl>)
-+* fixed size units display (GoTaR <gotar at poczta.onet.pl>)
-
-
- 0.17.7 (bugfix release; 2002/06/14)
-@@ -94,12 +100,12 @@
- * improved package auto-selection among equivalents: package which marks
- less packages to install is preferred
- * vftp: fixed logging in when server doesn't ask for password
-- (Przemyslaw Frasunek <venglin@freebsd.lublin.pl>)
-+ (Przemyslaw Frasunek <venglin at freebsd.lublin.pl>)
- * bugfix: root directory (--rootdir) is always passed to rpm as absolute path
- * shell: desc: file mode is displayed in human readable form
- * fixed vfjuggle: packages.dir.md* are copied to hdd too
- * few SIGSEVs killed on "search" command when APT's pkglist file
-- is used as package index (thanks to Gustavo Niemeyer <niemeyer@conectiva.com>)
-+ is used as package index (thanks to Gustavo Niemeyer <niemeyer at conectiva.com>)
-
-
- 0.17.4 (bugfix/minor enhancements release; 2002/05/06)
-@@ -144,11 +150,11 @@
- * new "--clean" and "--clean-whole" options for cache directory
- cleanup
-
--* URLs with user and password (ftp://user:passwd@host:port/path/ syntax)
-- are supported (Andreas Piesk <a.piesk@gmx.net>)
-+* URLs with user and password (ftp://user:passwd at host:port/path/ syntax)
-+ are supported (Andreas Piesk <a.piesk at gmx.net>)
-
- * new "ftp_sysuser_as_anon_passwd" option causes sending
-- login@hostname as anonymous FTP password
-+ login at hostname as anonymous FTP password
-
- * new "noautoup" source option tells poldek to do not update
- source by default.
-@@ -157,11 +163,11 @@
-
- * misc fixes to compile on SuSE
-
--* fixed rpm 3.x support (with help of Roger Luethi <rl@hellgate.ch>)
-+* fixed rpm 3.x support (with help of Roger Luethi <rl at hellgate.ch>)
-
- * fixed and improved handling of bool configuration options,
- added on/off and enable/disable to the list of valid choices
-- (Andreas Piesk <a.piesk@gmx.net>)
-+ (Andreas Piesk <a.piesk at gmx.net>)
-
- * fixed detection of file based conflicts between available packages.
-
-@@ -169,7 +175,7 @@
- versions are handled properly
-
- * misc fixes to compile and work with glibc2.1 (with
-- help of Andreas Piesk <a.piesk@gmx.net>)
-+ help of Andreas Piesk <a.piesk at gmx.net>)
-
- * installation of multiple instances of package is allowed (by poldek -i)
-
-@@ -178,24 +184,24 @@
- - fixed handling package conflicts added by poldek
- - faster dependency checking
-
--* German translation (Andreas Piesk <a.piesk@gmx.net>)
-+* German translation (Andreas Piesk <a.piesk at gmx.net>)
-
- * various bugs are fixed:
- - double '/' in paths handling
- - huge mem leak on --update
-- - ambiguous p_open() flags (Michal Moskal <malekith@pld.org.pl>)
-+ - ambiguous p_open() flags (Michal Moskal <malekith at pld-linux org>)
- - removed [v]snprintf() (wrong) usage; trurlib's n_[v]snprintf()
- are used instead
-- - automake/autoconf fixes (Artur Frysiak <wiget@pld.org.pl>)
-- - many minor fixes (thanks to Andreas Piesk <a.piesk@gmx.net>)
-+ - automake/autoconf fixes (Artur Frysiak <wiget at pld-linux org>)
-+ - many minor fixes (thanks to Andreas Piesk <a.piesk at gmx.net>)
-
- 0.17.2
- * "ported" to RedHat 7.2 (with rpm 4.0.4)
- * install-dist: --force forces installation of broken package sets
- * corrected package installation progress bar
-- (Michal Moskal <malekith@pld.org.pl>)
-+ (Michal Moskal <malekith at pld-linux org>)
- * install-dist: log INST-{OK,ERR} for PLD Installer
-- (Michal Moskal <malekith@pld.org.pl>)
-+ (Michal Moskal <malekith at pld-linux org>)
- * --dump* works properly
- * vftp: fixed error handling
-
-@@ -260,7 +266,7 @@
- - uninstall: fix: don't remove pkg from install list if --test is used
- - added -h opt. to all commands
- * removed GCC's nested functions usage -- seems that it causes SIGSEVs on
-- some machines (Arkadiusz Patyk <areq@pld.org.pl>)
-+ some machines (Arkadiusz Patyk <areq at pld-linux org>)
- * fix: don't include trailing whitespaces in config values
-
- 0.15.8:
-@@ -271,7 +277,7 @@
- doesn't contain package descriptions at all
- * shell: fixed installed package list management
- * curl: fixed progress bar if total file size is unknown
-- (Michal Moskal <malekith@pld.org.pl>)
-+ (Michal Moskal <malekith at pld-linux org>)
- * "mercy" mode bugfix
-
- 0.15.7:
-@@ -292,8 +298,8 @@
- * added global config /etc/poldek.conf usage
- * fixed prereq loop detection
- * added '@' to list of valid characters in package filename
-- (Rafal Kleger-Rudomin <klakier@pld.org.pl>)
--* vfjuggle: sed is used instead of awk (Rafal Kleger-Rudomin <klakier@pld.org.pl>)
-+ (Rafal Kleger-Rudomin <klakier at pld-linux org>)
-+* vfjuggle: sed is used instead of awk (Rafal Kleger-Rudomin <klakier at pld-linux org>)
- * shell: ls: fixed packages sorting
- * minor bugfixes
-
-@@ -351,8 +357,8 @@
- - extended "desc" and "search" commands -- almost all
- package fields could be specified
- - colorized output
--* bugfixes (thanks to Rafal Kleger-Rudomin <klakier@pld.org.pl> and
-- Michal Moskal <malekith@pld.org.pl>)
-+* bugfixes (thanks to Rafal Kleger-Rudomin <klakier at pld-linux org> and
-+ Michal Moskal <malekith at pld-linux org>)
-
- 0.14:
-
-@@ -373,10 +379,10 @@
- * support for rpm 4.0.2 pre/post requirements
- * readline 4.2 updates
- * vfile: added curl backend (curl >= 7.7.4-pre1 is needed)
--* added --nodesc option for index creation (Michal Moskal <malekith@pld.org.pl>)
-+* added --nodesc option for index creation (Michal Moskal <malekith at pld-linux org>)
- * rpmvercmp returns 2 instead of -1
- * file names are stored without trailing '\0' (saves about 100 kB disk space)
- * temporary dir may be set by $TMPDIR
- * fixed checking dependencies of unistalled packages
- * shell: added "desc" command
--* fixed a lot of bugs (with help of Michal Moskal <malekith@pld.org.pl>)
-+* fixed a lot of bugs (with help of Michal Moskal <malekith at pld-linux org>)
-Index: installer/poldek/README.merging
-diff -u /dev/null installer/poldek/README.merging:1.1.2.1
---- /dev/null Fri Jan 9 13:45:49 2004
-+++ installer/poldek/README.merging Wed Apr 2 16:54:08 2003
-@@ -0,0 +1,24 @@
-+
-+With --merge option poldek merges two or more sources with esure
-+that result package set will not contain unsatisfied dependencies.
-+Usage:
-+
-+$ poldek --merge DST_SOURCE SRC_SOURCE...
-+
-+Examples:
-+
-+Assume you have 2 repositories, the first is "stable", the second
-+"test" one.
-+
-+$ poldek -l
-+stable /dists/ac/PLD/i686/PLD/RPMS/
-+test /dists/ac/test/i686/RPMS/
-+
-+To merge them do:
-+
-+$ poldek --merge -n stable -n test | grep 'merge: ' | sed 's/merge: //g' | sh
-+
-+The program produces "rm FILE" and "mv FILE" commands after 'merge: '
-+prefix, so after filtering out the 'merge: ' prefix the commands could
-+be passed to shell. After that "$ poldek -n stable -V" should not
-+reports any unsatisfied dependencies.
-Index: installer/poldek/conf.c
-diff -u installer/poldek/conf.c:1.31 installer/poldek/conf.c:1.31.4.3
---- installer/poldek/conf.c:1.31 Fri Oct 18 18:19:42 2002
-+++ installer/poldek/conf.c Tue Dec 30 19:14:07 2003
-@@ -11,7 +11,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #include <ctype.h>
-@@ -79,6 +79,8 @@
- { "particle_install", TYPE_BOOL, { 0 } },
- { "unique_package_names", TYPE_BOOL, { 0 } },
- { "ftp_sysuser_as_anon_passwd", TYPE_BOOL , { 0 } },
-+ { "vfile_external_compress", TYPE_BOOL, { 0 } },
-+ { "promoteepoch", TYPE_BOOL, { 0 } },
- { NULL, 0, { 0 } },
- };
-
-Index: installer/poldek/configure.in
-diff -u installer/poldek/configure.in:1.76 installer/poldek/configure.in:1.76.4.5
---- installer/poldek/configure.in:1.76 Wed Nov 27 19:56:09 2002
-+++ installer/poldek/configure.in Sun Dec 7 22:04:35 2003
-@@ -1,15 +1,16 @@
- dnl Process this file with autoconf to produce a configure script.
--dnl $Id$
-+dnl $Id$
-
--AC_INIT(poldek, 0.18.1)
-+AC_INIT(poldek, 0.18.2)
- AC_CONFIG_SRCDIR([capreq.c])
-
--VERSION=0.18.1
-+VERSION=0.18.2
- VERSION_STATUS="stable"
- VERSION_CVSTAG="v$(echo $VERSION | sed 's/\./_/g')"
- AH_TEMPLATE([ENABLE_TRACE],[])
- AH_TEMPLATE([HAVE_RPM_4_0_4],[])
- AH_TEMPLATE([HAVE_RPM_4_1],[])
-+AH_TEMPLATE([HAVE_RPM_4_2],[])
- AH_TEMPLATE([HAVE_RPM_EXTDEPS],[])
- AH_TEMPLATE([HAVE_TM_GMTOFF],[])
- AH_TEMPLATE([HAVE_TM___GMTOFF],[])
-@@ -29,6 +30,11 @@
- dnl Checks for programs.
- AC_PROG_CC()
- AC_C_INLINE
-+
-+if test "$GCC." = "yes."; then
-+ CFLAGS="$CFLAGS -fno-builtin-log"
-+fi
-+
- AC_PROG_INSTALL
- AC_PROG_RANLIB
- AC_CHECK_PROG(POD2MAN, pod2man, pod2man)
-@@ -240,9 +246,10 @@
- DBLIB="$DBLIB -ldb1"
- fi
- else
-- AC_CHECK_LIB(db-4.0, db_create, [DBLIB="-ldb-4.0"],
-+ AC_CHECK_LIB(db-4.1, db_create, [DBLIB="-ldb-4.1"],
-+ [AC_CHECK_LIB(db-4.0, db_create, [DBLIB="-ldb-4.0"],
- [AC_CHECK_LIB(db, db_create, [DBLIB="-ldb"],,[$LIBS])],
-- [$LIBS])
-+ [$LIBS])],, [$LIBS])
-
- if test "${ENABLE_STATIC}." = "yes."; then
- DBLIB="$DBLIB"
-@@ -264,11 +271,11 @@
- fi
-
-
--AC_CHECK_LIB(rpm, rpmReadPackageInfo,[LIBS="$LIBS -lrpm $DBLIB"],
-+AC_CHECK_LIB(rpm, rpmReadPackageInfo,[LIBS="-lrpm $DBLIB $LIBS"],
- AC_CHECK_LIB(rpm, rpmReadPackageHeader,
-- [LIBS="$LIBS -lrpm -lrpmdb $DBLIB"],
-+ [LIBS="-lrpm -lrpmdb $DBLIB $LIBS"],
- AC_CHECK_LIB(rpm, rpmReadPackageFile,
-- [LIBS="$LIBS -lrpm -lrpmdb $DBLIB"
-+ [LIBS="-lrpm -lrpmdb -lelf $DBLIB $LIBS"
- AC_DEFINE([HAVE_RPM_4_1],1,[])],
- AC_MSG_ERROR(["rpmlib not found"]),
- [$DBLIB -lrpmdb]),
-@@ -278,14 +285,19 @@
- AC_CHECK_FUNCS(rpmMachineScore,,[ AC_MSG_ERROR(["rpmlib not found"])])
- AC_CHECK_FUNCS(rpmlog rpmCheckSig rpmVerifySignature)
-
-+dnl rpm 4.2?
-+AC_CHECK_FUNCS(rpmtsColor, [LIBS="$LIBS -lpthread"
-+ AC_DEFINE([HAVE_RPM_4_2],1,[])])
-+#AC_DEFINE([HAVE_RPM_4_2],1,[]))
-+
- AC_CHECK_HEADERS(db_185.h,,[
- AC_MSG_WARN(["disabled synchronization with db file-dependencies"]) ])
- AC_CHECK_FUNCS(__db185_open)
-
- dnl 4.0.4 has cross dependenecies(?)
- if test ${is_rpm4_0_4}. = yes. -a ${ENABLE_STATIC}. = yes. ; then
-- if ${have_beecrypt}. = yes. ; then
-- LIBS="$LIBS -lbz2 -lrpmio"
-+ if test ${have_beecrypt}. = yes. ; then
-+ LIBS="$LIBS -lbz2 -lrpmio -lbeecrypt -lpthread"
- fi
- LIBS="$LIBS -lbz2 -lrpmio"
- fi
-@@ -298,7 +310,7 @@
-
- AC_CHECK_FUNCS(openpty,,
- AC_CHECK_LIB(util, openpty,
-- [AC_DEFINE([HAVE_OPENPTY],1,[defined if openpty() is avialable])] [LIBS="$LIBS -lutil"]))
-+ [AC_DEFINE([HAVE_OPENPTY],1,[defined if openpty() is avialable])] [LIBS="-lutil $LIBS"]))
-
- AC_CHECK_FUNCS(rpmGetRpmlibProvides,,
- [AC_MSG_WARN("[poldek will not work fine with rpmlib\(...\) capabilities"])],
-@@ -311,6 +323,10 @@
- )],
- [$CONF_IN_LDFLAGS])
-
-+if test -f /etc/redhat-release; then
-+ LIBS="$LIBS -ldl" # rh's crypto needs this
-+fi
-+
-
- dnl trullib 0.43.5 has n_hash_size; test if linked with system copy only
- NARRAY="<trurl/narray.h>"
-@@ -318,7 +334,7 @@
- AC_CHECK_LIB(trurl, n_hash_size,,
- [AC_MSG_ERROR(["trurlib >= 0.43.5 not found"])], [$CONF_IN_LDFLAGS])
- else
-- LIBS="$LIBS -ltrurl"
-+ LIBS="-ltrurl $LIBS"
- AC_CONFIG_SUBDIRS(trurlib)
- NARRAY="\"$srcdir/$TRURL_DIR/include/trurl/narray.h\""
- fi
-Index: installer/poldek/dbdep.c
-diff -u installer/poldek/dbdep.c:1.8 installer/poldek/dbdep.c:1.8.4.1
---- installer/poldek/dbdep.c:1.8 Thu Nov 14 20:23:24 2002
-+++ installer/poldek/dbdep.c Tue Dec 30 19:15:27 2003
-@@ -9,7 +9,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- Module used in pkgset-install.c only
- */
-
-@@ -34,7 +34,7 @@
- #include "misc.h"
- #include "dbdep.h"
-
--static db_dep_free_pkgs(struct db_dep *db_dep)
-+static void db_dep_free_pkgs(struct db_dep *db_dep)
- {
- if (db_dep->pkgs) {
- n_array_free(db_dep->pkgs);
-Index: installer/poldek/main.c
-diff -u installer/poldek/main.c:1.110 installer/poldek/main.c:1.110.4.6
---- installer/poldek/main.c:1.110 Tue Nov 26 17:32:15 2002
-+++ installer/poldek/main.c Tue Dec 30 19:14:07 2003
-@@ -11,7 +11,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #ifdef HAVE_CONFIG_H
-@@ -80,9 +80,9 @@
- #define MODE_SPLIT (1 << 7)
- #define MODE_SRCLIST (1 << 8)
- #define MODE_UNINSTALL (1 << 9)
--
-+#define MODE_MERGE (1 << 10)
- #ifdef ENABLE_INTERACTIVE_MODE
--# define MODE_SHELL (1 << 10)
-+# define MODE_SHELL (1 << 11)
- #endif
-
- #define MODE_IS_NOSCORE (MODE_VERIFY | MODE_MKIDX | MODE_SPLIT | MODE_SRCLIST)
-@@ -171,6 +171,7 @@
- tn_hash *htcnf = NULL; /* config file values */
-
- #define OPT_VERIFY_MERCY 'm'
-+#define OPT_VERIFY_PROMOTEPOCH 901
- #define OPT_VERIFY_DEPS 'V'
- #define OPT_VERIFY_CNFLS 902
- #define OPT_VERIFY_FILECNFLS 903
-@@ -242,6 +243,7 @@
- #define OPT_ASK 2006
- #define OPT_NOASK 2007
-
-+#define OPT_MERGE 2101
- #define OPT_SW_V016 (1 << 0)
- #define OPT_SW_NOASK (1 << 1)
- #define OPT_SW_NOCONF (1 << 2)
-@@ -298,6 +300,10 @@
- N_("Verify dependencies, conflicts and file conflicts"), 50 },
- {"mercy", OPT_VERIFY_MERCY, 0, 0,
- N_("Be tolerant for bugs which RPM tolerates"), 50 },
-+
-+{"promoteepoch", OPT_VERIFY_PROMOTEPOCH, 0, 0,
-+ N_("Promote non-existent requiremet's epoch to package's one"), 50 },
-+
-
-
- {0,0,0,0, N_("Index creation:"), 60},
-@@ -415,7 +421,14 @@
- N_("Take package priorities from FILE"), 71 },
-
- {"split-out", OPT_SPLITOUTPATH, "PREFIX", 0,
-- N_("Write chunks to PREFIX.XX, default PREFIX is packages.chunk"), 90 },
-+ N_("Write chunks to PREFIX.XX, default PREFIX is packages.chunk"), 90 },
-+
-+#if 0 //nfy
-+{0,0,0,0, N_("Merging:"), 100},
-+#endif
-+{"merge", OPT_MERGE, 0, OPTION_HIDDEN,
-+ N_("Merging given sources, the first one is treated as \"destination\", "
-+ "the others as \"source\" ones"), 100 },
-
- {0,0,0,0, N_("Other:"), 500},
- {"cachedir", OPT_SOURCECACHE, "DIR", 0,
-@@ -690,14 +703,20 @@
- argsp->idx_path = prepare_path(arg);
- argsp->idx_type = INDEXTYPE_TXTZ;
- break;
-+
-+ case OPT_MERGE:
-+ check_mjrmode(argsp);
-+ argsp->mjrmode = MODE_MERGE;
-+ //argsp->psflags |= PSVERIFY_DEPS;
-+ break;
-
- case OPT_NODESC:
-- argsp->pkgdir_creat_flags |= PKGDIR_CREAT_NODESC;
-- break;
-+ argsp->pkgdir_creat_flags |= PKGDIR_CREAT_NODESC;
-+ break;
-
- case OPT_NODIFF:
-- argsp->pkgdir_nodiff = 1;
-- break;
-+ argsp->pkgdir_nodiff = 1;
-+ break;
-
- case OPT_UNINSTALL:
- check_mjrmode(argsp);
-@@ -1217,7 +1236,6 @@
- argp_parse(&argp, argc, argv, 0, 0, &args);
-
- pkgdir_v016compat = (args.switches & OPT_SW_V016);
--
-
- if ((args.switches & OPT_SW_NOCONF) && args.conf_path) {
- logn(LOGERR, _("--noconf and --conf are exclusive, aren't they?"));
-@@ -1287,7 +1305,12 @@
- args.has_pkgdef = n_array_size(args.pkgdef_sets) +
- n_array_size(args.pkgdef_defs) +
- n_array_size(args.pkgdef_files);
--
-+
-+ if (conf_get_bool(htcnf, "vfile_external_compress", 0))
-+ pkgdir_redhat9_zlib_in_rpm_workaround = 1;
-+
-+ if (conf_get_bool(htcnf, "promoteepoch", 0))
-+ poldek_conf_promote_epoch = 1;
-
- if (conf_get_bool(htcnf, "use_sudo", 0))
- args.inst.flags |= INSTS_USESUDO;
-@@ -1430,6 +1453,52 @@
- }
- }
-
-+static int do_merge(tn_array *sources, unsigned psflags)
-+{
-+ struct pkgset *ps_src, *ps_dst;
-+ struct source *src;
-+ tn_array *dst_sources;
-+ int rc = 1;
-+
-+ n_assert(n_array_size(sources) > 1);
-+ n_array_sort_ex(sources, (tn_fn_cmp)source_cmp_pri_name);
-+ dst_sources = n_array_clone(sources);
-+
-+ n_array_push(dst_sources, n_array_shift(args.sources));
-+
-+ ps_src = pkgset_new(psflags);
-+ ps_dst = pkgset_new(psflags);
-+
-+ msgn(1, "Loading \"destination\" source...");
-+ if (!pkgset_load(ps_dst, 0, dst_sources))
-+ logn(LOGWARN, _("%s: no packages loaded"),
-+ source_idstr((struct source*)n_array_nth(dst_sources, 0)));
-+
-+ if (!pkgset_setup(ps_dst, 0))
-+ logn(LOGWARN, "%s: source is not clean",
-+ source_idstr((struct source*)n_array_nth(dst_sources, 0)));
-+
-+ msgn(1, "Loading \"source\" sources...");
-+ if (!pkgset_load(ps_src, 0, args.sources)) {
-+ logn(LOGERR, _("%s: no packages loaded"),
-+ source_idstr((struct source*)n_array_nth(args.sources, 0)));
-+ rc = 0;
-+ }
-+
-+ if (rc) {
-+ pkgset_setup(ps_src, 0);
-+ msgn(1, "Merging...");
-+ pkgset_merge(ps_dst, ps_src, psflags);
-+ }
-+
-+ pkgset_free(ps_src);
-+ pkgset_free(ps_dst);
-+
-+ n_array_unshift(args.sources, n_array_shift(dst_sources));
-+ n_array_free(dst_sources);
-+ return rc;
-+}
-+
- static struct pkgset *load_pkgset(int ldflags)
- {
- struct pkgset *ps;
-@@ -1658,6 +1727,19 @@
- rc = prepare_given_packages();
- break;
-
-+ case MODE_MERGE:
-+ if (verbose >= 0)
-+ verbose += 1;
-+
-+ n_assert(args.sources);
-+
-+ if (n_array_size(args.sources) < 2) {
-+ logn(LOGERR, _("merging needs at least 2 sources"));
-+ exit(EXIT_FAILURE);
-+ }
-+
-+ break;
-+
- case MODE_MKIDX:
- if (verbose >= 0)
- verbose += 1;
-@@ -1867,6 +1949,11 @@
- if (args.mjrmode == MODE_UNINSTALL) {
- if ((rc = usrpkgset_size(args.ups)))
- rc = uninstall(args.ups, &args.inst);
-+ goto l_end;
-+ }
-+
-+ if (args.mjrmode == MODE_MERGE) {
-+ rc = do_merge(args.sources, args.psflags);
- goto l_end;
- }
-
-Index: installer/poldek/make.sh
-diff -u /dev/null installer/poldek/make.sh:1.4.2.2
---- /dev/null Fri Jan 9 13:45:49 2004
-+++ installer/poldek/make.sh Fri Dec 19 02:29:31 2003
-@@ -0,0 +1,4 @@
-+#!/bin/sh
-+
-+cd $(dirname $0) || exit 1
-+make CFLAGS="-fno-builtin-log -O0 -g -Wall -W -pipe" $@
-Index: installer/poldek/pkg.c
-diff -u installer/poldek/pkg.c:1.51 installer/poldek/pkg.c:1.51.4.2
---- installer/poldek/pkg.c:1.51 Fri Oct 18 18:19:42 2002
-+++ installer/poldek/pkg.c Tue Dec 30 19:19:52 2003
-@@ -7,7 +7,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
- #ifdef HAVE_CONFIG_H
- # include "config.h"
-@@ -32,6 +32,8 @@
- #include "pkgdir.h"
- #include "pkgroup.h"
-
-+int poldek_conf_promote_epoch = 0;
-+
- static void *(*pkg_alloc_fn)(size_t) = n_malloc;
- static void (*pkg_free_fn)(void*) = n_free;
-
-@@ -47,11 +49,13 @@
- struct pkg *pkg_new(const char *name, int32_t epoch,
- const char *version, const char *release,
- const char *arch, const char *os,
-+ const char *fn,
- uint32_t size, uint32_t fsize,
- uint32_t btime)
- {
- struct pkg *pkg;
-- int name_len = 0, version_len = 0, release_len = 0, arch_len = 0, os_len = 0;
-+ int name_len = 0, version_len = 0, release_len = 0,
-+ arch_len = 0, os_len = 0, fn_len = 0;
- char *buf;
- int len;
-
-@@ -80,6 +84,11 @@
- os_len = strlen(os);
- len += os_len + 1;
- }
-+
-+ if (fn) {
-+ fn_len = strlen(fn);
-+ len += fn_len + 1;
-+ }
-
- pkg = pkg_alloc_fn(sizeof(*pkg) + len);
- memset(pkg, 0, sizeof(*pkg));
-@@ -122,6 +131,14 @@
- buf += os_len;
- *buf++ = '\0';
- }
-+
-+ pkg->fn = NULL;
-+ if (fn) {
-+ pkg->fn = buf;
-+ memcpy(buf, fn, fn_len);
-+ buf += fn_len;
-+ *buf++ = '\0';
-+ }
-
- pkg->reqs = NULL;
- pkg->caps = NULL;
-@@ -253,10 +270,11 @@
-
- if (!headerGetEntry(h, RPMTAG_BUILDTIME, &type, (void *)&btime, NULL))
- btime = NULL;
--
-- pkg = pkg_new(name, epoch ? *epoch : 0, version, release, arch, os,
-+
-+ pkg = pkg_new(name, epoch ? *epoch : 0, version, release, arch, os,
-+ fname ? n_basenam(fname) : NULL,
- size ? *size : 0, fsize, btime ? *btime : 0);
--
-+
- if (pkg == NULL)
- return NULL;
-
-@@ -698,7 +716,27 @@
-
- if ((strcmp(capreq_name(cap), capreq_name(req))) != 0)
- return 0;
--
-+
-+ if (capreq_has_epoch(cap)) {
-+ if (!capreq_has_epoch(req) && poldek_conf_promote_epoch) {
-+ if (verbose > 1)
-+ logn(LOGWARN, "req '%s' needs an epoch (assuming same epoch as %s)\n",
-+ capreq_snprintf_s(req), capreq_snprintf_s0(cap));
-+ cmprc = 0;
-+
-+ } else {
-+ cmprc = capreq_epoch(cap) - capreq_epoch(req);
-+ if (cmprc != 0)
-+ return rel_match(cmprc, req);
-+ }
-+ evr = 1;
-+
-+ } else if (capreq_epoch(req) > 0) { /* always promote cap's epoch */
-+ cmprc = 0;
-+ evr = 1;
-+ }
-+
-+#if 0
- if (capreq_has_epoch(req)) {
- if (!capreq_has_epoch(cap))
- return strict == 0;
-@@ -708,7 +746,8 @@
- return rel_match(cmprc, req);
- evr = 1;
- }
--
-+#endif
-+
- if (capreq_has_ver(req)) {
- if (!capreq_has_ver(cap))
- return strict == 0;
-@@ -742,14 +781,22 @@
-
- if (!capreq_versioned(req))
- return 1;
--
-- if (capreq_has_epoch(req) && pkg->epoch) {
-- cmprc = pkg->epoch - capreq_epoch(req);
-- if (cmprc != 0)
-- return rel_match(cmprc, req);
-+
-+ if (pkg->epoch) {
-+ if (!capreq_has_epoch(req) && poldek_conf_promote_epoch) {
-+ if (verbose > 1)
-+ logn(LOGWARN, "req '%s' needs an epoch (assuming same epoch as %s)\n",
-+ capreq_snprintf_s(req), pkg_snprintf_s(pkg));
-+ cmprc = 0;
-+
-+ } else {
-+ cmprc = pkg->epoch - capreq_epoch(req);
-+ if (cmprc != 0)
-+ return rel_match(cmprc, req);
-+ }
- evr = 1;
-
-- } else if (capreq_epoch(req) > 0) {
-+ } else if (capreq_epoch(req) > 0) { /* always promote package's epoch */
- cmprc = 0;
- evr = 1;
- }
-@@ -1198,6 +1245,19 @@
- {
- static char str[256];
- snprintf(str, sizeof(str), "%s-%s-%s", pkg->name, pkg->ver, pkg->rel);
-+ return str;
-+}
-+
-+
-+char *pkg_snprintf_epoch_s(const struct pkg *pkg)
-+{
-+ static char str[256];
-+ char es[16] = {0};
-+
-+ if (pkg->epoch)
-+ snprintf(es, sizeof(es), "%d:", pkg->epoch);
-+
-+ snprintf(str, sizeof(str), "%s-%s%s-%s", pkg->name, es, pkg->ver, pkg->rel);
- return str;
- }
-
-Index: installer/poldek/pkg.h
-diff -u installer/poldek/pkg.h:1.37 installer/poldek/pkg.h:1.37.4.2
---- installer/poldek/pkg.h:1.37 Fri Oct 18 18:19:42 2002
-+++ installer/poldek/pkg.h Tue Dec 30 19:19:52 2003
-@@ -1,4 +1,4 @@
--/* $Id$ */
-+/* $Id$ */
- #ifndef POLDEK_PKG_H
- #define POLDEK_PKG_H
-
-@@ -106,6 +106,7 @@
- char *rel;
- char *arch;
- char *os;
-+ char *fn;
-
- tn_array *caps; /* capabilities */
- tn_array *reqs; /* requirements */
-@@ -143,6 +144,7 @@
- struct pkg *pkg_new(const char *name, int32_t epoch,
- const char *version, const char *release,
- const char *arch, const char *os,
-+ const char *fn,
- uint32_t size, uint32_t fsize,
- uint32_t btime);
-
-@@ -199,6 +201,10 @@
-
- int pkg_eq_capreq(const struct pkg *pkg, const struct capreq *cr);
-
-+
-+
-+extern int poldek_conf_promote_epoch; /* be compatibile with rpm < 4.2.1 */
-+
- /* look up into package caps only */
- int pkg_caps_match_req(const struct pkg *pkg, const struct capreq *req,
- int strict);
-@@ -239,6 +245,9 @@
- char *pkg_snprintf_s(const struct pkg *pkg);
- char *pkg_snprintf_s0(const struct pkg *pkg);
- char *pkg_snprintf_s1(const struct pkg *pkg);
-+
-+
-+char *pkg_snprintf_epoch_s(const struct pkg *pkg);
-
- /* load and returns not loaded file list (l: tag in package index) */
- tn_array *pkg_other_fl(const struct pkg *pkg);
-Index: installer/poldek/pkgdir.c
-diff -u installer/poldek/pkgdir.c:1.39 installer/poldek/pkgdir.c:1.39.4.3
---- installer/poldek/pkgdir.c:1.39 Tue Nov 26 17:32:16 2002
-+++ installer/poldek/pkgdir.c Tue Dec 30 19:19:52 2003
-@@ -11,7 +11,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #ifdef HAVE_CONFIG_H
-@@ -54,6 +54,7 @@
- #include "pkgroup.h"
-
- int pkgdir_v016compat = 0; /* public */
-+int pkgdir_redhat9_zlib_in_rpm_workaround = 0;
-
- #define PKGT_HAS_NAME (1 << 0)
- #define PKGT_HAS_EVR (1 << 1)
-@@ -179,9 +180,12 @@
- static
- int do_open_idx(struct idx_s *idx, char *path, int path_len, int vfmode)
- {
-+ if (pkgdir_redhat9_zlib_in_rpm_workaround)
-+ vfmode |= VFM_UNCOMPR;
-+
- if ((idx->pdg = pdigest_new(path, vfmode, pkgdir_v016compat))) {
- if ((idx->vf = vfile_open(path, VFT_STDIO, vfmode)) == NULL) {
-- if (path_len && strcmp(&path[path_len - 3], ".gz") == 0) {
-+ if (path_len > 3 && strcmp(&path[path_len - 3], ".gz") == 0) {
- path[path_len - 3] = '\0'; /* trim *.gz */
- idx->vf = vfile_open(path, VFT_STDIO, vfmode);
- }
-@@ -1219,9 +1223,9 @@
- break;
-
- default:
-- logn(LOGERR, "%s:%ld: unknown tag '%c'", pkgdir->path, offs, *line);
-- nerr++;
-- goto l_end;
-+ logn(LOGWARN, "%s:%ld: unknown tag '%c' (skipped)",
-+ pkgdir->path, offs, *line);
-+ break;
- }
- }
-
-@@ -1389,7 +1393,7 @@
- return NULL;
- }
-
-- pkg = pkg_new(pkgt->name, epoch, version, release, arch, os,
-+ pkg = pkg_new(pkgt->name, epoch, version, release, arch, os, NULL,
- pkgt->size, pkgt->fsize, pkgt->btime);
- pkg->groupid = pkgt->groupid;
-
-@@ -1457,7 +1461,7 @@
- int32_t epoch = 0;
-
- if (*p && parse_nevr(p, &name, &epoch, &ver, &rel)) {
-- struct pkg *pkg = pkg_new(name, epoch, ver, rel, NULL, NULL,
-+ struct pkg *pkg = pkg_new(name, epoch, ver, rel, NULL, NULL, NULL,
- 0, 0, 0);
- n_array_push(pkgs, pkg);
- }
-Index: installer/poldek/pkgdir.h
-diff -u installer/poldek/pkgdir.h:1.22 installer/poldek/pkgdir.h:1.22.6.1
---- installer/poldek/pkgdir.h:1.22 Sat Aug 24 09:59:11 2002
-+++ installer/poldek/pkgdir.h Sun Dec 7 22:01:53 2003
-@@ -1,4 +1,4 @@
--/* $Id$ */
-+/* $Id$ */
- #ifndef POLDEK_PKGDIR_H
- #define POLDEK_PKGDIR_H
-
-@@ -41,6 +41,7 @@
- };
-
- extern int pkgdir_v016compat;
-+extern int pkgdir_redhat9_zlib_in_rpm_workaround;
-
- struct pkgdir {
- char *name;
-Index: installer/poldek/pkgdir_save.c
-diff -u installer/poldek/pkgdir_save.c:1.8 installer/poldek/pkgdir_save.c:1.8.6.1
---- installer/poldek/pkgdir_save.c:1.8 Mon Jun 10 19:56:34 2002
-+++ installer/poldek/pkgdir_save.c Fri Dec 19 02:29:31 2003
-@@ -7,7 +7,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #ifdef HAVE_CONFIG_H
-@@ -248,8 +248,12 @@
- char suffix[64] = "", tocsuffix[64] = ".toc",
- difftoc_suffix[PATH_MAX] = "";
- const char *orig_pathname;
-- int i, with_toc = 1;
-+ int i, with_toc = 1, vfmode;
-
-+
-+ vfmode = VFM_RW;
-+ if (pkgdir_redhat9_zlib_in_rpm_workaround)
-+ vfmode |= VFM_UNCOMPR;
-
- if ((flags & PKGDIR_CREAT_asCACHE) == 0 &&
- (pkgdir->flags & (PKGDIR_DIFF | PKGDIR_UNIQED)) == 0) {
-@@ -313,14 +317,14 @@
- msgn_f(1, _("Writing %s..."), path);
-
- if (with_toc) {
-- if ((vf_toc = vfile_open(tocpath, VFT_STDIO, VFM_RW)) == NULL)
-+ if ((vf_toc = vfile_open(tocpath, VFT_STDIO, vfmode)) == NULL)
- return 0;
- put_fheader(vf_toc->vf_stream, pdir_poldeksindex_toc, pkgdir);
- }
-
- do_unlink(path);
-
-- if ((vf = vfile_open(path, VFT_STDIO, VFM_RW)) == NULL) {
-+ if ((vf = vfile_open(path, VFT_STDIO, vfmode)) == NULL) {
- if (vf_toc)
- vfile_close(vf_toc);
- return 0;
-@@ -397,8 +401,10 @@
- return 0;
- }
-
-- if ((vf = vfile_open(difftoc_path, VFT_STDIO, VFM_APPEND)) == NULL)
-+ if ((vf = vfile_open(difftoc_path, VFT_STDIO,
-+ vfmode | VFM_APPEND)) == NULL)
- return 0;
-+
- fprintf(vf->vf_stream, "%s %lu %s %lu\n",
- n_basenam(path), pkgdir->ts, pkgdir->mdd_orig, pkgdir->ts_orig);
- vfile_close(vf);
-Index: installer/poldek/pkgroup.c
-diff -u installer/poldek/pkgroup.c:1.10 installer/poldek/pkgroup.c:1.10.6.1
---- installer/poldek/pkgroup.c:1.10 Thu Apr 25 18:34:11 2002
-+++ installer/poldek/pkgroup.c Fri Dec 19 02:19:25 2003
-@@ -7,7 +7,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
- #ifdef HAVE_CONFIG_H
- # include "config.h"
-@@ -246,7 +246,7 @@
- if (fread(&nid, sizeof(nid), 1, stream) != 1)
- return 0;
-
-- if (fread(&nlen, sizeof(nlen), 1, stream) != 1 || nlen > sizeof(name))
-+ if (fread(&nlen, sizeof(nlen), 1, stream) != 1)
- return 0;
-
- if (fread(name, nlen, 1, stream) != 1)
-Index: installer/poldek/pkgset-install.c
-diff -u installer/poldek/pkgset-install.c:1.82 installer/poldek/pkgset-install.c:1.82.4.2
---- installer/poldek/pkgset-install.c:1.82 Sat Nov 16 01:23:22 2002
-+++ installer/poldek/pkgset-install.c Tue Dec 30 19:19:52 2003
-@@ -11,7 +11,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #ifdef HAVE_CONFIG_H
-@@ -224,11 +224,11 @@
-
- if (p != pkg && pkg_is_marked(p)) {
- if (req == NULL || pkg_statisfies_req(p, req, 0)) {
-- DBGF("%s -> yes, %s\n", pkg_snprintf_s0(pkg), pkg_snprintf_s1(p));
-- return 1;
-+ DBGF("%s -> yes, %s\n", pkg_snprintf_s0(pkg), pkg_snprintf_s1(p));
-+ return 1;
-+ }
- }
- }
-- }
-
- return 0;
- }
-@@ -303,7 +303,7 @@
- struct pkg **candidates, int npkgs,
- struct pkgset *ps, struct upgrade_s *upg)
- {
-- int *ncnfls, i, j, i_min, cnfl_min;
-+ int *ncnfls, i, j, i_best, cnfl_min;
- int i_ver_eq = -1, i_evr_eq = -1;
-
- DBGF("%s (%d)\n", pkg_snprintf_s(marker), npkgs);
-@@ -345,38 +345,44 @@
- return i_ver_eq;
-
- cnfl_min = INT_MAX;
-- i_min = -1;
-+ i_best = -1;
- for (i=0; i < npkgs; i++) {
- DBGF("%d. %s %d\n", i, pkg_snprintf_s(candidates[i]), ncnfls[i]);
- if (cnfl_min > ncnfls[i]) {
- cnfl_min = ncnfls[i];
-- i_min = i;
-+ i_best = i;
- }
- }
-
-- DBGF("[after cnfls] i_min = %d\n", i_min);
-+ DBGF("[after cnfls] i_best = %d\n", i_best);
- if (cnfl_min == 0) {
- int n = INT_MAX, *nmarks;
-
- nmarks = alloca(npkgs * sizeof(*nmarks));
-
- for (i=0; i < npkgs; i++) {
-+ if (other_version_marked(candidates[i], ps->pkgs, NULL)) {
-+ DBGF("%d. %s other version is already marked, skipped\n",
-+ i, pkg_snprintf_s(candidates[i]));
-+ continue;
-+ }
-+
- nmarks[i] = pkg_drags(candidates[i], ps, upg);
-- DBGF("%d %s -> %d\n", i, pkg_snprintf_s(candidates[i]), nmarks[i]);
-- if (n > nmarks[i]) {
-+ DBGF("%d. %s -> %d\n", i, pkg_snprintf_s(candidates[i]), nmarks[i]);
-+ if (n > nmarks[i])
- n = nmarks[i];
-- }
--
-+
- if (n == 0 && ncnfls[i] == 0) {
-- i_min = i;
-+ i_best = i;
- break;
- }
- }
- }
-
-- if (i_min == -1)
-- i_min = 0;
-- return i_min;
-+ if (i_best == -1)
-+ i_best = 0;
-+ DBGF("RET %d. %s\n", i_best, pkg_snprintf_s(candidates[i]));
-+ return i_best;
- }
-
- #define FINDREQ_BESTSEL 0
-@@ -1009,7 +1015,7 @@
- capreq_snprintf(reqname, 256, req);
- }
-
-- DBGF("req %s\n", capreq_snprintf_s(req));
-+ DBGF("%s: REQ %s\n", pkg_snprintf_s(pkg), capreq_snprintf_s(req));
-
- if ((upg->inst->flags & INSTS_EQPKG_ASKUSER) && upg->inst->askpkg_fn)
- tomark_candidates_ptr = &tomark_candidates;
-@@ -1022,7 +1028,8 @@
- goto l_end_loop;
- }
- }
--
-+ DBGF("%s: TOMARK %s\n", pkg_snprintf_s1(pkg),
-+ tomark ? pkg_snprintf_s0(tomark) : "NULL");
- /* don't check foreign dependencies */
- if (process_as == PROCESS_AS_ORPHAN) {
- #if 0 /* buggy, TODO - unmark foreign on adding to uninst_set */
-@@ -1854,7 +1861,8 @@
- if (is_installed == 0)
- n_array_push(iinf->uninstalled_pkgs,
- pkg_new(pkg->name, pkg->epoch, pkg->ver, pkg->rel,
-- pkg->arch, pkg->os, pkg->size, pkg->fsize,
-+ pkg->arch, pkg->os, NULL,
-+ pkg->size, pkg->fsize,
- pkg->btime));
- }
-
-Index: installer/poldek/pkgset-merge.c
-diff -u /dev/null installer/poldek/pkgset-merge.c:1.1.2.1
---- /dev/null Fri Jan 9 13:45:49 2004
-+++ installer/poldek/pkgset-merge.c Wed Apr 2 16:54:08 2003
-@@ -0,0 +1,153 @@
-+/*
-+ Copyright (C) 2000 Pawel A. Gajda (mis@k2.net.pl)
-+
-+ This program is free software; you can redistribute it and/or modify
-+ it under the terms of the GNU General Public License published by
-+ the Free Software Foundation (see file COPYING for details).
-+*/
-+
-+/*
-+ $Id$
-+*/
-+
-+#include <limits.h>
-+#include <stdint.h>
-+#include <string.h>
-+#include <errno.h>
-+
-+#include <rpm/rpmlib.h>
-+#include <trurl/nassert.h>
-+#include <trurl/narray.h>
-+#include <trurl/nhash.h>
-+
-+#include "i18n.h"
-+#include "log.h"
-+#include "pkg.h"
-+#include "pkgset.h"
-+#include "misc.h"
-+
-+static
-+int find_replacement(struct pkgset *ps, struct pkg *pkg, struct pkg **rpkg)
-+{
-+ const struct capreq_idx_ent *ent;
-+ struct pkg *bypkg = NULL;
-+
-+
-+ *rpkg = NULL;
-+
-+ if ((bypkg = pkgset_lookup_pkgn(ps, pkg->name)) &&
-+ pkg_cmp_name_evr(bypkg, pkg) > 0) {
-+
-+ *rpkg = bypkg;
-+
-+ } else if ((ent = capreq_idx_lookup(&ps->obs_idx, pkg->name))) {
-+ int i;
-+
-+ for (i=0; i < ent->items; i++) {
-+ if (pkg_caps_obsoletes_pkg_caps(ent->pkgs[i], pkg) &&
-+ pkg_cmp_name_evr(ent->pkgs[i], pkg) > 0) {
-+
-+ *rpkg = ent->pkgs[i];
-+ break;
-+ }
-+ }
-+ }
-+
-+ if (*rpkg && strcmp((*rpkg)->name, pkg->name) != 0 &&
-+ (*rpkg)->caps && pkg->caps) {
-+
-+ int i;
-+ for (i=0; i < n_array_size((*rpkg)->caps); i++) {
-+ struct capreq *cap = n_array_nth((*rpkg)->caps, i);
-+
-+ if (strcmp(capreq_name(cap), (*rpkg)->name) == 0)
-+ continue;
-+
-+ if (capreq_arr_find(pkg->caps, capreq_name(cap))) {
-+ msg(2, "%s is NOT obsoleted by %s (same %s)\n", pkg_snprintf_s(pkg),
-+ pkg_snprintf_s0(*rpkg), capreq_name(cap));
-+ *rpkg = NULL;
-+ break;
-+ }
-+ }
-+ }
-+
-+ return (*rpkg != NULL);
-+}
-+
-+void pkgset_merge(struct pkgset *ps_dst, struct pkgset *ps_src,
-+ unsigned psflags) /* TODO: psflags should be extractable
-+ from existing ps */
-+{
-+ struct pkg *pkg, *rpkg;
-+ tn_array *rm_pkgs, *pkgs;
-+ struct pkgset *ps;
-+ struct pkgdir *pkgdir;
-+ int i;
-+
-+ n_assert(n_array_size(ps_dst->pkgdirs) == 1);
-+
-+ rm_pkgs = pkgs_array_new(1024);
-+ pkgs = pkgs_array_new(n_array_size(ps_dst->pkgdirs));
-+
-+ for (i=0; i < n_array_size(ps_src->pkgs); i++) {
-+ pkg = n_array_nth(ps_src->pkgs, i);
-+ pkg_clr_badreqs(pkg);
-+ n_array_push(pkgs, pkg_link(pkg));
-+ }
-+
-+ for (i=0; i < n_array_size(ps_dst->pkgs); i++) {
-+ pkg = n_array_nth(ps_dst->pkgs, i);
-+ pkg_clr_badreqs(pkg);
-+
-+ if (!find_replacement(ps_src, pkg, &rpkg)) {
-+ n_array_push(pkgs, pkg_link(pkg));
-+
-+ } else {
-+ n_array_push(rm_pkgs, pkg_link(pkg));
-+ n_array_push(rm_pkgs, pkg_link(rpkg));
-+ msg(2, "%s is obsoleted by %s\n", pkg_snprintf_s(pkg),
-+ pkg_snprintf_s0(rpkg));
-+ }
-+ }
-+
-+ ps = pkgset_new(psflags | PSVERIFY_DEPS);
-+ ps->pkgs = n_ref(pkgs);
-+ pkgset_setup(ps, NULL);
-+
-+ pkgdir = n_array_nth(ps_dst->pkgdirs, 0);
-+ for (i=0; i<n_array_size(ps->pkgs); i++) {
-+ pkg = n_array_nth(ps->pkgs, i);
-+ if (pkg_has_badreqs(pkg)) {
-+ if (pkg->pkgdir != pkgdir) {
-+ logn(LOGWARN, "%s: could not be moved\n", pkg_filename_s(pkg));
-+
-+ } else {
-+ logn(LOGWARN, "%s: will be REMOVED from destination\n",
-+ pkg_filename_s(pkg));
-+ printf("merge: rm %s\n", pkg_path_s(pkg));
-+ }
-+ } else if (pkg->pkgdir != pkgdir)
-+ printf("merge: mv %s %s\n", pkg_path_s(pkg), pkgdir->path);
-+ }
-+
-+ while (n_array_size(rm_pkgs)) {
-+ pkg = n_array_shift(rm_pkgs);
-+ rpkg = n_array_shift(rm_pkgs);
-+
-+ if (pkg_has_badreqs(rpkg)) {
-+ logn(LOGWARN, "%s: could not be moved\n", pkg_path_s(pkg));
-+
-+ } else {
-+ printf("merge: rm %s\n", pkg_path_s(pkg));
-+ }
-+
-+
-+ pkg_free(pkg);
-+ pkg_free(rpkg);
-+ }
-+
-+ n_array_free(pkgs);
-+ pkgset_free(ps);
-+}
-+
-Index: installer/poldek/pkgset-req.c
-diff -u installer/poldek/pkgset-req.c:1.23 installer/poldek/pkgset-req.c:1.23.4.1
---- installer/poldek/pkgset-req.c:1.23 Thu Nov 7 17:43:26 2002
-+++ installer/poldek/pkgset-req.c Wed Jul 23 18:15:11 2003
-@@ -7,7 +7,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #include <limits.h>
-@@ -186,7 +186,7 @@
- static int add_reqpkg(struct pkg *pkg, struct capreq *req, struct pkg *dpkg)
- {
- struct reqpkg *rpkg;
-- struct reqpkg tmp_rpkg = {NULL, 0, {NULL}};
-+ struct reqpkg tmp_rpkg = {NULL, 0};
-
- tmp_rpkg.pkg = dpkg;
- rpkg = n_array_bsearch(pkg->reqpkgs, &tmp_rpkg);
-@@ -368,7 +368,7 @@
- int isneq;
- uint8_t flags;
- struct reqpkg *rpkg;
-- struct reqpkg tmp_rpkg = {NULL, 0, {NULL}};
-+ struct reqpkg tmp_rpkg = {NULL, 0};
-
- flags = 0;
- flags |= capreq_is_prereq(req) ? REQPKG_PREREQ : 0;
-Index: installer/poldek/pkgset.h
-diff -u installer/poldek/pkgset.h:1.37 installer/poldek/pkgset.h:1.37.4.1
---- installer/poldek/pkgset.h:1.37 Thu Nov 14 19:21:42 2002
-+++ installer/poldek/pkgset.h Wed Apr 2 16:54:08 2003
-@@ -1,4 +1,4 @@
--/* $Id$ */
-+/* $Id$ */
- #ifndef POLDEK_PKGSET_H
- #define POLDEK_PKGSET_H
-
-@@ -120,6 +120,10 @@
- void pkgset_free(struct pkgset *ps);
-
- int pkgset_setup(struct pkgset *ps, const char *pri_fpath);
-+
-+/* --merge */
-+void pkgset_merge(struct pkgset *ps_dst, struct pkgset *ps_src,
-+ unsigned psflags);
-
- /* returns sorted list of packages, free it by n_array_free() */
- tn_array *pkgset_getpkgs(const struct pkgset *ps);
-Index: installer/poldek/poldek.spec.in
-diff -u installer/poldek/poldek.spec.in:1.20 installer/poldek/poldek.spec.in:1.20.4.1
---- installer/poldek/poldek.spec.in:1.20 Thu Nov 7 18:41:07 2002
-+++ installer/poldek/poldek.spec.in Wed Jul 23 19:04:16 2003
-@@ -1,4 +1,4 @@
--# $Revision$, $Date$
-+# $Revision$, $Date$
- #
- # spec is based on PLD's poldek.spec available at <http://cvs.pld.org.pl/SPECS/>
- #
-@@ -14,16 +14,16 @@
- Group: Applications/System
- Source0: http://team.pld.org.pl/~mis/poldek/download/%{name}-%{version}.tar.bz2
- URL: http://team.pld.org.pl/~mis/poldek/
--Requires: /bin/rpm
-+#Requires: /bin/rpm
- BuildRequires: bzip2-devel
--BuildRequires: db3-devel >= 3.1.14-2
-+#BuildRequires: db3-devel >= 3.1.14-2
- #BuildRequires: curl-devel >= 7.8
- BuildRequires: rpm-devel >= 4.0
- #BuildRequires: popt-static
- BuildRequires: openssl-devel
- BuildRequires: readline-devel
- BuildRequires: zlib-devel
--BuildRequires: /usr/bin/pod2man
-+#BuildRequires: /usr/bin/pod2man
- BuildRequires: pcre-devel
- %{?_with_static:BuildRequires: bzip2-static}
- %{?_with_static:BuildRequires: curl-static}
-@@ -78,6 +78,9 @@
- All persons listed below can be reached at <cvs_login>@pld.org.pl
-
- $Log$
-+Revision 1.20.4.1 2003/07/23 17:04:16 mis
-+- removed unneeded dependencies
-+
- Revision 1.20 2002/11/07 17:41:07 mis
- - used tar.bz2 source
-
-Index: installer/poldek/rpm.c
-diff -u installer/poldek/rpm.c:1.41 installer/poldek/rpm.c:1.41.4.1
---- installer/poldek/rpm.c:1.41 Fri Nov 22 18:07:26 2002
-+++ installer/poldek/rpm.c Sun Dec 7 21:58:15 2003
-@@ -11,7 +11,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #ifdef HAVE_CONFIG_H
-@@ -188,10 +188,10 @@
- while((dbrec = rpmdb_it_get(&it)) != NULL) {
- if (dbpkg_array_has(unistdbpkgs, dbrec->recno) ||
- dbpkg_array_has(cnfldbpkgs, dbrec->recno))
-- continue;
-+ continue;
-
- n_array_push(cnfldbpkgs, dbpkg_new(dbrec->recno, dbrec->h, ldflags));
-- break;
-+ break;
- }
- rpmdb_it_destroy(&it);
-
-@@ -215,12 +215,12 @@
- rpmdb_it_init(db, &it, RPMITER_NAME, capreq_name(req));
- while ((dbrec = rpmdb_it_get(&it)) != NULL) {
- if (dbpkg_array_has(unistdbpkgs, dbrec->recno))
-- continue;
-+ continue;
-
- if (header_evr_match_req(dbrec->h, req)) {
-- rc = 1;
-- break;
-- }
-+ rc = 1;
-+ break;
-+ }
- }
- rpmdb_it_destroy(&it);
-
-@@ -237,9 +237,9 @@
- rpmdb_it_init(db, &it, RPMITER_FILE, capreq_name(req));
- while ((dbrec = rpmdb_it_get(&it)) != NULL) {
- if (dbpkg_array_has(unistdbpkgs, dbrec->recno))
-- continue;
-- finded = 1;
-- break;
-+ continue;
-+ finded = 1;
-+ break;
- }
- rpmdb_it_destroy(&it);
- return finded;
-@@ -288,11 +288,10 @@
- pkg.epoch = 0;
-
- if (pkg_evr_match_req(&pkg, req)) {
-- DBGF("%s[%d] match %s!\n", pkg_snprintf_s(&pkg), pkg.epoch, capreq_snprintf_s0(req));
-+ DBGF("%s[%d] match %s!\n", pkg_snprintf_s(&pkg), pkg.epoch,
-+ capreq_snprintf_s0(req));
- return 1;
- }
--
--
-
- return 0;
- }
-@@ -376,7 +375,7 @@
- rpmdbMatchIterator mi;
- mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0);
- while ((h = rpmdbNextIterator(mi)) != NULL) {
-- unsigned int recno = rpmdbGetIteratorOffset(mi);
-+ unsigned int recno = rpmdbGetIteratorOffset(mi);
- #ifdef HAVE_RPM_4_1 /* omit pubkeys */
- if (headerIsEntry(h, RPMTAG_PUBKEYS))
- continue;
-@@ -385,7 +384,7 @@
- return 0;
-
- mapfn(recno, h, arg);
-- n++;
-+ n++;
- }
- rpmdbFreeIterator(mi);
- #else /* !HAVE_RPM_4_0 */
-@@ -526,17 +525,25 @@
- struct rpmdb_it it;
- const struct dbrec *dbrec;
-
-+
- rpmdb_it_init(db, &it, RPMITER_NAME, pkg->name);
- count = rpmdb_it_get_count(&it);
- if (count > 0 && (cmprc || dbrecp)) {
- dbrec = rpmdb_it_get(&it);
--
-- if (cmprc)
-- *cmprc = -hdr_pkg_cmp_evr(dbrec->h, pkg);
--
-- if (dbrecp) {
-- dbrecp->recno = dbrec->recno;
-- dbrecp->h = headerLink(dbrec->h);
-+
-+ if (dbrec == NULL) {
-+ log(LOGWARN, _("%s: rpm iterator returns NULL"
-+ " (corrupted RPM database?). Ignored"), pkg->name);
-+ count = 0; /* assume that package isn't installed */
-+
-+ } else {
-+ if (cmprc)
-+ *cmprc = -hdr_pkg_cmp_evr(dbrec->h, pkg);
-+
-+ if (dbrecp) {
-+ dbrecp->recno = dbrec->recno;
-+ dbrecp->h = headerLink(dbrec->h);
-+ }
- }
- }
-
-Index: installer/poldek/rpm_signature.c
-diff -u installer/poldek/rpm_signature.c:1.4 installer/poldek/rpm_signature.c:1.4.4.2
---- installer/poldek/rpm_signature.c:1.4 Fri Oct 18 12:34:03 2002
-+++ installer/poldek/rpm_signature.c Wed Jul 16 12:49:28 2003
-@@ -11,7 +11,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #ifdef HAVE_CONFIG_H
-@@ -56,8 +56,10 @@
-
- static int rpm_read_signature(FD_t fd, Header *sighp, int sig_type)
- {
--#ifdef HAVE_RPM_4_1
-- return rpmReadSignature(fd, sighp, sig_type) == 0;
-+#ifdef HAVE_RPM_4_2
-+ return rpmReadSignature(fd, sighp, sig_type, NULL) == 0;
-+#elif HAVE_RPM_4_1
-+ return rpmReadSignature(fd, sighp, sig_type, NULL) == 0;
- #elif HAVE_RPM_4_0
- return rpmReadSignature(fd, sighp, sig_type, NULL) == 0;
- #endif
-Index: installer/poldek/rpmadds.c
-diff -u installer/poldek/rpmadds.c:1.8 installer/poldek/rpmadds.c:1.8.4.1
---- installer/poldek/rpmadds.c:1.8 Thu Nov 7 17:43:26 2002
-+++ installer/poldek/rpmadds.c Tue Apr 15 19:03:02 2003
-@@ -11,7 +11,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #ifdef HAVE_CONFIG_H
-@@ -34,15 +34,17 @@
- #include "misc.h"
- #include "log.h"
-
--
- int rpm_headerReadFD(FD_t fdt, Header *hdr, const char *path)
- {
- int rc = 0;
-
--#ifdef HAVE_RPM_4_1
-+#ifndef HAVE_RPM_4_1
-+ rc = rpmReadPackageHeader(fdt, hdr, NULL, NULL, NULL);
-+#else
- rpmRC rpmrc;
- rpmts ts = rpmtsCreate();
-
-+ rpmtsSetVSFlags(ts, RPMVSF_NODSA | RPMVSF_NORSA | RPMVSF_NOMD5);
- rpmrc = rpmReadPackageFile(ts, fdt, path, hdr);
- switch (rpmrc) {
- case RPMRC_NOTTRUSTED:
-@@ -54,18 +56,12 @@
- default:
- rc = 1;
- }
--
--#else
-- rc = rpmReadPackageHeader(fdt, hdr, NULL, NULL, NULL);
-+ rpmtsFree(ts);
- #endif
--
-+
- if (rc != 0)
- logn(LOGERR, _("%s: read header failed"), path);
-
--#ifdef HAVE_RPM_4_1
-- rpmtsFree(ts);
--#endif
--
- return rc == 0;
- }
-
-Index: installer/poldek/rpmvercmp.c
-diff -u installer/poldek/rpmvercmp.c:1.5 installer/poldek/rpmvercmp.c:1.5.6.1
---- installer/poldek/rpmvercmp.c:1.5 Mon May 13 22:27:17 2002
-+++ installer/poldek/rpmvercmp.c Tue Dec 30 19:15:08 2003
-@@ -1,4 +1,5 @@
- #include <stdio.h>
-+#include <string.h>
- #include <stdlib.h>
- #include <rpm/rpmlib.h>
-
-Index: installer/poldek/test_match.c
-diff -u installer/poldek/test_match.c:1.8 installer/poldek/test_match.c:1.8.4.1
---- installer/poldek/test_match.c:1.8 Thu Nov 7 17:43:26 2002
-+++ installer/poldek/test_match.c Fri Dec 19 02:29:31 2003
-@@ -7,7 +7,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
- #include <stdio.h>
- #include <stdlib.h>
-@@ -26,7 +26,7 @@
- #include "misc.h"
- #include "rpm.h"
-
--int test_match(int argc, char *argv[])
-+int old_test_match(int argc, char *argv[])
- {
- struct pkg *pkg;
- struct capreq *req;
-@@ -54,7 +54,7 @@
- int rc1, rc2;
- char evr[255];
-
-- snprintf(evr, sizeof(evr), "1:1.1");
-+ snprintf(evr, sizeof(evr), "0:1.1");
- req = capreq_new_evr("poldek", n_strdup(evr), rels[k++], 0);
-
- rc1 = pkg_match_req(pkg, req, 1) ? 1:0;
-@@ -73,49 +73,54 @@
- return 0;
- }
-
--int test_match_(int epoch, char *ver, char *rel, char *evr, int relation)
-+
-+int test_match(int epoch, char *ver, char *rel, char *evr, int relation)
- {
- struct pkg *pkg;
-- struct capreq *req;
-- int rc1;
-+ struct capreq *req, *cap;
-+ int rc;
-
- pkg = pkg_new("poldek", epoch, ver, rel, NULL, NULL, 0, 0, 0);
-+ cap = capreq_new("poldek", epoch, ver, rel, REL_EQ, 0);
-
- req = capreq_new_evr("poldek", n_strdup(evr), relation, 0);
-
-- rc1 = pkg_match_req(pkg, req, 1) ? 1:0;
-- printf("P %s[%d] match %s ? %s\n", pkg_snprintf_s(pkg),
-- pkg->epoch, capreq_snprintf_s(req),
-- rc1 ? "YES" : "NO");
-+ rc = pkg_match_req(pkg, req, 1) ? 1:0;
-+ printf("pkg %s match req %s ? %s\n", pkg_snprintf_epoch_s(pkg),
-+ capreq_snprintf_s(req), rc ? "YES" : "NO");
-+
-+ rc = cap_match_req(cap, req, 1) ? 1:0;
-+ printf("cap %s match req %s ? %s\n", capreq_snprintf_s0(cap),
-+ capreq_snprintf_s(req), rc ? "YES" : "NO");
-
- return 1;
- }
-
-
--int test_match2(void)
-+int dotest(void)
- {
- printf("\n");
-- test_match_(0, "1.2", "1", "0:1.1", REL_GT);
-- test_match_(3, "1.2", "1", "0:1.1", REL_GT);
-- test_match_(0, "1.2", "1", "3:1.1", REL_GT);
-+ test_match(1, "5.8.2", "2", "0:5.00403", REL_GT);
-+ test_match(3, "1.2", "1", "0:1.1", REL_GT);
-+ test_match(0, "1.2", "1", "3:1.1", REL_GT);
- printf("\n");
-- test_match_(0, "1.2", "1", "1:1.1", REL_GT);
-- test_match_(1, "1.2", "1", "0:1.1", REL_GT);
-+ test_match(0, "1.2", "1", "1:1.1", REL_GT);
-+ test_match(1, "1.2", "1", "0:1.1", REL_GT);
-
- printf("\n");
-- test_match_(0, "1.2", "1", "0:1.2", REL_EQ);
-- test_match_(3, "1.2", "1", "0:1.2", REL_EQ);
-- test_match_(0, "1.2", "1", "3:1.2", REL_EQ);
-+ test_match(0, "1.2", "1", "0:1.2", REL_EQ);
-+ test_match(3, "1.2", "1", "0:1.2", REL_EQ);
-+ test_match(0, "1.2", "1", "3:1.2", REL_EQ);
- printf("\n");
-- test_match_(0, "1.2", "1", "1:1.2", REL_EQ);
-- test_match_(1, "1.2", "1", "0:1.2", REL_EQ);
-+ test_match(0, "1.2", "1", "1:1.2", REL_EQ);
-+ test_match(1, "1.2", "1", "0:1.2", REL_EQ);
-
- printf("\n");
-- test_match_(0, "1.2", "1", "1:2.2", REL_EQ | REL_GT);
-- test_match_(1, "1.2", "1", "1:1.2", REL_EQ | REL_GT);
-- test_match_(1, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
-- test_match_(2, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
-- test_match_(3, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
-+ test_match(0, "1.2", "1", "1:2.2", REL_EQ | REL_GT);
-+ test_match(1, "1.2", "1", "1:1.2", REL_EQ | REL_GT);
-+ test_match(1, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
-+ test_match(2, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
-+ test_match(3, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
- return 0;
- }
-
-@@ -136,8 +141,12 @@
- int main(int argc, char *argv[])
- {
- rpmdb db;
-- //test_expand_env(argc, argv);
-- //test_match2();
-+ log_init(NULL, stdout, "");
-+
-+ if (argc > 1 && strcmp(argv[1], "--promote") == 0)
-+ poldek_conf_promote_epoch = 1;
-+ dotest();
-+ exit(0);
- log_init(NULL, stdout, "aa");
- rpm_initlib(NULL);
- db = rpm_opendb("/var/lib/rpm", "/", O_RDONLY);
-Index: installer/poldek/usrset.c
-diff -u installer/poldek/usrset.c:1.12 installer/poldek/usrset.c:1.12.6.1
---- installer/poldek/usrset.c:1.12 Thu Apr 25 18:34:12 2002
-+++ installer/poldek/usrset.c Tue Dec 30 19:19:52 2003
-@@ -7,7 +7,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #include <ctype.h>
-@@ -184,7 +184,7 @@
- if (release == NULL)
- release = "";
-
-- pdef->pkg = pkg_new(name, epoch, version, release, NULL, NULL,
-+ pdef->pkg = pkg_new(name, epoch, version, release, NULL, NULL, NULL,
- 0, 0, 0);
- }
-
-Index: installer/poldek/vfcompr
-diff -u /dev/null installer/poldek/vfcompr:1.1.2.1
---- /dev/null Fri Jan 9 13:45:49 2004
-+++ installer/poldek/vfcompr Fri Dec 19 02:29:31 2003
-@@ -0,0 +1,77 @@
-+#! /bin/sh
-+# $Id$
-+
-+PATH="/bin:/sbin:/usr/bin:/usr/sbin"
-+
-+compr() {
-+ typeset src=$1
-+ typeset dest=$2
-+
-+ cmd="bzip2 --stdout ${src}"
-+ if echo ${dest} | egrep ".gz" >/dev/null; then
-+ cmd="gzip -9nf --stdout ${src}"
-+ fi
-+ echo "$cmd > $dest"
-+ $cmd > $dest && rm -f $src
-+}
-+
-+uncompr() {
-+ typeset src=$1
-+ typeset dest=$2
-+
-+ cmd="bunzip2 --keep --stdout ${src}"
-+ if echo ${src} | egrep ".gz" >/dev/null; then
-+ cmd="gunzip --stdout ${src}"
-+ fi
-+ echo "$cmd > $dest"
-+ #echo -e "$cmd\n -> ${dest}"
-+ $cmd > ${dest}
-+}
-+
-+usage() {
-+ echo "usage: `basename $0` FILE DESTFILE[.gz][.bz2]"
-+ echo " `basename $0` -d FILE DESTFILE[.gz][.bz2]"
-+}
-+
-+if [ "$#" -lt 2 ]; then
-+ usage
-+ exit 0
-+fi
-+
-+un=$1
-+if [ "$un" == "-d" ]; then
-+ src=$2
-+ if [ "$#" -lt 3 ]; then
-+ usage
-+ exit 1
-+ fi
-+ dest=$3
-+else
-+ src=$1
-+ dest=$2
-+ un=""
-+fi
-+
-+
-+#if [ ! -r $src -o ! -f $src ]; then
-+# echo "$src: no such file"
-+# exit 1
-+#fi
-+
-+if [ -r $dest ]; then
-+ echo "$dest: file exists"
-+ exit 1
-+fi
-+
-+
-+if [ $dest == $src ]; then
-+ echo "dest and src are the same"
-+ exit 1
-+fi
-+
-+if [ -z "$un" ]; then
-+ compr $src $dest
-+else
-+ uncompr $src $dest
-+fi
-+
-Index: installer/poldek/vfuncompr
-diff -u installer/poldek/vfuncompr:1.1 installer/poldek/vfuncompr:removed
---- installer/poldek/vfuncompr:1.1 Mon Apr 8 03:14:41 2002
-+++ installer/poldek/vfuncompr Fri Jan 9 13:45:49 2004
-@@ -1,38 +0,0 @@
--#! /bin/sh
--# $Id$
--
--PATH="/bin:/sbin:/usr/bin:/usr/sbin"
--
--if [ "$#" != "2" ]; then
-- echo "usage: `basename $0` FILE[.gz][.bz2] DESTFILE"
-- exit 1
--fi
--
--src=$1
--dest=$2
--
--cmd="bunzip2 --keep --stdout ${src}"
--if echo ${src} | egrep ".gz" >/dev/null; then
-- cmd="gunzip --stdout ${src}"
--fi
--
--if [ ! -r $src -o ! -f $src ]; then
-- echo "$src: no such file"
-- exit 1
--fi
--
--if [ -r $dest ]; then
-- echo "$dest: file exists"
-- exit 1
--fi
--
--if [ $dest == $src ]; then
-- echo "dest and src are the same"
-- exit 1
--fi
--
--
--echo -e "$cmd\n -> ${dest}"
--$cmd > ${dest}
--
--
-Index: installer/poldek/conf/rh.src
-diff -u installer/poldek/conf/rh.src:1.4 installer/poldek/conf/rh.src:1.4.6.1
---- installer/poldek/conf/rh.src:1.4 Mon Jun 3 17:27:04 2002
-+++ installer/poldek/conf/rh.src Thu Sep 18 01:43:01 2003
-@@ -1,21 +1,21 @@
--# $Id$
-+# $Id$
-
-+# RedHat 9
-+source1 = rh,noautoup,type=hdrl,pri=-1 \
-+ ftp://ftp.uninett.no/pub/linux/apt/redhat/9/en/i386/redhat/base/pkglist.os.bz2
-
--# RedHat 7.3; package info is taken from hdlist file
--source1 = rh,noautoup,type=hdrl \
-- ftp://ftp.redhat.com/pub/redhat/redhat-7.3-en/os/i386/RedHat/base/hdlist
-+prefix1 = ftp://ftp.uninett.no/pub/linux/apt/redhat/9/en/i386/redhat/RPMS.os
-
--prefix1 = ftp://ftp.redhat.com/pub/redhat/redhat-7.3-en/os/i386/RedHat/RPMS/
-+source2 = rh-up,noautoup,type=hdrl,pri=-1 \
-+ ftp://ftp.uninett.no/pub/linux/apt/redhat/9/en/i386/redhat/base/pkglist.updates-os.bz2
-
-+prefix2 = ftp://ftp.uninett.no/pub/linux/apt/redhat/9/en/i386/redhat/RPMS.updates-os
-
--# RedHat 7.2; package info is taken from hdlist file
--source2 = rh7.2,noautoup,type=hdrl \
-- ftp://ftp.redhat.com/pub/redhat/redhat-7.2-en/os/i386/RedHat/base/hdlist
-
--prefix2 = ftp://ftp.redhat.com/pub/redhat/redhat-7.2-en/os/i386/RedHat/RPMS/
-
--# RedHat 6.2
--source3 = rh6.2,noautoup,noauto,type=hdrl \
-- ftp://ftp.redhat.com/pub/redhat/redhat-6.2-en/os/i386/RedHat/base/hdlist
-+# RedHat 8
-+source8 = rh8,noautoup,noauto,type=hdrl \
-+ ftp://ftp.uninett.no/pub/linux/apt/redhat/8.0/en/i386/redhat/base/pkglist.os.bz2
-+
-+prefix8 = ftp://ftp.uninett.no/pub/linux/apt/redhat/8.0/en/i386/redhat/RPMS.os
-
--prefix3 = ftp://ftp.redhat.com/pub/redhat/redhat-6.2-en/os/i386/RedHat/RPMS/
-Index: installer/poldek/shell/desc.c
-diff -u installer/poldek/shell/desc.c:1.18 installer/poldek/shell/desc.c:1.18.4.1
---- installer/poldek/shell/desc.c:1.18 Thu Nov 7 17:43:28 2002
-+++ installer/poldek/shell/desc.c Sun Dec 7 22:30:46 2003
-@@ -7,7 +7,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #include <time.h>
-@@ -665,6 +665,7 @@
- char unit = 'K';
- const char *group;
- double pkgsize;
-+ time_t tmpt;
-
-
- if ((pkgu = pkg_info(pkg)) == NULL) {
-@@ -674,10 +675,11 @@
- }
-
-
-- if (pkg->btime)
-+ if (pkg->btime) {
-+ tmpt = pkg->btime;
- strftime(timbuf, sizeof(timbuf), "%Y/%m/%d %H:%M",
-- localtime((time_t*)&pkg->btime));
-- else
-+ localtime(&tmpt));
-+ } else
- *timbuf = '\0';
-
- if (pkgu->summary) {
-Index: installer/poldek/shell/ls.c
-diff -u installer/poldek/shell/ls.c:1.20 installer/poldek/shell/ls.c:1.20.4.1
---- installer/poldek/shell/ls.c:1.20 Thu Nov 7 17:43:28 2002
-+++ installer/poldek/shell/ls.c Sun Dec 7 22:30:46 2003
-@@ -7,7 +7,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
-
- #include <string.h>
-@@ -393,6 +393,7 @@
- char sizbuf[30];
- char unit = 'K';
- double pkgsize = pkg->size/1024;
-+ time_t tmpt;
-
- if (pkgsize >= 1024) {
- pkgsize /= 1024;
-@@ -401,10 +402,11 @@
-
- snprintf(sizbuf, sizeof(sizbuf), "%.1f %cB", pkgsize, unit);
-
-- if (pkg->btime)
-+ if (pkg->btime) {
-+ tmpt = pkg->btime;
- strftime(timbuf, sizeof(timbuf), "%Y/%m/%d %H:%M",
-- localtime((time_t*)&pkg->btime));
-- else
-+ localtime(&tmpt));
-+ } else
- *timbuf = '\0';
-
- if ((flags & OPT_LS_UPGRADEABLE) == 0) {
-Index: installer/poldek/vfile/uncompr.c
-diff -u installer/poldek/vfile/uncompr.c:1.2 installer/poldek/vfile/uncompr.c:1.2.6.1
---- installer/poldek/vfile/uncompr.c:1.2 Wed Apr 17 00:33:40 2002
-+++ installer/poldek/vfile/uncompr.c Fri Dec 19 02:16:56 2003
-@@ -10,7 +10,7 @@
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
--/* $Id$ */
-+/* $Id$ */
-
- #include <ctype.h>
- #include <errno.h>
-@@ -44,8 +44,8 @@
- };
-
- struct uncompr uncompr_tab[] = {
-- { COMPRESST_BZIP2, "/usr/bin/vfuncompr", "bz2" },
-- { COMPRESST_GZIP, "/usr/bin/vfuncompr", "gz" },
-+ { COMPRESST_BZIP2, "/usr/bin/vfcompr", "bz2" },
-+ { COMPRESST_GZIP, "/usr/bin/vfcompr", "gz" },
- { 0, NULL, NULL }
- };
-
-@@ -101,7 +101,8 @@
-
-
- static
--int vf_do_uncompr(struct uncompr *uncompr, const char *src, const char *dst)
-+int vf_do_compr(struct uncompr *uncompr, const char *param,
-+ const char *src, const char *dst)
- {
- char **argv;
- struct p_open_st pst;
-@@ -112,16 +113,15 @@
- argv = alloca(sizeof(*argv) * 10);
- n = 0;
- argv[n++] = uncompr->cmd;
-+ if (param)
-+ argv[n++] = (char*)param;
-+
- argv[n++] = (char*)src;
- argv[n++] = (char*)dst;
- argv[n++] = NULL;
-
-- if (*vfile_verbose)
-- vfile_msg_fn(_("Uncompressing %s...\n"), n_basenam(src));
--
- p_st_init(&pst);
-
--
- verbose = *vfile_verbose;
- if (p_open(&pst, p_open_flags, uncompr->cmd, argv) == NULL) {
- vfile_err_fn("p_open: %s\n", pst.errmsg);
-@@ -185,8 +185,36 @@
- return -1;
-
- vf_localunlink(destpath);
-+ if (*vfile_verbose)
-+ vfile_msg_fn(_("Uncompressing %s...\n"), n_basenam(path));
-+ return vf_do_compr(uncompr, "-d", path, destpath);
-+}
-+
-+
-+int vf_compr_do(const char *path, const char *ext)
-+{
-+ struct uncompr *uncompr;
-+ char destpath[PATH_MAX];
-+ int i;
-+
-
-- return vf_do_uncompr(uncompr, path, destpath);
-+ uncompr = NULL;
-+ i = 0;
-+ while (uncompr_tab[i].type > 0) {
-+ if (strcmp(ext, uncompr_tab[i].ext) == 0)
-+ uncompr = &uncompr_tab[i];
-+ i++;
-+ }
-+
-+
-+ if (uncompr == NULL)
-+ return -1;
-+
-+ snprintf(destpath, sizeof(destpath), "%s.%s", path, ext);
-+ unlink(destpath);
-+ if (*vfile_verbose)
-+ vfile_msg_fn(_("Compressing %s...\n"), n_basenam(path));
-+ return vf_do_compr(uncompr, NULL, path, destpath);
- }
-
-
-Index: installer/poldek/vfile/vfile.c
-diff -u installer/poldek/vfile/vfile.c:1.43 installer/poldek/vfile/vfile.c:1.43.4.2
---- installer/poldek/vfile/vfile.c:1.43 Tue Oct 29 17:55:56 2002
-+++ installer/poldek/vfile/vfile.c Mon Dec 29 21:11:14 2003
-@@ -11,7 +11,7 @@
- */
-
- /*
-- $Id$
-+ $Id$
- */
- #ifdef HAVE_CONFIG_H
- # include "config.h"
-@@ -491,8 +491,19 @@
- rpath = path;
-
- if (vfmode & VFM_UNCOMPR) {
-- if ((rpath = vfuncompr(path, buf, sizeof(buf))) == NULL)
-- return 0;
-+ if (vfmode & VFM_RW) {
-+ if (vf_uncompr_able(path)) {
-+ char *p;
-+ n_snprintf(buf, sizeof(buf), path);
-+ p = strrchr(buf, '.');
-+ n_assert(p);
-+ *p = '\0';
-+ rpath = buf;
-+ }
-+ } else {
-+ if ((rpath = vfuncompr(path, buf, sizeof(buf))) == NULL)
-+ return 0;
-+ }
- }
-
- if (openvf(&vf, rpath, vfmode))
-@@ -646,6 +657,18 @@
- n_assert(0);
- }
-
-+ if (vf->vf_path && (vf->vf_mode & VFM_UNCOMPR) && (vf->vf_mode & VFM_RW)) {
-+ if (vf_uncompr_able(vf->vf_path)) {
-+ char src[PATH_MAX], *p;
-+ snprintf(src, sizeof(src), vf->vf_path);
-+ p = strrchr(src, '.');
-+ n_assert(p);
-+ *p = '\0';
-+ vf_compr_do(src, "gz");
-+ }
-+
-+ }
-+
- if (vf->vf_path) {
- free(vf->vf_path);
- vf->vf_path = NULL;
-Index: installer/poldek/vfile/vfile.h
-diff -u installer/poldek/vfile/vfile.h:1.29 installer/poldek/vfile/vfile.h:1.29.4.1
---- installer/poldek/vfile/vfile.h:1.29 Thu Nov 7 17:43:29 2002
-+++ installer/poldek/vfile/vfile.h Fri Dec 19 02:16:56 2003
-@@ -10,7 +10,7 @@
- 59 Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
--/* $Id$ */
-+/* $Id$ */
-
- #ifndef POLDEK_VFILE_H
- #define POLDEK_VFILE_H
-@@ -195,6 +195,7 @@
-
-
- int vf_uncompr_able(const char *path);
-+int vf_compr_do(const char *path, const char *ext);
- int vf_uncompr_do(const char *path, const char *destpath);
-
- void vf_sigint_cb(void);
+++ /dev/null
---- poldek-0.18.6.orig/conf.c 2004-09-15 16:03:02.000000000 +0000
-+++ poldek-0.18.6/conf.c 2004-09-15 18:56:34.000000000 +0000
-@@ -83,6 +83,7 @@
- { "ftp_sysuser_as_anon_passwd", TYPE_BOOL , { 0 } },
- { "vfile_external_compress", TYPE_BOOL, { 0 } },
- { "promoteepoch", TYPE_BOOL, { 0 } },
-+ { "nodistver", TYPE_BOOL, { 0 } },
- { NULL, 0, { 0 } },
- };
-
---- poldek-0.18.6.orig/main.c 2004-09-15 16:03:02.000000000 +0000
-+++ poldek-0.18.6/main.c 2004-09-15 19:32:03.000000000 +0000
-@@ -247,6 +247,7 @@
- #define OPT_ASK 2006
- #define OPT_NOASK 2007
- #define OPT_RPMOPT 2008
-+#define OPT_NODISTVER 2009
- #define OPT_MERGE 2101
- #define OPT_SW_V016 (1 << 0)
- #define OPT_SW_NOASK (1 << 1)
-@@ -459,6 +460,8 @@
-
- {"conf", OPT_CONF, "FILE", 0, N_("Read configuration from FILE"), 500 },
- {"noconf", OPT_NOCONF, 0, 0, N_("Do not read configuration"), 500 },
-+{"nodistver", OPT_NODISTVER, 0, 0, N_("Do not check distribution versions"),
-+ 500 },
-
- {"version", OPT_BANNER, 0, 0, N_("Display program version information and exit"), 500 },
- {"log", OPT_LOG, "FILE", 0, N_("Log program messages to FILE"), 500 },
-@@ -850,6 +853,12 @@
- n_array_push(argsp->inst.rpmacros, arg);
- break;
-
-+ case OPT_NODISTVER:
-+ n_assert(argsp->inst.rpmacros);
-+ n_array_push(argsp->inst.rpmacros,
-+ n_strdup("_dont_compare_distversion 1"));
-+ no_distver=1;
-+ break;
-
- case OPT_INST_FETCH:
- if (arg)
-@@ -1385,6 +1394,15 @@
- if (conf_get_bool(htcnf, "particle_install", 1))
- args.inst.flags |= INSTS_PARTICLE;
-
-+ if (no_distver == 0) { /* no --nodistver specified */
-+ if (conf_get_bool(htcnf, "nodistver", 0))
-+ {
-+ n_assert(args.inst.rpmacros);
-+ n_array_push(args.inst.rpmacros,
-+ n_strdup("_dont_compare_distversion 1"));
-+ no_distver = 1;
-+ }
-+ }
-
- if ((args.inst.flags & INSTS_GREEDY) == 0) { /* no --greedy specified */
- if (conf_get_bool(htcnf, "greedy", 1))
---- poldek-0.18.6.orig/misc.h 2004-06-28 20:19:28.000000000 +0000
-+++ poldek-0.18.6/misc.h 2004-09-15 17:09:29.000000000 +0000
-@@ -11,6 +11,8 @@
- #include <vfile/p_open.h>
- #include <trurl/narray.h>
-
-+extern int no_distver;
-+
- const char *ngettext_n_packages_fmt(int n);
- void translate_argp_options(struct argp_option *arr);
-
---- poldek-0.18.6.orig/pkg.c 2004-09-15 16:03:02.000000000 +0000
-+++ poldek-0.18.6/pkg.c 2004-09-15 17:19:00.000000000 +0000
-@@ -49,13 +49,13 @@
- struct pkg *pkg_new(const char *name, int32_t epoch,
- const char *version, const char *release,
- const char *arch, const char *os,
-- const char *fn,
-+ const char *fn, const char *dist,
- uint32_t size, uint32_t fsize,
- uint32_t btime)
- {
- struct pkg *pkg;
- int name_len = 0, version_len = 0, release_len = 0,
-- arch_len = 0, os_len = 0, fn_len = 0;
-+ arch_len = 0, os_len = 0, fn_len = 0, dist_len = 0;
- char *buf;
- int len;
-
-@@ -85,6 +85,11 @@
- len += os_len + 1;
- }
-
-+ if(dist) {
-+ dist_len = strlen(dist);
-+ len += dist_len + 1;
-+ }
-+
- if (fn && arch) {
- char pkg_fn[1024];
-
-@@ -142,6 +147,14 @@
- *buf++ = '\0';
- }
-
-+ pkg->dist=NULL;
-+ if(dist) {
-+ pkg->dist = buf;
-+ memcpy(buf, dist, dist_len);
-+ buf += dist_len;
-+ *buf++ = '\0';
-+ }
-+
- pkg->fn = NULL;
- if (fn) {
- pkg->fn = buf;
-@@ -248,6 +261,7 @@
- struct pkg *pkg;
- uint32_t *epoch, *size, *btime;
- char *name, *version, *release, *arch = NULL, *os = NULL;
-+ char *dist = NULL;
- int type;
-
- headerNVR(h, (void*)&name, (void*)&version, (void*)&release);
-@@ -267,6 +281,13 @@
- if (type != RPM_STRING_TYPE)
- arch = NULL;
-
-+ if (!headerGetEntry(h, RPMTAG_DISTRIBUTION, &type, (void *)&dist, NULL)) {
-+ dist = NULL;
-+ }
-+
-+ if (type != RPM_STRING_TYPE)
-+ dist = NULL;
-+
- if (!headerGetEntry(h, RPMTAG_OS, &type, (void *)&os, NULL)) {
- if (verbose > 1)
- logn(LOGWARN, _("%s: missing OS tag"), fname);
-@@ -282,7 +303,7 @@
- btime = NULL;
-
- pkg = pkg_new(name, epoch ? *epoch : 0, version, release, arch, os,
-- fname ? n_basenam(fname) : NULL,
-+ fname ? n_basenam(fname) : NULL, dist,
- size ? *size : 0, fsize, btime ? *btime : 0);
-
- if (pkg == NULL)
-@@ -444,6 +465,19 @@
- return pkg_cmp_ver(p1, p2);
- }
-
-+int pkg_cmp_dist_evr(const struct pkg *p1, const struct pkg *p2)
-+{
-+ int rc;
-+
-+ if(p1->dist && p2->dist)
-+ {
-+ rc = rpmdistcmp(p1->dist, p2->dist);
-+ if(rc != 0)
-+ return rc;
-+ }
-+
-+ return pkg_cmp_evr(p1, p2);
-+}
-
- int pkg_cmp_evr(const struct pkg *p1, const struct pkg *p2)
- {
-@@ -487,6 +521,15 @@
- //return rc;
- }
-
-+int pkg_cmp_name_dist_evr_rev(const struct pkg *p1, const struct pkg *p2)
-+{
-+ register int rc;
-+
-+ if ((rc = pkg_cmp_name(p1, p2)))
-+ return rc;
-+
-+ return -pkg_cmp_dist_evr(p1, p2);
-+}
-
- int pkg_cmp_name_evr_rev_srcpri(const struct pkg *p1, const struct pkg *p2)
- {
-@@ -612,6 +655,15 @@
- return pkg_cmp_name_evr_rev(p1, p2);
- }
-
-+int pkg_cmp_dist_pri(struct pkg *p1, struct pkg *p2)
-+{
-+ register int cmprc = 0;
-+
-+ if ((cmprc = p1->pri - p2->pri))
-+ return cmprc;
-+
-+ return pkg_cmp_name_dist_evr_rev(p1, p2);
-+}
-
- int pkg_cmp_btime(struct pkg *p1, struct pkg *p2)
- {
-@@ -1352,8 +1404,12 @@
- {
- tn_array *arr;
-
-- arr = n_array_new(size, (tn_fn_free)pkg_free,
-+ if(no_distver)
-+ arr = n_array_new(size, (tn_fn_free)pkg_free,
- (tn_fn_cmp)pkg_cmp_name_evr_rev);
-+ else
-+ arr = n_array_new(size, (tn_fn_free)pkg_free,
-+ (tn_fn_cmp)pkg_cmp_name_dist_evr_rev);
- n_array_ctl(arr, TN_ARRAY_AUTOSORTED);
- return arr;
- }
---- poldek-0.18.6.orig/pkg.h 2004-03-22 17:31:51.000000000 +0000
-+++ poldek-0.18.6/pkg.h 2004-09-15 16:11:48.000000000 +0000
-@@ -107,6 +107,7 @@
- char *arch;
- char *os;
- char *fn;
-+ char *dist;
-
- tn_array *caps; /* capabilities */
- tn_array *reqs; /* requirements */
-@@ -144,7 +145,7 @@
- struct pkg *pkg_new(const char *name, int32_t epoch,
- const char *version, const char *release,
- const char *arch, const char *os,
-- const char *fn,
-+ const char *fn, const char *dist,
- uint32_t size, uint32_t fsize,
- uint32_t btime);
-
-@@ -181,6 +182,7 @@
- int pkg_cmp_name_evr_rev_srcpri(const struct pkg *p1, const struct pkg *p2);
-
- int pkg_cmp_pri(struct pkg *p1, struct pkg *p2);
-+int pkg_cmp_dist_pri(struct pkg *p1, struct pkg *p2);
-
- int pkg_cmp_btime(struct pkg *p1, struct pkg *p2);
- int pkg_cmp_btime_rev(struct pkg *p1, struct pkg *p2);
---- poldek-0.18.6.orig/pkgdir.c 2004-05-06 07:57:31.000000000 +0000
-+++ poldek-0.18.6/pkgdir.c 2004-09-15 17:52:26.000000000 +0000
-@@ -55,6 +55,7 @@
-
- int pkgdir_v016compat = 0; /* public */
- int pkgdir_redhat9_zlib_in_rpm_workaround = 0;
-+int no_distver = 0;
-
- #define PKGT_HAS_NAME (1 << 0)
- #define PKGT_HAS_EVR (1 << 1)
-@@ -69,6 +70,7 @@
- #define PKGT_HAS_BTIME (1 << 11)
- #define PKGT_HAS_GROUPID (1 << 12)
- #define PKGT_HAS_FN (1 << 13)
-+#define PKGT_HAS_DIST (1 << 14)
-
- struct pkgtags_s {
- unsigned flags;
-@@ -77,6 +79,7 @@
- char arch[64];
- char os[64];
- char fn[1024];
-+ char dist[64];
- uint32_t size;
- uint32_t fsize;
- uint32_t btime;
-@@ -1093,6 +1096,7 @@
- case 'A':
- case 'O':
- case 'n':
-+ case 'D':
- if (!add2pkgtags(&pkgt, *line, val, pkgdir->path, offs)) {
- nerr++;
- goto l_end;
-@@ -1320,6 +1324,16 @@
- }
- break;
-
-+ case 'D':
-+ if (pkgt->flags & PKGT_HAS_DIST) {
-+ logn(LOGERR, errmg_double_tag, pathname, offs, tag);
-+ err++;
-+ } else {
-+ memcpy(pkgt->dist, value, sizeof(pkgt->dist) - 1);
-+ pkgt->dist[ sizeof(pkgt->dist) - 1 ] = '\0';
-+ pkgt->flags |= PKGT_HAS_DIST;
-+ }
-+ break;
-
- case 'S':
- if (pkgt->flags & PKGT_HAS_SIZE) {
-@@ -1393,7 +1407,7 @@
- struct pkg *pkg_new_from_tags(struct pkgtags_s *pkgt)
- {
- struct pkg *pkg;
-- char *version, *release, *arch = NULL, *os = NULL, *fn = NULL;
-+ char *version, *release, *arch = NULL, *os = NULL, *fn = NULL, *dist = NULL;
- int32_t epoch;
-
- if (!(pkgt->flags & (PKGT_HAS_NAME | PKGT_HAS_EVR)))
-@@ -1407,6 +1421,9 @@
-
- if (pkgt->flags & PKGT_HAS_FN)
- fn = pkgt->fn;
-+
-+ if (pkgt->flags & PKGT_HAS_DIST)
-+ dist = pkgt->dist;
-
- if (*pkgt->name == '\0' || *pkgt->evr == '\0' || *pkgt->arch == '\0')
- return NULL;
-@@ -1419,7 +1436,7 @@
- return NULL;
- }
-
-- pkg = pkg_new(pkgt->name, epoch, version, release, arch, os, fn,
-+ pkg = pkg_new(pkgt->name, epoch, version, release, arch, os, fn, dist,
- pkgt->size, pkgt->fsize, pkgt->btime);
- pkg->groupid = pkgt->groupid;
-
-@@ -1488,7 +1505,7 @@
-
- if (*p && parse_nevr(p, &name, &epoch, &ver, &rel)) {
- struct pkg *pkg = pkg_new(name, epoch, ver, rel, NULL, NULL, NULL,
-- 0, 0, 0);
-+ NULL, 0, 0, 0);
- n_array_push(pkgs, pkg);
- }
- }
---- poldek-0.18.6.orig/pkgdir_save.c 2004-05-05 16:56:43.000000000 +0000
-+++ poldek-0.18.6/pkgdir_save.c 2004-09-15 19:28:21.000000000 +0000
-@@ -170,6 +170,9 @@
-
- if (pkg->fn)
- fprintf(stream, "n: %s\n", pkg->fn);
-+
-+ if (pkg->dist && !no_distver)
-+ fprintf(stream, "D: %s\n", pkg->dist);
-
- fprintf(stream, "F:\n");
- store_pkg_fields(stream, pkg->size, pkg->fsize, pkg->btime, pkg->groupid);
---- poldek-0.18.6.orig/pkgset-install.c 2004-09-15 16:03:02.000000000 +0000
-+++ poldek-0.18.6/pkgset-install.c 2004-09-15 17:20:34.000000000 +0000
-@@ -1995,7 +1995,7 @@
- if (is_installed == 0)
- n_array_push(iinf->uninstalled_pkgs,
- pkg_new(pkg->name, pkg->epoch, pkg->ver, pkg->rel,
-- pkg->arch, pkg->os, NULL,
-+ pkg->arch, pkg->os, NULL, NULL,
- pkg->size, pkg->fsize,
- pkg->btime));
- }
-@@ -2186,10 +2186,14 @@
- struct upgrade_s *upg = upgptr;
- struct pkg *pkg, tmpkg;
- uint32_t *epoch;
-- int i, cmprc;
-+ int i, cmprc, type, count;
-
-
- recno = recno;
-+
-+ if (!(headerGetEntry(h, RPMTAG_DISTRIBUTION, &type, (void *)&tmpkg.dist,
-+ &count) && type == RPM_STRING_TYPE && count == 1))
-+ tmpkg.dist=NULL;
-
- if (!rpmhdr_nevr(h, &tmpkg.name, &epoch, &tmpkg.ver, &tmpkg.rel)) {
- logn(LOGERR, _("db package header corrupted (!?)"));
-@@ -2205,7 +2209,10 @@
- }
-
- pkg = n_array_nth(upg->avpkgs, i);
-- cmprc = pkg_cmp_evr(pkg, &tmpkg);
-+ if(no_distver)
-+ cmprc = pkg_cmp_evr(pkg, &tmpkg);
-+ else
-+ cmprc = pkg_cmp_dist_evr(pkg, &tmpkg);
- if (verbose) {
- if (cmprc == 0)
- msg(3, "%-32s up to date\n", pkg_snprintf_s(&tmpkg));
---- poldek-0.18.6.orig/rpm.c 2004-09-15 16:03:02.000000000 +0000
-+++ poldek-0.18.6/rpm.c 2004-09-15 17:24:02.000000000 +0000
-@@ -519,6 +519,36 @@
- return n;
- }
-
-+static
-+int hdr_pkg_cmp_dist_evr(Header h, const struct pkg *pkg)
-+{
-+ int rc;
-+ struct pkg tmpkg;
-+ uint32_t *epoch;
-+ int count;
-+ int type;
-+
-+ if (!(headerGetEntry(h, RPMTAG_DISTRIBUTION, &type, (void *)&tmpkg.dist,
-+ &count) && type == RPM_STRING_TYPE && count == 1))
-+ tmpkg.dist=NULL;
-+
-+ headerNVR(h, (void*)&tmpkg.name, (void*)&tmpkg.ver,
-+ (void*)&tmpkg.rel);
-+
-+ if (tmpkg.name == NULL || tmpkg.ver == NULL || tmpkg.rel == NULL) {
-+ logn(LOGERR, "headerNVR() failed");
-+ return 0;
-+ }
-+
-+ if (headerGetEntry(h, RPMTAG_EPOCH, &rc, (void *)&epoch, NULL))
-+ tmpkg.epoch = *epoch;
-+ else
-+ tmpkg.epoch = 0;
-+
-+ rc = pkg_cmp_dist_evr(&tmpkg, pkg);
-+
-+ return rc;
-+}
-
- static
- int hdr_pkg_cmp_evr(Header h, const struct pkg *pkg)
-@@ -566,7 +596,10 @@
-
- } else {
- if (cmprc)
-- *cmprc = -hdr_pkg_cmp_evr(dbrec->h, pkg);
-+ if(no_distver)
-+ *cmprc = -hdr_pkg_cmp_evr(dbrec->h, pkg);
-+ else
-+ *cmprc = -hdr_pkg_cmp_dist_evr(dbrec->h, pkg);
-
- if (dbrecp) {
- dbrecp->recno = dbrec->recno;
---- poldek-0.18.6.orig/shell/shell.c 2004-09-15 16:03:02.000000000 +0000
-+++ poldek-0.18.6/shell/shell.c 2004-09-15 17:18:04.000000000 +0000
-@@ -997,7 +997,10 @@
- return 0;
-
- if (compare_ver == 0)
-- *cmprc = pkg_cmp_evr(lshpkg->pkg, shpkg->pkg);
-+ if(no_distver)
-+ *cmprc = pkg_cmp_evr(lshpkg->pkg, shpkg->pkg);
-+ else
-+ *cmprc = pkg_cmp_dist_evr(lshpkg->pkg, shpkg->pkg);
- else
- *cmprc = pkg_cmp_ver(lshpkg->pkg, shpkg->pkg);
-
---- poldek-0.18.6.orig/test_match.c 2004-05-05 16:57:09.000000000 +0000
-+++ poldek-0.18.6/test_match.c 2004-09-15 16:11:48.000000000 +0000
-@@ -49,7 +49,7 @@
- struct capreq *cap;
-
- pkg = pkg_new("poldek", epoch, versions[i], relases[j],
-- NULL, NULL, NULL, 0, 0, 0);
-+ NULL, NULL, NULL, NULL, 0, 0, 0);
- cap = capreq_new("poldek", epoch, versions[i++], relases[j++],
- REL_EQ, 0);
- k = 0;
-@@ -83,7 +83,7 @@
- struct capreq *req, *cap;
- int rc;
-
-- pkg = pkg_new("poldek", epoch, ver, rel, NULL, NULL, NULL, 0, 0, 0);
-+ pkg = pkg_new("poldek", epoch, ver, rel, NULL, NULL, NULL, NULL, 0, 0, 0);
- cap = capreq_new("poldek", epoch, ver, rel, REL_EQ, 0);
-
- req = capreq_new_evr("poldek", n_strdup(evr), relation, 0);
---- poldek-0.18.6.orig/usrset.c 2004-09-15 16:03:02.000000000 +0000
-+++ poldek-0.18.6/usrset.c 2004-09-15 16:11:48.000000000 +0000
-@@ -185,7 +185,7 @@
- release = "";
-
- pdef->pkg = pkg_new(name, epoch, version, release, NULL, NULL, NULL,
-- 0, 0, 0);
-+ NULL, 0, 0, 0);
- }
-
- if (virtname)