1 Index: installer/poldek/Makefile.am
2 diff -u installer/poldek/Makefile.am:1.54 installer/poldek/Makefile.am:1.54.4.2
3 --- installer/poldek/Makefile.am:1.54 Thu Nov 7 17:43:25 2002
4 +++ installer/poldek/Makefile.am Fri Dec 19 02:29:31 2003
10 ACLOCAL_AMFLAGS = -I m4
12 pkgset-load.c pkgset-load.h \
14 pkgset-req.c pkgset-req.h \
21 SHELL_MOD = shell/libshell.a
23 -poldek_DEPENDENCIES_ = libpoldek.a \
24 - sigint/libsigint.a \
26 +poldek_DEPENDENCIES_ = libpoldek.a \
28 vfile/vftp/libvftp.a \
29 - vfile/vhttp/libvhttp.a
30 + vfile/vhttp/libvhttp.a \
33 if ENABLE_INTERACTIVE_MODE
34 SHELL_MOD_ = $(SHELL_MOD)
38 bin_PROGRAMS = poldek rpmvercmp
39 -dist_bin_SCRIPTS = mkpackagedir vfjuggle vfuncompr
40 +dist_bin_SCRIPTS = mkpackagedir vfjuggle vfcompr
41 poldek_SOURCES = main.c
42 -poldek_LDADD = libpoldek.a sigint/libsigint.a vfile/libvfile.a \
43 - vfile/vftp/libvftp.a vfile/vhttp/libvhttp.a \
44 - $(SHELL_MOD_) $(LDADD_)
45 +poldek_LDADD = libpoldek.a vfile/libvfile.a \
46 + vfile/vftp/libvftp.a vfile/vhttp/libvhttp.a \
47 + sigint/libsigint.a \
48 + $(SHELL_MOD_) $(LDADD_)
50 rpmvercmp_SOURCES = rpmvercmp.c
51 rpmvercmp_LDADD = $(LDADD_)
53 noinst_PROGRAMS = test_match
54 test_match_SOURCES = test_match.c
55 test_match_LDADD = $(poldek_LDADD)
57 +test_match_DEPENDENCIES = $(poldek_DEPENDENCIES)
61 Index: installer/poldek/NEWS
62 diff -u installer/poldek/NEWS:1.56 installer/poldek/NEWS:1.56.4.2
63 --- installer/poldek/NEWS:1.56 Wed Nov 27 19:56:09 2002
64 +++ installer/poldek/NEWS Sun Dec 7 22:07:32 2003
66 +0.18.2 (minor bugfix && improvements release; 2003/07/23)
68 +* support for RPM 4.2/4.3
69 +* dependency processing bugfix
70 +* RPM 4.1 related fixes
72 0.18.1 (major bugfix release; 2002/11/27)
74 * ability of creation empty indexes
77 0.18 (bugfix/minor enhancements release; 2002/11/07)
79 -* support for RPM 4.1 (with help of Artur Frysiak <wiget@pld.org.pl>)
80 +* support for RPM 4.1 (with help of Artur Frysiak <wiget at pld-linux org>)
82 * few dependency processing improvements:
83 - greedy upgrades are performed instead of marking different versions
85 * fixed available package list management in interactive mode
87 * AM/AC stuff cleanup and adaptation to their new versions (automake 1.7 and autoconf 2.54)
88 - (Artur Frysiak <wiget@pld.org.pl>)
89 + (Artur Frysiak <wiget at pld-linux org>)
91 -* Polish translation of manual page (GoTaR <gotar@pld.org.pl>)
92 +* Polish translation of manual page (GoTaR <gotar at pld-linux org>)
94 * fix: progress bar isn't refreshed so frequently (#367)
97 0.17.8 (major bugfix release; 2002/08/18)
99 * package installation is verified with rpm database if rpm reports failure
100 -* fixed obsoletes matching (Jakub Bogusz <qboosh@pld.org.pl>)
101 +* fixed obsoletes matching (Jakub Bogusz <qboosh at pld-linux org>)
102 * improved and fixed file based conflicts detection
103 -* fixed size units display (GoTaR <gotar@poczta.onet.pl>)
104 +* fixed size units display (GoTaR <gotar at poczta.onet.pl>)
107 0.17.7 (bugfix release; 2002/06/14)
109 * improved package auto-selection among equivalents: package which marks
110 less packages to install is preferred
111 * vftp: fixed logging in when server doesn't ask for password
112 - (Przemyslaw Frasunek <venglin@freebsd.lublin.pl>)
113 + (Przemyslaw Frasunek <venglin at freebsd.lublin.pl>)
114 * bugfix: root directory (--rootdir) is always passed to rpm as absolute path
115 * shell: desc: file mode is displayed in human readable form
116 * fixed vfjuggle: packages.dir.md* are copied to hdd too
117 * few SIGSEVs killed on "search" command when APT's pkglist file
118 - is used as package index (thanks to Gustavo Niemeyer <niemeyer@conectiva.com>)
119 + is used as package index (thanks to Gustavo Niemeyer <niemeyer at conectiva.com>)
122 0.17.4 (bugfix/minor enhancements release; 2002/05/06)
123 @@ -144,11 +150,11 @@
124 * new "--clean" and "--clean-whole" options for cache directory
127 -* URLs with user and password (ftp://user:passwd@host:port/path/ syntax)
128 - are supported (Andreas Piesk <a.piesk@gmx.net>)
129 +* URLs with user and password (ftp://user:passwd at host:port/path/ syntax)
130 + are supported (Andreas Piesk <a.piesk at gmx.net>)
132 * new "ftp_sysuser_as_anon_passwd" option causes sending
133 - login@hostname as anonymous FTP password
134 + login at hostname as anonymous FTP password
136 * new "noautoup" source option tells poldek to do not update
138 @@ -157,11 +163,11 @@
140 * misc fixes to compile on SuSE
142 -* fixed rpm 3.x support (with help of Roger Luethi <rl@hellgate.ch>)
143 +* fixed rpm 3.x support (with help of Roger Luethi <rl at hellgate.ch>)
145 * fixed and improved handling of bool configuration options,
146 added on/off and enable/disable to the list of valid choices
147 - (Andreas Piesk <a.piesk@gmx.net>)
148 + (Andreas Piesk <a.piesk at gmx.net>)
150 * fixed detection of file based conflicts between available packages.
153 versions are handled properly
155 * misc fixes to compile and work with glibc2.1 (with
156 - help of Andreas Piesk <a.piesk@gmx.net>)
157 + help of Andreas Piesk <a.piesk at gmx.net>)
159 * installation of multiple instances of package is allowed (by poldek -i)
161 @@ -178,24 +184,24 @@
162 - fixed handling package conflicts added by poldek
163 - faster dependency checking
165 -* German translation (Andreas Piesk <a.piesk@gmx.net>)
166 +* German translation (Andreas Piesk <a.piesk at gmx.net>)
168 * various bugs are fixed:
169 - double '/' in paths handling
170 - huge mem leak on --update
171 - - ambiguous p_open() flags (Michal Moskal <malekith@pld.org.pl>)
172 + - ambiguous p_open() flags (Michal Moskal <malekith at pld-linux org>)
173 - removed [v]snprintf() (wrong) usage; trurlib's n_[v]snprintf()
175 - - automake/autoconf fixes (Artur Frysiak <wiget@pld.org.pl>)
176 - - many minor fixes (thanks to Andreas Piesk <a.piesk@gmx.net>)
177 + - automake/autoconf fixes (Artur Frysiak <wiget at pld-linux org>)
178 + - many minor fixes (thanks to Andreas Piesk <a.piesk at gmx.net>)
181 * "ported" to RedHat 7.2 (with rpm 4.0.4)
182 * install-dist: --force forces installation of broken package sets
183 * corrected package installation progress bar
184 - (Michal Moskal <malekith@pld.org.pl>)
185 + (Michal Moskal <malekith at pld-linux org>)
186 * install-dist: log INST-{OK,ERR} for PLD Installer
187 - (Michal Moskal <malekith@pld.org.pl>)
188 + (Michal Moskal <malekith at pld-linux org>)
189 * --dump* works properly
190 * vftp: fixed error handling
193 - uninstall: fix: don't remove pkg from install list if --test is used
194 - added -h opt. to all commands
195 * removed GCC's nested functions usage -- seems that it causes SIGSEVs on
196 - some machines (Arkadiusz Patyk <areq@pld.org.pl>)
197 + some machines (Arkadiusz Patyk <areq at pld-linux org>)
198 * fix: don't include trailing whitespaces in config values
202 doesn't contain package descriptions at all
203 * shell: fixed installed package list management
204 * curl: fixed progress bar if total file size is unknown
205 - (Michal Moskal <malekith@pld.org.pl>)
206 + (Michal Moskal <malekith at pld-linux org>)
207 * "mercy" mode bugfix
211 * added global config /etc/poldek.conf usage
212 * fixed prereq loop detection
213 * added '@' to list of valid characters in package filename
214 - (Rafal Kleger-Rudomin <klakier@pld.org.pl>)
215 -* vfjuggle: sed is used instead of awk (Rafal Kleger-Rudomin <klakier@pld.org.pl>)
216 + (Rafal Kleger-Rudomin <klakier at pld-linux org>)
217 +* vfjuggle: sed is used instead of awk (Rafal Kleger-Rudomin <klakier at pld-linux org>)
218 * shell: ls: fixed packages sorting
222 - extended "desc" and "search" commands -- almost all
223 package fields could be specified
225 -* bugfixes (thanks to Rafal Kleger-Rudomin <klakier@pld.org.pl> and
226 - Michal Moskal <malekith@pld.org.pl>)
227 +* bugfixes (thanks to Rafal Kleger-Rudomin <klakier at pld-linux org> and
228 + Michal Moskal <malekith at pld-linux org>)
232 @@ -373,10 +379,10 @@
233 * support for rpm 4.0.2 pre/post requirements
234 * readline 4.2 updates
235 * vfile: added curl backend (curl >= 7.7.4-pre1 is needed)
236 -* added --nodesc option for index creation (Michal Moskal <malekith@pld.org.pl>)
237 +* added --nodesc option for index creation (Michal Moskal <malekith at pld-linux org>)
238 * rpmvercmp returns 2 instead of -1
239 * file names are stored without trailing '\0' (saves about 100 kB disk space)
240 * temporary dir may be set by $TMPDIR
241 * fixed checking dependencies of unistalled packages
242 * shell: added "desc" command
243 -* fixed a lot of bugs (with help of Michal Moskal <malekith@pld.org.pl>)
244 +* fixed a lot of bugs (with help of Michal Moskal <malekith at pld-linux org>)
245 Index: installer/poldek/README.merging
246 diff -u /dev/null installer/poldek/README.merging:1.1.2.1
247 --- /dev/null Fri Jan 9 13:45:49 2004
248 +++ installer/poldek/README.merging Wed Apr 2 16:54:08 2003
251 +With --merge option poldek merges two or more sources with esure
252 +that result package set will not contain unsatisfied dependencies.
255 +$ poldek --merge DST_SOURCE SRC_SOURCE...
259 +Assume you have 2 repositories, the first is "stable", the second
263 +stable /dists/ac/PLD/i686/PLD/RPMS/
264 +test /dists/ac/test/i686/RPMS/
268 +$ poldek --merge -n stable -n test | grep 'merge: ' | sed 's/merge: //g' | sh
270 +The program produces "rm FILE" and "mv FILE" commands after 'merge: '
271 +prefix, so after filtering out the 'merge: ' prefix the commands could
272 +be passed to shell. After that "$ poldek -n stable -V" should not
273 +reports any unsatisfied dependencies.
274 Index: installer/poldek/conf.c
275 diff -u installer/poldek/conf.c:1.31 installer/poldek/conf.c:1.31.4.3
276 --- installer/poldek/conf.c:1.31 Fri Oct 18 18:19:42 2002
277 +++ installer/poldek/conf.c Tue Dec 30 19:14:07 2003
288 { "particle_install", TYPE_BOOL, { 0 } },
289 { "unique_package_names", TYPE_BOOL, { 0 } },
290 { "ftp_sysuser_as_anon_passwd", TYPE_BOOL , { 0 } },
291 + { "vfile_external_compress", TYPE_BOOL, { 0 } },
292 + { "promoteepoch", TYPE_BOOL, { 0 } },
296 Index: installer/poldek/configure.in
297 diff -u installer/poldek/configure.in:1.76 installer/poldek/configure.in:1.76.4.5
298 --- installer/poldek/configure.in:1.76 Wed Nov 27 19:56:09 2002
299 +++ installer/poldek/configure.in Sun Dec 7 22:04:35 2003
301 dnl Process this file with autoconf to produce a configure script.
305 -AC_INIT(poldek, 0.18.1)
306 +AC_INIT(poldek, 0.18.2)
307 AC_CONFIG_SRCDIR([capreq.c])
311 VERSION_STATUS="stable"
312 VERSION_CVSTAG="v$(echo $VERSION | sed 's/\./_/g')"
313 AH_TEMPLATE([ENABLE_TRACE],[])
314 AH_TEMPLATE([HAVE_RPM_4_0_4],[])
315 AH_TEMPLATE([HAVE_RPM_4_1],[])
316 +AH_TEMPLATE([HAVE_RPM_4_2],[])
317 AH_TEMPLATE([HAVE_RPM_EXTDEPS],[])
318 AH_TEMPLATE([HAVE_TM_GMTOFF],[])
319 AH_TEMPLATE([HAVE_TM___GMTOFF],[])
321 dnl Checks for programs.
325 +if test "$GCC." = "yes."; then
326 + CFLAGS="$CFLAGS -fno-builtin-log"
331 AC_CHECK_PROG(POD2MAN, pod2man, pod2man)
336 - AC_CHECK_LIB(db-4.0, db_create, [DBLIB="-ldb-4.0"],
337 + AC_CHECK_LIB(db-4.1, db_create, [DBLIB="-ldb-4.1"],
338 + [AC_CHECK_LIB(db-4.0, db_create, [DBLIB="-ldb-4.0"],
339 [AC_CHECK_LIB(db, db_create, [DBLIB="-ldb"],,[$LIBS])],
341 + [$LIBS])],, [$LIBS])
343 if test "${ENABLE_STATIC}." = "yes."; then
345 @@ -264,11 +271,11 @@
349 -AC_CHECK_LIB(rpm, rpmReadPackageInfo,[LIBS="$LIBS -lrpm $DBLIB"],
350 +AC_CHECK_LIB(rpm, rpmReadPackageInfo,[LIBS="-lrpm $DBLIB $LIBS"],
351 AC_CHECK_LIB(rpm, rpmReadPackageHeader,
352 - [LIBS="$LIBS -lrpm -lrpmdb $DBLIB"],
353 + [LIBS="-lrpm -lrpmdb $DBLIB $LIBS"],
354 AC_CHECK_LIB(rpm, rpmReadPackageFile,
355 - [LIBS="$LIBS -lrpm -lrpmdb $DBLIB"
356 + [LIBS="-lrpm -lrpmdb -lelf $DBLIB $LIBS"
357 AC_DEFINE([HAVE_RPM_4_1],1,[])],
358 AC_MSG_ERROR(["rpmlib not found"]),
360 @@ -278,14 +285,19 @@
361 AC_CHECK_FUNCS(rpmMachineScore,,[ AC_MSG_ERROR(["rpmlib not found"])])
362 AC_CHECK_FUNCS(rpmlog rpmCheckSig rpmVerifySignature)
365 +AC_CHECK_FUNCS(rpmtsColor, [LIBS="$LIBS -lpthread"
366 + AC_DEFINE([HAVE_RPM_4_2],1,[])])
367 +#AC_DEFINE([HAVE_RPM_4_2],1,[]))
369 AC_CHECK_HEADERS(db_185.h,,[
370 AC_MSG_WARN(["disabled synchronization with db file-dependencies"]) ])
371 AC_CHECK_FUNCS(__db185_open)
373 dnl 4.0.4 has cross dependenecies(?)
374 if test ${is_rpm4_0_4}. = yes. -a ${ENABLE_STATIC}. = yes. ; then
375 - if ${have_beecrypt}. = yes. ; then
376 - LIBS="$LIBS -lbz2 -lrpmio"
377 + if test ${have_beecrypt}. = yes. ; then
378 + LIBS="$LIBS -lbz2 -lrpmio -lbeecrypt -lpthread"
380 LIBS="$LIBS -lbz2 -lrpmio"
384 AC_CHECK_FUNCS(openpty,,
385 AC_CHECK_LIB(util, openpty,
386 - [AC_DEFINE([HAVE_OPENPTY],1,[defined if openpty() is avialable])] [LIBS="$LIBS -lutil"]))
387 + [AC_DEFINE([HAVE_OPENPTY],1,[defined if openpty() is avialable])] [LIBS="-lutil $LIBS"]))
389 AC_CHECK_FUNCS(rpmGetRpmlibProvides,,
390 [AC_MSG_WARN("[poldek will not work fine with rpmlib\(...\) capabilities"])],
395 +if test -f /etc/redhat-release; then
396 + LIBS="$LIBS -ldl" # rh's crypto needs this
400 dnl trullib 0.43.5 has n_hash_size; test if linked with system copy only
401 NARRAY="<trurl/narray.h>"
403 AC_CHECK_LIB(trurl, n_hash_size,,
404 [AC_MSG_ERROR(["trurlib >= 0.43.5 not found"])], [$CONF_IN_LDFLAGS])
406 - LIBS="$LIBS -ltrurl"
407 + LIBS="-ltrurl $LIBS"
408 AC_CONFIG_SUBDIRS(trurlib)
409 NARRAY="\"$srcdir/$TRURL_DIR/include/trurl/narray.h\""
411 Index: installer/poldek/dbdep.c
412 diff -u installer/poldek/dbdep.c:1.8 installer/poldek/dbdep.c:1.8.4.1
413 --- installer/poldek/dbdep.c:1.8 Thu Nov 14 20:23:24 2002
414 +++ installer/poldek/dbdep.c Tue Dec 30 19:15:27 2003
421 Module used in pkgset-install.c only
428 -static db_dep_free_pkgs(struct db_dep *db_dep)
429 +static void db_dep_free_pkgs(struct db_dep *db_dep)
432 n_array_free(db_dep->pkgs);
433 Index: installer/poldek/main.c
434 diff -u installer/poldek/main.c:1.110 installer/poldek/main.c:1.110.4.6
435 --- installer/poldek/main.c:1.110 Tue Nov 26 17:32:15 2002
436 +++ installer/poldek/main.c Tue Dec 30 19:14:07 2003
447 #define MODE_SPLIT (1 << 7)
448 #define MODE_SRCLIST (1 << 8)
449 #define MODE_UNINSTALL (1 << 9)
451 +#define MODE_MERGE (1 << 10)
452 #ifdef ENABLE_INTERACTIVE_MODE
453 -# define MODE_SHELL (1 << 10)
454 +# define MODE_SHELL (1 << 11)
457 #define MODE_IS_NOSCORE (MODE_VERIFY | MODE_MKIDX | MODE_SPLIT | MODE_SRCLIST)
459 tn_hash *htcnf = NULL; /* config file values */
461 #define OPT_VERIFY_MERCY 'm'
462 +#define OPT_VERIFY_PROMOTEPOCH 901
463 #define OPT_VERIFY_DEPS 'V'
464 #define OPT_VERIFY_CNFLS 902
465 #define OPT_VERIFY_FILECNFLS 903
468 #define OPT_NOASK 2007
470 +#define OPT_MERGE 2101
471 #define OPT_SW_V016 (1 << 0)
472 #define OPT_SW_NOASK (1 << 1)
473 #define OPT_SW_NOCONF (1 << 2)
475 N_("Verify dependencies, conflicts and file conflicts"), 50 },
476 {"mercy", OPT_VERIFY_MERCY, 0, 0,
477 N_("Be tolerant for bugs which RPM tolerates"), 50 },
479 +{"promoteepoch", OPT_VERIFY_PROMOTEPOCH, 0, 0,
480 + N_("Promote non-existent requiremet's epoch to package's one"), 50 },
484 {0,0,0,0, N_("Index creation:"), 60},
486 N_("Take package priorities from FILE"), 71 },
488 {"split-out", OPT_SPLITOUTPATH, "PREFIX", 0,
489 - N_("Write chunks to PREFIX.XX, default PREFIX is packages.chunk"), 90 },
490 + N_("Write chunks to PREFIX.XX, default PREFIX is packages.chunk"), 90 },
493 +{0,0,0,0, N_("Merging:"), 100},
495 +{"merge", OPT_MERGE, 0, OPTION_HIDDEN,
496 + N_("Merging given sources, the first one is treated as \"destination\", "
497 + "the others as \"source\" ones"), 100 },
499 {0,0,0,0, N_("Other:"), 500},
500 {"cachedir", OPT_SOURCECACHE, "DIR", 0,
501 @@ -690,14 +703,20 @@
502 argsp->idx_path = prepare_path(arg);
503 argsp->idx_type = INDEXTYPE_TXTZ;
507 + check_mjrmode(argsp);
508 + argsp->mjrmode = MODE_MERGE;
509 + //argsp->psflags |= PSVERIFY_DEPS;
513 - argsp->pkgdir_creat_flags |= PKGDIR_CREAT_NODESC;
515 + argsp->pkgdir_creat_flags |= PKGDIR_CREAT_NODESC;
519 - argsp->pkgdir_nodiff = 1;
521 + argsp->pkgdir_nodiff = 1;
525 check_mjrmode(argsp);
526 @@ -1217,7 +1236,6 @@
527 argp_parse(&argp, argc, argv, 0, 0, &args);
529 pkgdir_v016compat = (args.switches & OPT_SW_V016);
532 if ((args.switches & OPT_SW_NOCONF) && args.conf_path) {
533 logn(LOGERR, _("--noconf and --conf are exclusive, aren't they?"));
534 @@ -1287,7 +1305,12 @@
535 args.has_pkgdef = n_array_size(args.pkgdef_sets) +
536 n_array_size(args.pkgdef_defs) +
537 n_array_size(args.pkgdef_files);
540 + if (conf_get_bool(htcnf, "vfile_external_compress", 0))
541 + pkgdir_redhat9_zlib_in_rpm_workaround = 1;
543 + if (conf_get_bool(htcnf, "promoteepoch", 0))
544 + poldek_conf_promote_epoch = 1;
546 if (conf_get_bool(htcnf, "use_sudo", 0))
547 args.inst.flags |= INSTS_USESUDO;
548 @@ -1430,6 +1453,52 @@
552 +static int do_merge(tn_array *sources, unsigned psflags)
554 + struct pkgset *ps_src, *ps_dst;
555 + struct source *src;
556 + tn_array *dst_sources;
559 + n_assert(n_array_size(sources) > 1);
560 + n_array_sort_ex(sources, (tn_fn_cmp)source_cmp_pri_name);
561 + dst_sources = n_array_clone(sources);
563 + n_array_push(dst_sources, n_array_shift(args.sources));
565 + ps_src = pkgset_new(psflags);
566 + ps_dst = pkgset_new(psflags);
568 + msgn(1, "Loading \"destination\" source...");
569 + if (!pkgset_load(ps_dst, 0, dst_sources))
570 + logn(LOGWARN, _("%s: no packages loaded"),
571 + source_idstr((struct source*)n_array_nth(dst_sources, 0)));
573 + if (!pkgset_setup(ps_dst, 0))
574 + logn(LOGWARN, "%s: source is not clean",
575 + source_idstr((struct source*)n_array_nth(dst_sources, 0)));
577 + msgn(1, "Loading \"source\" sources...");
578 + if (!pkgset_load(ps_src, 0, args.sources)) {
579 + logn(LOGERR, _("%s: no packages loaded"),
580 + source_idstr((struct source*)n_array_nth(args.sources, 0)));
585 + pkgset_setup(ps_src, 0);
586 + msgn(1, "Merging...");
587 + pkgset_merge(ps_dst, ps_src, psflags);
590 + pkgset_free(ps_src);
591 + pkgset_free(ps_dst);
593 + n_array_unshift(args.sources, n_array_shift(dst_sources));
594 + n_array_free(dst_sources);
598 static struct pkgset *load_pkgset(int ldflags)
601 @@ -1658,6 +1727,19 @@
602 rc = prepare_given_packages();
609 + n_assert(args.sources);
611 + if (n_array_size(args.sources) < 2) {
612 + logn(LOGERR, _("merging needs at least 2 sources"));
613 + exit(EXIT_FAILURE);
621 @@ -1867,6 +1949,11 @@
622 if (args.mjrmode == MODE_UNINSTALL) {
623 if ((rc = usrpkgset_size(args.ups)))
624 rc = uninstall(args.ups, &args.inst);
628 + if (args.mjrmode == MODE_MERGE) {
629 + rc = do_merge(args.sources, args.psflags);
633 Index: installer/poldek/make.sh
634 diff -u /dev/null installer/poldek/make.sh:1.4.2.2
635 --- /dev/null Fri Jan 9 13:45:49 2004
636 +++ installer/poldek/make.sh Fri Dec 19 02:29:31 2003
640 +cd $(dirname $0) || exit 1
641 +make CFLAGS="-fno-builtin-log -O0 -g -Wall -W -pipe" $@
642 Index: installer/poldek/pkg.c
643 diff -u installer/poldek/pkg.c:1.51 installer/poldek/pkg.c:1.51.4.2
644 --- installer/poldek/pkg.c:1.51 Fri Oct 18 18:19:42 2002
645 +++ installer/poldek/pkg.c Tue Dec 30 19:19:52 2003
659 +int poldek_conf_promote_epoch = 0;
661 static void *(*pkg_alloc_fn)(size_t) = n_malloc;
662 static void (*pkg_free_fn)(void*) = n_free;
665 struct pkg *pkg_new(const char *name, int32_t epoch,
666 const char *version, const char *release,
667 const char *arch, const char *os,
669 uint32_t size, uint32_t fsize,
673 - int name_len = 0, version_len = 0, release_len = 0, arch_len = 0, os_len = 0;
674 + int name_len = 0, version_len = 0, release_len = 0,
675 + arch_len = 0, os_len = 0, fn_len = 0;
685 + fn_len = strlen(fn);
689 pkg = pkg_alloc_fn(sizeof(*pkg) + len);
690 memset(pkg, 0, sizeof(*pkg));
699 + memcpy(buf, fn, fn_len);
706 @@ -253,10 +270,11 @@
708 if (!headerGetEntry(h, RPMTAG_BUILDTIME, &type, (void *)&btime, NULL))
711 - pkg = pkg_new(name, epoch ? *epoch : 0, version, release, arch, os,
713 + pkg = pkg_new(name, epoch ? *epoch : 0, version, release, arch, os,
714 + fname ? n_basenam(fname) : NULL,
715 size ? *size : 0, fsize, btime ? *btime : 0);
723 if ((strcmp(capreq_name(cap), capreq_name(req))) != 0)
727 + if (capreq_has_epoch(cap)) {
728 + if (!capreq_has_epoch(req) && poldek_conf_promote_epoch) {
730 + logn(LOGWARN, "req '%s' needs an epoch (assuming same epoch as %s)\n",
731 + capreq_snprintf_s(req), capreq_snprintf_s0(cap));
735 + cmprc = capreq_epoch(cap) - capreq_epoch(req);
737 + return rel_match(cmprc, req);
741 + } else if (capreq_epoch(req) > 0) { /* always promote cap's epoch */
747 if (capreq_has_epoch(req)) {
748 if (!capreq_has_epoch(cap))
751 return rel_match(cmprc, req);
757 if (capreq_has_ver(req)) {
758 if (!capreq_has_ver(cap))
760 @@ -742,14 +781,22 @@
762 if (!capreq_versioned(req))
765 - if (capreq_has_epoch(req) && pkg->epoch) {
766 - cmprc = pkg->epoch - capreq_epoch(req);
768 - return rel_match(cmprc, req);
771 + if (!capreq_has_epoch(req) && poldek_conf_promote_epoch) {
773 + logn(LOGWARN, "req '%s' needs an epoch (assuming same epoch as %s)\n",
774 + capreq_snprintf_s(req), pkg_snprintf_s(pkg));
778 + cmprc = pkg->epoch - capreq_epoch(req);
780 + return rel_match(cmprc, req);
784 - } else if (capreq_epoch(req) > 0) {
785 + } else if (capreq_epoch(req) > 0) { /* always promote package's epoch */
789 @@ -1198,6 +1245,19 @@
791 static char str[256];
792 snprintf(str, sizeof(str), "%s-%s-%s", pkg->name, pkg->ver, pkg->rel);
797 +char *pkg_snprintf_epoch_s(const struct pkg *pkg)
799 + static char str[256];
803 + snprintf(es, sizeof(es), "%d:", pkg->epoch);
805 + snprintf(str, sizeof(str), "%s-%s%s-%s", pkg->name, es, pkg->ver, pkg->rel);
809 Index: installer/poldek/pkg.h
810 diff -u installer/poldek/pkg.h:1.37 installer/poldek/pkg.h:1.37.4.2
811 --- installer/poldek/pkg.h:1.37 Fri Oct 18 18:19:42 2002
812 +++ installer/poldek/pkg.h Tue Dec 30 19:19:52 2003
825 tn_array *caps; /* capabilities */
826 tn_array *reqs; /* requirements */
828 struct pkg *pkg_new(const char *name, int32_t epoch,
829 const char *version, const char *release,
830 const char *arch, const char *os,
832 uint32_t size, uint32_t fsize,
837 int pkg_eq_capreq(const struct pkg *pkg, const struct capreq *cr);
841 +extern int poldek_conf_promote_epoch; /* be compatibile with rpm < 4.2.1 */
843 /* look up into package caps only */
844 int pkg_caps_match_req(const struct pkg *pkg, const struct capreq *req,
847 char *pkg_snprintf_s(const struct pkg *pkg);
848 char *pkg_snprintf_s0(const struct pkg *pkg);
849 char *pkg_snprintf_s1(const struct pkg *pkg);
852 +char *pkg_snprintf_epoch_s(const struct pkg *pkg);
854 /* load and returns not loaded file list (l: tag in package index) */
855 tn_array *pkg_other_fl(const struct pkg *pkg);
856 Index: installer/poldek/pkgdir.c
857 diff -u installer/poldek/pkgdir.c:1.39 installer/poldek/pkgdir.c:1.39.4.3
858 --- installer/poldek/pkgdir.c:1.39 Tue Nov 26 17:32:16 2002
859 +++ installer/poldek/pkgdir.c Tue Dec 30 19:19:52 2003
872 int pkgdir_v016compat = 0; /* public */
873 +int pkgdir_redhat9_zlib_in_rpm_workaround = 0;
875 #define PKGT_HAS_NAME (1 << 0)
876 #define PKGT_HAS_EVR (1 << 1)
879 int do_open_idx(struct idx_s *idx, char *path, int path_len, int vfmode)
881 + if (pkgdir_redhat9_zlib_in_rpm_workaround)
882 + vfmode |= VFM_UNCOMPR;
884 if ((idx->pdg = pdigest_new(path, vfmode, pkgdir_v016compat))) {
885 if ((idx->vf = vfile_open(path, VFT_STDIO, vfmode)) == NULL) {
886 - if (path_len && strcmp(&path[path_len - 3], ".gz") == 0) {
887 + if (path_len > 3 && strcmp(&path[path_len - 3], ".gz") == 0) {
888 path[path_len - 3] = '\0'; /* trim *.gz */
889 idx->vf = vfile_open(path, VFT_STDIO, vfmode);
891 @@ -1219,9 +1223,9 @@
895 - logn(LOGERR, "%s:%ld: unknown tag '%c'", pkgdir->path, offs, *line);
898 + logn(LOGWARN, "%s:%ld: unknown tag '%c' (skipped)",
899 + pkgdir->path, offs, *line);
904 @@ -1389,7 +1393,7 @@
908 - pkg = pkg_new(pkgt->name, epoch, version, release, arch, os,
909 + pkg = pkg_new(pkgt->name, epoch, version, release, arch, os, NULL,
910 pkgt->size, pkgt->fsize, pkgt->btime);
911 pkg->groupid = pkgt->groupid;
913 @@ -1457,7 +1461,7 @@
916 if (*p && parse_nevr(p, &name, &epoch, &ver, &rel)) {
917 - struct pkg *pkg = pkg_new(name, epoch, ver, rel, NULL, NULL,
918 + struct pkg *pkg = pkg_new(name, epoch, ver, rel, NULL, NULL, NULL,
920 n_array_push(pkgs, pkg);
922 Index: installer/poldek/pkgdir.h
923 diff -u installer/poldek/pkgdir.h:1.22 installer/poldek/pkgdir.h:1.22.6.1
924 --- installer/poldek/pkgdir.h:1.22 Sat Aug 24 09:59:11 2002
925 +++ installer/poldek/pkgdir.h Sun Dec 7 22:01:53 2003
929 #ifndef POLDEK_PKGDIR_H
930 #define POLDEK_PKGDIR_H
935 extern int pkgdir_v016compat;
936 +extern int pkgdir_redhat9_zlib_in_rpm_workaround;
940 Index: installer/poldek/pkgdir_save.c
941 diff -u installer/poldek/pkgdir_save.c:1.8 installer/poldek/pkgdir_save.c:1.8.6.1
942 --- installer/poldek/pkgdir_save.c:1.8 Mon Jun 10 19:56:34 2002
943 +++ installer/poldek/pkgdir_save.c Fri Dec 19 02:29:31 2003
954 char suffix[64] = "", tocsuffix[64] = ".toc",
955 difftoc_suffix[PATH_MAX] = "";
956 const char *orig_pathname;
957 - int i, with_toc = 1;
958 + int i, with_toc = 1, vfmode;
962 + if (pkgdir_redhat9_zlib_in_rpm_workaround)
963 + vfmode |= VFM_UNCOMPR;
965 if ((flags & PKGDIR_CREAT_asCACHE) == 0 &&
966 (pkgdir->flags & (PKGDIR_DIFF | PKGDIR_UNIQED)) == 0) {
967 @@ -313,14 +317,14 @@
968 msgn_f(1, _("Writing %s..."), path);
971 - if ((vf_toc = vfile_open(tocpath, VFT_STDIO, VFM_RW)) == NULL)
972 + if ((vf_toc = vfile_open(tocpath, VFT_STDIO, vfmode)) == NULL)
974 put_fheader(vf_toc->vf_stream, pdir_poldeksindex_toc, pkgdir);
979 - if ((vf = vfile_open(path, VFT_STDIO, VFM_RW)) == NULL) {
980 + if ((vf = vfile_open(path, VFT_STDIO, vfmode)) == NULL) {
988 - if ((vf = vfile_open(difftoc_path, VFT_STDIO, VFM_APPEND)) == NULL)
989 + if ((vf = vfile_open(difftoc_path, VFT_STDIO,
990 + vfmode | VFM_APPEND)) == NULL)
993 fprintf(vf->vf_stream, "%s %lu %s %lu\n",
994 n_basenam(path), pkgdir->ts, pkgdir->mdd_orig, pkgdir->ts_orig);
996 Index: installer/poldek/pkgroup.c
997 diff -u installer/poldek/pkgroup.c:1.10 installer/poldek/pkgroup.c:1.10.6.1
998 --- installer/poldek/pkgroup.c:1.10 Thu Apr 25 18:34:11 2002
999 +++ installer/poldek/pkgroup.c Fri Dec 19 02:19:25 2003
1007 #ifdef HAVE_CONFIG_H
1008 # include "config.h"
1010 if (fread(&nid, sizeof(nid), 1, stream) != 1)
1013 - if (fread(&nlen, sizeof(nlen), 1, stream) != 1 || nlen > sizeof(name))
1014 + if (fread(&nlen, sizeof(nlen), 1, stream) != 1)
1017 if (fread(name, nlen, 1, stream) != 1)
1018 Index: installer/poldek/pkgset-install.c
1019 diff -u installer/poldek/pkgset-install.c:1.82 installer/poldek/pkgset-install.c:1.82.4.2
1020 --- installer/poldek/pkgset-install.c:1.82 Sat Nov 16 01:23:22 2002
1021 +++ installer/poldek/pkgset-install.c Tue Dec 30 19:19:52 2003
1030 #ifdef HAVE_CONFIG_H
1031 @@ -224,11 +224,11 @@
1033 if (p != pkg && pkg_is_marked(p)) {
1034 if (req == NULL || pkg_statisfies_req(p, req, 0)) {
1035 - DBGF("%s -> yes, %s\n", pkg_snprintf_s0(pkg), pkg_snprintf_s1(p));
1037 + DBGF("%s -> yes, %s\n", pkg_snprintf_s0(pkg), pkg_snprintf_s1(p));
1047 struct pkg **candidates, int npkgs,
1048 struct pkgset *ps, struct upgrade_s *upg)
1050 - int *ncnfls, i, j, i_min, cnfl_min;
1051 + int *ncnfls, i, j, i_best, cnfl_min;
1052 int i_ver_eq = -1, i_evr_eq = -1;
1054 DBGF("%s (%d)\n", pkg_snprintf_s(marker), npkgs);
1055 @@ -345,38 +345,44 @@
1061 for (i=0; i < npkgs; i++) {
1062 DBGF("%d. %s %d\n", i, pkg_snprintf_s(candidates[i]), ncnfls[i]);
1063 if (cnfl_min > ncnfls[i]) {
1064 cnfl_min = ncnfls[i];
1070 - DBGF("[after cnfls] i_min = %d\n", i_min);
1071 + DBGF("[after cnfls] i_best = %d\n", i_best);
1072 if (cnfl_min == 0) {
1073 int n = INT_MAX, *nmarks;
1075 nmarks = alloca(npkgs * sizeof(*nmarks));
1077 for (i=0; i < npkgs; i++) {
1078 + if (other_version_marked(candidates[i], ps->pkgs, NULL)) {
1079 + DBGF("%d. %s other version is already marked, skipped\n",
1080 + i, pkg_snprintf_s(candidates[i]));
1084 nmarks[i] = pkg_drags(candidates[i], ps, upg);
1085 - DBGF("%d %s -> %d\n", i, pkg_snprintf_s(candidates[i]), nmarks[i]);
1086 - if (n > nmarks[i]) {
1087 + DBGF("%d. %s -> %d\n", i, pkg_snprintf_s(candidates[i]), nmarks[i]);
1088 + if (n > nmarks[i])
1093 if (n == 0 && ncnfls[i] == 0) {
1106 + DBGF("RET %d. %s\n", i_best, pkg_snprintf_s(candidates[i]));
1110 #define FINDREQ_BESTSEL 0
1111 @@ -1009,7 +1015,7 @@
1112 capreq_snprintf(reqname, 256, req);
1115 - DBGF("req %s\n", capreq_snprintf_s(req));
1116 + DBGF("%s: REQ %s\n", pkg_snprintf_s(pkg), capreq_snprintf_s(req));
1118 if ((upg->inst->flags & INSTS_EQPKG_ASKUSER) && upg->inst->askpkg_fn)
1119 tomark_candidates_ptr = &tomark_candidates;
1120 @@ -1022,7 +1028,8 @@
1125 + DBGF("%s: TOMARK %s\n", pkg_snprintf_s1(pkg),
1126 + tomark ? pkg_snprintf_s0(tomark) : "NULL");
1127 /* don't check foreign dependencies */
1128 if (process_as == PROCESS_AS_ORPHAN) {
1129 #if 0 /* buggy, TODO - unmark foreign on adding to uninst_set */
1130 @@ -1854,7 +1861,8 @@
1131 if (is_installed == 0)
1132 n_array_push(iinf->uninstalled_pkgs,
1133 pkg_new(pkg->name, pkg->epoch, pkg->ver, pkg->rel,
1134 - pkg->arch, pkg->os, pkg->size, pkg->fsize,
1135 + pkg->arch, pkg->os, NULL,
1136 + pkg->size, pkg->fsize,
1140 Index: installer/poldek/pkgset-merge.c
1141 diff -u /dev/null installer/poldek/pkgset-merge.c:1.1.2.1
1142 --- /dev/null Fri Jan 9 13:45:49 2004
1143 +++ installer/poldek/pkgset-merge.c Wed Apr 2 16:54:08 2003
1146 + Copyright (C) 2000 Pawel A. Gajda (mis@k2.net.pl)
1148 + This program is free software; you can redistribute it and/or modify
1149 + it under the terms of the GNU General Public License published by
1150 + the Free Software Foundation (see file COPYING for details).
1157 +#include <limits.h>
1158 +#include <stdint.h>
1159 +#include <string.h>
1162 +#include <rpm/rpmlib.h>
1163 +#include <trurl/nassert.h>
1164 +#include <trurl/narray.h>
1165 +#include <trurl/nhash.h>
1170 +#include "pkgset.h"
1174 +int find_replacement(struct pkgset *ps, struct pkg *pkg, struct pkg **rpkg)
1176 + const struct capreq_idx_ent *ent;
1177 + struct pkg *bypkg = NULL;
1182 + if ((bypkg = pkgset_lookup_pkgn(ps, pkg->name)) &&
1183 + pkg_cmp_name_evr(bypkg, pkg) > 0) {
1187 + } else if ((ent = capreq_idx_lookup(&ps->obs_idx, pkg->name))) {
1190 + for (i=0; i < ent->items; i++) {
1191 + if (pkg_caps_obsoletes_pkg_caps(ent->pkgs[i], pkg) &&
1192 + pkg_cmp_name_evr(ent->pkgs[i], pkg) > 0) {
1194 + *rpkg = ent->pkgs[i];
1200 + if (*rpkg && strcmp((*rpkg)->name, pkg->name) != 0 &&
1201 + (*rpkg)->caps && pkg->caps) {
1204 + for (i=0; i < n_array_size((*rpkg)->caps); i++) {
1205 + struct capreq *cap = n_array_nth((*rpkg)->caps, i);
1207 + if (strcmp(capreq_name(cap), (*rpkg)->name) == 0)
1210 + if (capreq_arr_find(pkg->caps, capreq_name(cap))) {
1211 + msg(2, "%s is NOT obsoleted by %s (same %s)\n", pkg_snprintf_s(pkg),
1212 + pkg_snprintf_s0(*rpkg), capreq_name(cap));
1219 + return (*rpkg != NULL);
1222 +void pkgset_merge(struct pkgset *ps_dst, struct pkgset *ps_src,
1223 + unsigned psflags) /* TODO: psflags should be extractable
1224 + from existing ps */
1226 + struct pkg *pkg, *rpkg;
1227 + tn_array *rm_pkgs, *pkgs;
1228 + struct pkgset *ps;
1229 + struct pkgdir *pkgdir;
1232 + n_assert(n_array_size(ps_dst->pkgdirs) == 1);
1234 + rm_pkgs = pkgs_array_new(1024);
1235 + pkgs = pkgs_array_new(n_array_size(ps_dst->pkgdirs));
1237 + for (i=0; i < n_array_size(ps_src->pkgs); i++) {
1238 + pkg = n_array_nth(ps_src->pkgs, i);
1239 + pkg_clr_badreqs(pkg);
1240 + n_array_push(pkgs, pkg_link(pkg));
1243 + for (i=0; i < n_array_size(ps_dst->pkgs); i++) {
1244 + pkg = n_array_nth(ps_dst->pkgs, i);
1245 + pkg_clr_badreqs(pkg);
1247 + if (!find_replacement(ps_src, pkg, &rpkg)) {
1248 + n_array_push(pkgs, pkg_link(pkg));
1251 + n_array_push(rm_pkgs, pkg_link(pkg));
1252 + n_array_push(rm_pkgs, pkg_link(rpkg));
1253 + msg(2, "%s is obsoleted by %s\n", pkg_snprintf_s(pkg),
1254 + pkg_snprintf_s0(rpkg));
1258 + ps = pkgset_new(psflags | PSVERIFY_DEPS);
1259 + ps->pkgs = n_ref(pkgs);
1260 + pkgset_setup(ps, NULL);
1262 + pkgdir = n_array_nth(ps_dst->pkgdirs, 0);
1263 + for (i=0; i<n_array_size(ps->pkgs); i++) {
1264 + pkg = n_array_nth(ps->pkgs, i);
1265 + if (pkg_has_badreqs(pkg)) {
1266 + if (pkg->pkgdir != pkgdir) {
1267 + logn(LOGWARN, "%s: could not be moved\n", pkg_filename_s(pkg));
1270 + logn(LOGWARN, "%s: will be REMOVED from destination\n",
1271 + pkg_filename_s(pkg));
1272 + printf("merge: rm %s\n", pkg_path_s(pkg));
1274 + } else if (pkg->pkgdir != pkgdir)
1275 + printf("merge: mv %s %s\n", pkg_path_s(pkg), pkgdir->path);
1278 + while (n_array_size(rm_pkgs)) {
1279 + pkg = n_array_shift(rm_pkgs);
1280 + rpkg = n_array_shift(rm_pkgs);
1282 + if (pkg_has_badreqs(rpkg)) {
1283 + logn(LOGWARN, "%s: could not be moved\n", pkg_path_s(pkg));
1286 + printf("merge: rm %s\n", pkg_path_s(pkg));
1294 + n_array_free(pkgs);
1298 Index: installer/poldek/pkgset-req.c
1299 diff -u installer/poldek/pkgset-req.c:1.23 installer/poldek/pkgset-req.c:1.23.4.1
1300 --- installer/poldek/pkgset-req.c:1.23 Thu Nov 7 17:43:26 2002
1301 +++ installer/poldek/pkgset-req.c Wed Jul 23 18:15:11 2003
1312 static int add_reqpkg(struct pkg *pkg, struct capreq *req, struct pkg *dpkg)
1314 struct reqpkg *rpkg;
1315 - struct reqpkg tmp_rpkg = {NULL, 0, {NULL}};
1316 + struct reqpkg tmp_rpkg = {NULL, 0};
1318 tmp_rpkg.pkg = dpkg;
1319 rpkg = n_array_bsearch(pkg->reqpkgs, &tmp_rpkg);
1323 struct reqpkg *rpkg;
1324 - struct reqpkg tmp_rpkg = {NULL, 0, {NULL}};
1325 + struct reqpkg tmp_rpkg = {NULL, 0};
1328 flags |= capreq_is_prereq(req) ? REQPKG_PREREQ : 0;
1329 Index: installer/poldek/pkgset.h
1330 diff -u installer/poldek/pkgset.h:1.37 installer/poldek/pkgset.h:1.37.4.1
1331 --- installer/poldek/pkgset.h:1.37 Thu Nov 14 19:21:42 2002
1332 +++ installer/poldek/pkgset.h Wed Apr 2 16:54:08 2003
1336 #ifndef POLDEK_PKGSET_H
1337 #define POLDEK_PKGSET_H
1339 @@ -120,6 +120,10 @@
1340 void pkgset_free(struct pkgset *ps);
1342 int pkgset_setup(struct pkgset *ps, const char *pri_fpath);
1345 +void pkgset_merge(struct pkgset *ps_dst, struct pkgset *ps_src,
1346 + unsigned psflags);
1348 /* returns sorted list of packages, free it by n_array_free() */
1349 tn_array *pkgset_getpkgs(const struct pkgset *ps);
1350 Index: installer/poldek/poldek.spec.in
1351 diff -u installer/poldek/poldek.spec.in:1.20 installer/poldek/poldek.spec.in:1.20.4.1
1352 --- installer/poldek/poldek.spec.in:1.20 Thu Nov 7 18:41:07 2002
1353 +++ installer/poldek/poldek.spec.in Wed Jul 23 19:04:16 2003
1355 -# $Revision$, $Date$
1356 +# $Revision$, $Date$
1358 # spec is based on PLD's poldek.spec available at <http://cvs.pld.org.pl/SPECS/>
1361 Group: Applications/System
1362 Source0: http://team.pld.org.pl/~mis/poldek/download/%{name}-%{version}.tar.bz2
1363 URL: http://team.pld.org.pl/~mis/poldek/
1365 +#Requires: /bin/rpm
1366 BuildRequires: bzip2-devel
1367 -BuildRequires: db3-devel >= 3.1.14-2
1368 +#BuildRequires: db3-devel >= 3.1.14-2
1369 #BuildRequires: curl-devel >= 7.8
1370 BuildRequires: rpm-devel >= 4.0
1371 #BuildRequires: popt-static
1372 BuildRequires: openssl-devel
1373 BuildRequires: readline-devel
1374 BuildRequires: zlib-devel
1375 -BuildRequires: /usr/bin/pod2man
1376 +#BuildRequires: /usr/bin/pod2man
1377 BuildRequires: pcre-devel
1378 %{?_with_static:BuildRequires: bzip2-static}
1379 %{?_with_static:BuildRequires: curl-static}
1381 All persons listed below can be reached at <cvs_login>@pld.org.pl
1384 +Revision 1.20.4.1 2003/07/23 17:04:16 mis
1385 +- removed unneeded dependencies
1387 Revision 1.20 2002/11/07 17:41:07 mis
1388 - used tar.bz2 source
1390 Index: installer/poldek/rpm.c
1391 diff -u installer/poldek/rpm.c:1.41 installer/poldek/rpm.c:1.41.4.1
1392 --- installer/poldek/rpm.c:1.41 Fri Nov 22 18:07:26 2002
1393 +++ installer/poldek/rpm.c Sun Dec 7 21:58:15 2003
1402 #ifdef HAVE_CONFIG_H
1403 @@ -188,10 +188,10 @@
1404 while((dbrec = rpmdb_it_get(&it)) != NULL) {
1405 if (dbpkg_array_has(unistdbpkgs, dbrec->recno) ||
1406 dbpkg_array_has(cnfldbpkgs, dbrec->recno))
1410 n_array_push(cnfldbpkgs, dbpkg_new(dbrec->recno, dbrec->h, ldflags));
1414 rpmdb_it_destroy(&it);
1416 @@ -215,12 +215,12 @@
1417 rpmdb_it_init(db, &it, RPMITER_NAME, capreq_name(req));
1418 while ((dbrec = rpmdb_it_get(&it)) != NULL) {
1419 if (dbpkg_array_has(unistdbpkgs, dbrec->recno))
1423 if (header_evr_match_req(dbrec->h, req)) {
1431 rpmdb_it_destroy(&it);
1434 rpmdb_it_init(db, &it, RPMITER_FILE, capreq_name(req));
1435 while ((dbrec = rpmdb_it_get(&it)) != NULL) {
1436 if (dbpkg_array_has(unistdbpkgs, dbrec->recno))
1444 rpmdb_it_destroy(&it);
1446 @@ -288,11 +288,10 @@
1449 if (pkg_evr_match_req(&pkg, req)) {
1450 - DBGF("%s[%d] match %s!\n", pkg_snprintf_s(&pkg), pkg.epoch, capreq_snprintf_s0(req));
1451 + DBGF("%s[%d] match %s!\n", pkg_snprintf_s(&pkg), pkg.epoch,
1452 + capreq_snprintf_s0(req));
1461 rpmdbMatchIterator mi;
1462 mi = rpmdbInitIterator(db, RPMDBI_PACKAGES, NULL, 0);
1463 while ((h = rpmdbNextIterator(mi)) != NULL) {
1464 - unsigned int recno = rpmdbGetIteratorOffset(mi);
1465 + unsigned int recno = rpmdbGetIteratorOffset(mi);
1466 #ifdef HAVE_RPM_4_1 /* omit pubkeys */
1467 if (headerIsEntry(h, RPMTAG_PUBKEYS))
1472 mapfn(recno, h, arg);
1476 rpmdbFreeIterator(mi);
1477 #else /* !HAVE_RPM_4_0 */
1478 @@ -526,17 +525,25 @@
1480 const struct dbrec *dbrec;
1483 rpmdb_it_init(db, &it, RPMITER_NAME, pkg->name);
1484 count = rpmdb_it_get_count(&it);
1485 if (count > 0 && (cmprc || dbrecp)) {
1486 dbrec = rpmdb_it_get(&it);
1489 - *cmprc = -hdr_pkg_cmp_evr(dbrec->h, pkg);
1492 - dbrecp->recno = dbrec->recno;
1493 - dbrecp->h = headerLink(dbrec->h);
1495 + if (dbrec == NULL) {
1496 + log(LOGWARN, _("%s: rpm iterator returns NULL"
1497 + " (corrupted RPM database?). Ignored"), pkg->name);
1498 + count = 0; /* assume that package isn't installed */
1502 + *cmprc = -hdr_pkg_cmp_evr(dbrec->h, pkg);
1505 + dbrecp->recno = dbrec->recno;
1506 + dbrecp->h = headerLink(dbrec->h);
1511 Index: installer/poldek/rpm_signature.c
1512 diff -u installer/poldek/rpm_signature.c:1.4 installer/poldek/rpm_signature.c:1.4.4.2
1513 --- installer/poldek/rpm_signature.c:1.4 Fri Oct 18 12:34:03 2002
1514 +++ installer/poldek/rpm_signature.c Wed Jul 16 12:49:28 2003
1523 #ifdef HAVE_CONFIG_H
1526 static int rpm_read_signature(FD_t fd, Header *sighp, int sig_type)
1528 -#ifdef HAVE_RPM_4_1
1529 - return rpmReadSignature(fd, sighp, sig_type) == 0;
1530 +#ifdef HAVE_RPM_4_2
1531 + return rpmReadSignature(fd, sighp, sig_type, NULL) == 0;
1533 + return rpmReadSignature(fd, sighp, sig_type, NULL) == 0;
1535 return rpmReadSignature(fd, sighp, sig_type, NULL) == 0;
1537 Index: installer/poldek/rpmadds.c
1538 diff -u installer/poldek/rpmadds.c:1.8 installer/poldek/rpmadds.c:1.8.4.1
1539 --- installer/poldek/rpmadds.c:1.8 Thu Nov 7 17:43:26 2002
1540 +++ installer/poldek/rpmadds.c Tue Apr 15 19:03:02 2003
1549 #ifdef HAVE_CONFIG_H
1555 int rpm_headerReadFD(FD_t fdt, Header *hdr, const char *path)
1559 -#ifdef HAVE_RPM_4_1
1560 +#ifndef HAVE_RPM_4_1
1561 + rc = rpmReadPackageHeader(fdt, hdr, NULL, NULL, NULL);
1564 rpmts ts = rpmtsCreate();
1566 + rpmtsSetVSFlags(ts, RPMVSF_NODSA | RPMVSF_NORSA | RPMVSF_NOMD5);
1567 rpmrc = rpmReadPackageFile(ts, fdt, path, hdr);
1569 case RPMRC_NOTTRUSTED:
1576 - rc = rpmReadPackageHeader(fdt, hdr, NULL, NULL, NULL);
1582 logn(LOGERR, _("%s: read header failed"), path);
1584 -#ifdef HAVE_RPM_4_1
1591 Index: installer/poldek/rpmvercmp.c
1592 diff -u installer/poldek/rpmvercmp.c:1.5 installer/poldek/rpmvercmp.c:1.5.6.1
1593 --- installer/poldek/rpmvercmp.c:1.5 Mon May 13 22:27:17 2002
1594 +++ installer/poldek/rpmvercmp.c Tue Dec 30 19:15:08 2003
1597 +#include <string.h>
1599 #include <rpm/rpmlib.h>
1601 Index: installer/poldek/test_match.c
1602 diff -u installer/poldek/test_match.c:1.8 installer/poldek/test_match.c:1.8.4.1
1603 --- installer/poldek/test_match.c:1.8 Thu Nov 7 17:43:26 2002
1604 +++ installer/poldek/test_match.c Fri Dec 19 02:29:31 2003
1618 -int test_match(int argc, char *argv[])
1619 +int old_test_match(int argc, char *argv[])
1627 - snprintf(evr, sizeof(evr), "1:1.1");
1628 + snprintf(evr, sizeof(evr), "0:1.1");
1629 req = capreq_new_evr("poldek", n_strdup(evr), rels[k++], 0);
1631 rc1 = pkg_match_req(pkg, req, 1) ? 1:0;
1636 -int test_match_(int epoch, char *ver, char *rel, char *evr, int relation)
1638 +int test_match(int epoch, char *ver, char *rel, char *evr, int relation)
1641 - struct capreq *req;
1643 + struct capreq *req, *cap;
1646 pkg = pkg_new("poldek", epoch, ver, rel, NULL, NULL, 0, 0, 0);
1647 + cap = capreq_new("poldek", epoch, ver, rel, REL_EQ, 0);
1649 req = capreq_new_evr("poldek", n_strdup(evr), relation, 0);
1651 - rc1 = pkg_match_req(pkg, req, 1) ? 1:0;
1652 - printf("P %s[%d] match %s ? %s\n", pkg_snprintf_s(pkg),
1653 - pkg->epoch, capreq_snprintf_s(req),
1654 - rc1 ? "YES" : "NO");
1655 + rc = pkg_match_req(pkg, req, 1) ? 1:0;
1656 + printf("pkg %s match req %s ? %s\n", pkg_snprintf_epoch_s(pkg),
1657 + capreq_snprintf_s(req), rc ? "YES" : "NO");
1659 + rc = cap_match_req(cap, req, 1) ? 1:0;
1660 + printf("cap %s match req %s ? %s\n", capreq_snprintf_s0(cap),
1661 + capreq_snprintf_s(req), rc ? "YES" : "NO");
1667 -int test_match2(void)
1671 - test_match_(0, "1.2", "1", "0:1.1", REL_GT);
1672 - test_match_(3, "1.2", "1", "0:1.1", REL_GT);
1673 - test_match_(0, "1.2", "1", "3:1.1", REL_GT);
1674 + test_match(1, "5.8.2", "2", "0:5.00403", REL_GT);
1675 + test_match(3, "1.2", "1", "0:1.1", REL_GT);
1676 + test_match(0, "1.2", "1", "3:1.1", REL_GT);
1678 - test_match_(0, "1.2", "1", "1:1.1", REL_GT);
1679 - test_match_(1, "1.2", "1", "0:1.1", REL_GT);
1680 + test_match(0, "1.2", "1", "1:1.1", REL_GT);
1681 + test_match(1, "1.2", "1", "0:1.1", REL_GT);
1684 - test_match_(0, "1.2", "1", "0:1.2", REL_EQ);
1685 - test_match_(3, "1.2", "1", "0:1.2", REL_EQ);
1686 - test_match_(0, "1.2", "1", "3:1.2", REL_EQ);
1687 + test_match(0, "1.2", "1", "0:1.2", REL_EQ);
1688 + test_match(3, "1.2", "1", "0:1.2", REL_EQ);
1689 + test_match(0, "1.2", "1", "3:1.2", REL_EQ);
1691 - test_match_(0, "1.2", "1", "1:1.2", REL_EQ);
1692 - test_match_(1, "1.2", "1", "0:1.2", REL_EQ);
1693 + test_match(0, "1.2", "1", "1:1.2", REL_EQ);
1694 + test_match(1, "1.2", "1", "0:1.2", REL_EQ);
1697 - test_match_(0, "1.2", "1", "1:2.2", REL_EQ | REL_GT);
1698 - test_match_(1, "1.2", "1", "1:1.2", REL_EQ | REL_GT);
1699 - test_match_(1, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
1700 - test_match_(2, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
1701 - test_match_(3, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
1702 + test_match(0, "1.2", "1", "1:2.2", REL_EQ | REL_GT);
1703 + test_match(1, "1.2", "1", "1:1.2", REL_EQ | REL_GT);
1704 + test_match(1, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
1705 + test_match(2, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
1706 + test_match(3, "1.2", "1", "2:1.2", REL_EQ | REL_GT);
1710 @@ -136,8 +141,12 @@
1711 int main(int argc, char *argv[])
1714 - //test_expand_env(argc, argv);
1716 + log_init(NULL, stdout, "");
1718 + if (argc > 1 && strcmp(argv[1], "--promote") == 0)
1719 + poldek_conf_promote_epoch = 1;
1722 log_init(NULL, stdout, "aa");
1724 db = rpm_opendb("/var/lib/rpm", "/", O_RDONLY);
1725 Index: installer/poldek/usrset.c
1726 diff -u installer/poldek/usrset.c:1.12 installer/poldek/usrset.c:1.12.6.1
1727 --- installer/poldek/usrset.c:1.12 Thu Apr 25 18:34:12 2002
1728 +++ installer/poldek/usrset.c Tue Dec 30 19:19:52 2003
1739 if (release == NULL)
1742 - pdef->pkg = pkg_new(name, epoch, version, release, NULL, NULL,
1743 + pdef->pkg = pkg_new(name, epoch, version, release, NULL, NULL, NULL,
1747 Index: installer/poldek/vfcompr
1748 diff -u /dev/null installer/poldek/vfcompr:1.1.2.1
1749 --- /dev/null Fri Jan 9 13:45:49 2004
1750 +++ installer/poldek/vfcompr Fri Dec 19 02:29:31 2003
1755 +PATH="/bin:/sbin:/usr/bin:/usr/sbin"
1761 + cmd="bzip2 --stdout ${src}"
1762 + if echo ${dest} | egrep ".gz" >/dev/null; then
1763 + cmd="gzip -9nf --stdout ${src}"
1765 + echo "$cmd > $dest"
1766 + $cmd > $dest && rm -f $src
1773 + cmd="bunzip2 --keep --stdout ${src}"
1774 + if echo ${src} | egrep ".gz" >/dev/null; then
1775 + cmd="gunzip --stdout ${src}"
1777 + echo "$cmd > $dest"
1778 + #echo -e "$cmd\n -> ${dest}"
1783 + echo "usage: `basename $0` FILE DESTFILE[.gz][.bz2]"
1784 + echo " `basename $0` -d FILE DESTFILE[.gz][.bz2]"
1787 +if [ "$#" -lt 2 ]; then
1793 +if [ "$un" == "-d" ]; then
1795 + if [ "$#" -lt 3 ]; then
1807 +#if [ ! -r $src -o ! -f $src ]; then
1808 +# echo "$src: no such file"
1812 +if [ -r $dest ]; then
1813 + echo "$dest: file exists"
1818 +if [ $dest == $src ]; then
1819 + echo "dest and src are the same"
1823 +if [ -z "$un" ]; then
1826 + uncompr $src $dest
1829 Index: installer/poldek/vfuncompr
1830 diff -u installer/poldek/vfuncompr:1.1 installer/poldek/vfuncompr:removed
1831 --- installer/poldek/vfuncompr:1.1 Mon Apr 8 03:14:41 2002
1832 +++ installer/poldek/vfuncompr Fri Jan 9 13:45:49 2004
1837 -PATH="/bin:/sbin:/usr/bin:/usr/sbin"
1839 -if [ "$#" != "2" ]; then
1840 - echo "usage: `basename $0` FILE[.gz][.bz2] DESTFILE"
1847 -cmd="bunzip2 --keep --stdout ${src}"
1848 -if echo ${src} | egrep ".gz" >/dev/null; then
1849 - cmd="gunzip --stdout ${src}"
1852 -if [ ! -r $src -o ! -f $src ]; then
1853 - echo "$src: no such file"
1857 -if [ -r $dest ]; then
1858 - echo "$dest: file exists"
1862 -if [ $dest == $src ]; then
1863 - echo "dest and src are the same"
1868 -echo -e "$cmd\n -> ${dest}"
1872 Index: installer/poldek/conf/rh.src
1873 diff -u installer/poldek/conf/rh.src:1.4 installer/poldek/conf/rh.src:1.4.6.1
1874 --- installer/poldek/conf/rh.src:1.4 Mon Jun 3 17:27:04 2002
1875 +++ installer/poldek/conf/rh.src Thu Sep 18 01:43:01 2003
1881 +source1 = rh,noautoup,type=hdrl,pri=-1 \
1882 + ftp://ftp.uninett.no/pub/linux/apt/redhat/9/en/i386/redhat/base/pkglist.os.bz2
1884 -# RedHat 7.3; package info is taken from hdlist file
1885 -source1 = rh,noautoup,type=hdrl \
1886 - ftp://ftp.redhat.com/pub/redhat/redhat-7.3-en/os/i386/RedHat/base/hdlist
1887 +prefix1 = ftp://ftp.uninett.no/pub/linux/apt/redhat/9/en/i386/redhat/RPMS.os
1889 -prefix1 = ftp://ftp.redhat.com/pub/redhat/redhat-7.3-en/os/i386/RedHat/RPMS/
1890 +source2 = rh-up,noautoup,type=hdrl,pri=-1 \
1891 + ftp://ftp.uninett.no/pub/linux/apt/redhat/9/en/i386/redhat/base/pkglist.updates-os.bz2
1893 +prefix2 = ftp://ftp.uninett.no/pub/linux/apt/redhat/9/en/i386/redhat/RPMS.updates-os
1895 -# RedHat 7.2; package info is taken from hdlist file
1896 -source2 = rh7.2,noautoup,type=hdrl \
1897 - ftp://ftp.redhat.com/pub/redhat/redhat-7.2-en/os/i386/RedHat/base/hdlist
1899 -prefix2 = ftp://ftp.redhat.com/pub/redhat/redhat-7.2-en/os/i386/RedHat/RPMS/
1902 -source3 = rh6.2,noautoup,noauto,type=hdrl \
1903 - ftp://ftp.redhat.com/pub/redhat/redhat-6.2-en/os/i386/RedHat/base/hdlist
1905 +source8 = rh8,noautoup,noauto,type=hdrl \
1906 + ftp://ftp.uninett.no/pub/linux/apt/redhat/8.0/en/i386/redhat/base/pkglist.os.bz2
1908 +prefix8 = ftp://ftp.uninett.no/pub/linux/apt/redhat/8.0/en/i386/redhat/RPMS.os
1910 -prefix3 = ftp://ftp.redhat.com/pub/redhat/redhat-6.2-en/os/i386/RedHat/RPMS/
1911 Index: installer/poldek/shell/desc.c
1912 diff -u installer/poldek/shell/desc.c:1.18 installer/poldek/shell/desc.c:1.18.4.1
1913 --- installer/poldek/shell/desc.c:1.18 Thu Nov 7 17:43:28 2002
1914 +++ installer/poldek/shell/desc.c Sun Dec 7 22:30:46 2003
1931 if ((pkgu = pkg_info(pkg)) == NULL) {
1932 @@ -674,10 +675,11 @@
1938 + tmpt = pkg->btime;
1939 strftime(timbuf, sizeof(timbuf), "%Y/%m/%d %H:%M",
1940 - localtime((time_t*)&pkg->btime));
1942 + localtime(&tmpt));
1946 if (pkgu->summary) {
1947 Index: installer/poldek/shell/ls.c
1948 diff -u installer/poldek/shell/ls.c:1.20 installer/poldek/shell/ls.c:1.20.4.1
1949 --- installer/poldek/shell/ls.c:1.20 Thu Nov 7 17:43:28 2002
1950 +++ installer/poldek/shell/ls.c Sun Dec 7 22:30:46 2003
1963 double pkgsize = pkg->size/1024;
1966 if (pkgsize >= 1024) {
1968 @@ -401,10 +402,11 @@
1970 snprintf(sizbuf, sizeof(sizbuf), "%.1f %cB", pkgsize, unit);
1974 + tmpt = pkg->btime;
1975 strftime(timbuf, sizeof(timbuf), "%Y/%m/%d %H:%M",
1976 - localtime((time_t*)&pkg->btime));
1978 + localtime(&tmpt));
1982 if ((flags & OPT_LS_UPGRADEABLE) == 0) {
1983 Index: installer/poldek/vfile/uncompr.c
1984 diff -u installer/poldek/vfile/uncompr.c:1.2 installer/poldek/vfile/uncompr.c:1.2.6.1
1985 --- installer/poldek/vfile/uncompr.c:1.2 Wed Apr 17 00:33:40 2002
1986 +++ installer/poldek/vfile/uncompr.c Fri Dec 19 02:16:56 2003
1988 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1999 struct uncompr uncompr_tab[] = {
2000 - { COMPRESST_BZIP2, "/usr/bin/vfuncompr", "bz2" },
2001 - { COMPRESST_GZIP, "/usr/bin/vfuncompr", "gz" },
2002 + { COMPRESST_BZIP2, "/usr/bin/vfcompr", "bz2" },
2003 + { COMPRESST_GZIP, "/usr/bin/vfcompr", "gz" },
2011 -int vf_do_uncompr(struct uncompr *uncompr, const char *src, const char *dst)
2012 +int vf_do_compr(struct uncompr *uncompr, const char *param,
2013 + const char *src, const char *dst)
2016 struct p_open_st pst;
2017 @@ -112,16 +113,15 @@
2018 argv = alloca(sizeof(*argv) * 10);
2020 argv[n++] = uncompr->cmd;
2022 + argv[n++] = (char*)param;
2024 argv[n++] = (char*)src;
2025 argv[n++] = (char*)dst;
2028 - if (*vfile_verbose)
2029 - vfile_msg_fn(_("Uncompressing %s...\n"), n_basenam(src));
2034 verbose = *vfile_verbose;
2035 if (p_open(&pst, p_open_flags, uncompr->cmd, argv) == NULL) {
2036 vfile_err_fn("p_open: %s\n", pst.errmsg);
2037 @@ -185,8 +185,36 @@
2040 vf_localunlink(destpath);
2041 + if (*vfile_verbose)
2042 + vfile_msg_fn(_("Uncompressing %s...\n"), n_basenam(path));
2043 + return vf_do_compr(uncompr, "-d", path, destpath);
2047 +int vf_compr_do(const char *path, const char *ext)
2049 + struct uncompr *uncompr;
2050 + char destpath[PATH_MAX];
2054 - return vf_do_uncompr(uncompr, path, destpath);
2057 + while (uncompr_tab[i].type > 0) {
2058 + if (strcmp(ext, uncompr_tab[i].ext) == 0)
2059 + uncompr = &uncompr_tab[i];
2064 + if (uncompr == NULL)
2067 + snprintf(destpath, sizeof(destpath), "%s.%s", path, ext);
2069 + if (*vfile_verbose)
2070 + vfile_msg_fn(_("Compressing %s...\n"), n_basenam(path));
2071 + return vf_do_compr(uncompr, NULL, path, destpath);
2075 Index: installer/poldek/vfile/vfile.c
2076 diff -u installer/poldek/vfile/vfile.c:1.43 installer/poldek/vfile/vfile.c:1.43.4.2
2077 --- installer/poldek/vfile/vfile.c:1.43 Tue Oct 29 17:55:56 2002
2078 +++ installer/poldek/vfile/vfile.c Mon Dec 29 21:11:14 2003
2086 #ifdef HAVE_CONFIG_H
2087 # include "config.h"
2088 @@ -491,8 +491,19 @@
2091 if (vfmode & VFM_UNCOMPR) {
2092 - if ((rpath = vfuncompr(path, buf, sizeof(buf))) == NULL)
2094 + if (vfmode & VFM_RW) {
2095 + if (vf_uncompr_able(path)) {
2097 + n_snprintf(buf, sizeof(buf), path);
2098 + p = strrchr(buf, '.');
2104 + if ((rpath = vfuncompr(path, buf, sizeof(buf))) == NULL)
2109 if (openvf(&vf, rpath, vfmode))
2110 @@ -646,6 +657,18 @@
2114 + if (vf->vf_path && (vf->vf_mode & VFM_UNCOMPR) && (vf->vf_mode & VFM_RW)) {
2115 + if (vf_uncompr_able(vf->vf_path)) {
2116 + char src[PATH_MAX], *p;
2117 + snprintf(src, sizeof(src), vf->vf_path);
2118 + p = strrchr(src, '.');
2121 + vf_compr_do(src, "gz");
2129 Index: installer/poldek/vfile/vfile.h
2130 diff -u installer/poldek/vfile/vfile.h:1.29 installer/poldek/vfile/vfile.h:1.29.4.1
2131 --- installer/poldek/vfile/vfile.h:1.29 Thu Nov 7 17:43:29 2002
2132 +++ installer/poldek/vfile/vfile.h Fri Dec 19 02:16:56 2003
2134 59 Place - Suite 330, Boston, MA 02111-1307, USA.
2140 #ifndef POLDEK_VFILE_H
2141 #define POLDEK_VFILE_H
2145 int vf_uncompr_able(const char *path);
2146 +int vf_compr_do(const char *path, const char *ext);
2147 int vf_uncompr_do(const char *path, const char *destpath);
2149 void vf_sigint_cb(void);