1 --- poldek-0.18.6.orig/conf.c 2004-09-15 16:03:02.000000000 +0000
2 +++ poldek-0.18.6/conf.c 2004-09-15 18:56:34.000000000 +0000
4 { "ftp_sysuser_as_anon_passwd", TYPE_BOOL , { 0 } },
5 { "vfile_external_compress", TYPE_BOOL, { 0 } },
6 { "promoteepoch", TYPE_BOOL, { 0 } },
7 + { "nodistver", TYPE_BOOL, { 0 } },
11 --- poldek-0.18.6.orig/main.c 2004-09-15 16:03:02.000000000 +0000
12 +++ poldek-0.18.6/main.c 2004-09-15 19:32:03.000000000 +0000
15 #define OPT_NOASK 2007
16 #define OPT_RPMOPT 2008
17 +#define OPT_NODISTVER 2009
18 #define OPT_MERGE 2101
19 #define OPT_SW_V016 (1 << 0)
20 #define OPT_SW_NOASK (1 << 1)
23 {"conf", OPT_CONF, "FILE", 0, N_("Read configuration from FILE"), 500 },
24 {"noconf", OPT_NOCONF, 0, 0, N_("Do not read configuration"), 500 },
25 +{"nodistver", OPT_NODISTVER, 0, 0, N_("Do not check distribution versions"),
28 {"version", OPT_BANNER, 0, 0, N_("Display program version information and exit"), 500 },
29 {"log", OPT_LOG, "FILE", 0, N_("Log program messages to FILE"), 500 },
31 n_array_push(argsp->inst.rpmacros, arg);
35 + n_assert(argsp->inst.rpmacros);
36 + n_array_push(argsp->inst.rpmacros,
37 + n_strdup("_dont_compare_distversion 1"));
43 @@ -1385,6 +1394,15 @@
44 if (conf_get_bool(htcnf, "particle_install", 1))
45 args.inst.flags |= INSTS_PARTICLE;
47 + if (no_distver == 0) { /* no --nodistver specified */
48 + if (conf_get_bool(htcnf, "nodistver", 0))
50 + n_assert(args.inst.rpmacros);
51 + n_array_push(args.inst.rpmacros,
52 + n_strdup("_dont_compare_distversion 1"));
57 if ((args.inst.flags & INSTS_GREEDY) == 0) { /* no --greedy specified */
58 if (conf_get_bool(htcnf, "greedy", 1))
59 --- poldek-0.18.6.orig/misc.h 2004-06-28 20:19:28.000000000 +0000
60 +++ poldek-0.18.6/misc.h 2004-09-15 17:09:29.000000000 +0000
62 #include <vfile/p_open.h>
63 #include <trurl/narray.h>
65 +extern int no_distver;
67 const char *ngettext_n_packages_fmt(int n);
68 void translate_argp_options(struct argp_option *arr);
70 --- poldek-0.18.6.orig/pkg.c 2004-09-15 16:03:02.000000000 +0000
71 +++ poldek-0.18.6/pkg.c 2004-09-15 17:19:00.000000000 +0000
73 struct pkg *pkg_new(const char *name, int32_t epoch,
74 const char *version, const char *release,
75 const char *arch, const char *os,
77 + const char *fn, const char *dist,
78 uint32_t size, uint32_t fsize,
82 int name_len = 0, version_len = 0, release_len = 0,
83 - arch_len = 0, os_len = 0, fn_len = 0;
84 + arch_len = 0, os_len = 0, fn_len = 0, dist_len = 0;
93 + dist_len = strlen(dist);
94 + len += dist_len + 1;
107 + memcpy(buf, dist, dist_len);
117 uint32_t *epoch, *size, *btime;
118 char *name, *version, *release, *arch = NULL, *os = NULL;
122 headerNVR(h, (void*)&name, (void*)&version, (void*)&release);
124 if (type != RPM_STRING_TYPE)
127 + if (!headerGetEntry(h, RPMTAG_DISTRIBUTION, &type, (void *)&dist, NULL)) {
131 + if (type != RPM_STRING_TYPE)
134 if (!headerGetEntry(h, RPMTAG_OS, &type, (void *)&os, NULL)) {
136 logn(LOGWARN, _("%s: missing OS tag"), fname);
140 pkg = pkg_new(name, epoch ? *epoch : 0, version, release, arch, os,
141 - fname ? n_basenam(fname) : NULL,
142 + fname ? n_basenam(fname) : NULL, dist,
143 size ? *size : 0, fsize, btime ? *btime : 0);
147 return pkg_cmp_ver(p1, p2);
150 +int pkg_cmp_dist_evr(const struct pkg *p1, const struct pkg *p2)
154 + if(p1->dist && p2->dist)
156 + rc = rpmdistcmp(p1->dist, p2->dist);
161 + return pkg_cmp_evr(p1, p2);
164 int pkg_cmp_evr(const struct pkg *p1, const struct pkg *p2)
170 +int pkg_cmp_name_dist_evr_rev(const struct pkg *p1, const struct pkg *p2)
174 + if ((rc = pkg_cmp_name(p1, p2)))
177 + return -pkg_cmp_dist_evr(p1, p2);
180 int pkg_cmp_name_evr_rev_srcpri(const struct pkg *p1, const struct pkg *p2)
183 return pkg_cmp_name_evr_rev(p1, p2);
186 +int pkg_cmp_dist_pri(struct pkg *p1, struct pkg *p2)
188 + register int cmprc = 0;
190 + if ((cmprc = p1->pri - p2->pri))
193 + return pkg_cmp_name_dist_evr_rev(p1, p2);
196 int pkg_cmp_btime(struct pkg *p1, struct pkg *p2)
198 @@ -1352,8 +1404,12 @@
202 - arr = n_array_new(size, (tn_fn_free)pkg_free,
204 + arr = n_array_new(size, (tn_fn_free)pkg_free,
205 (tn_fn_cmp)pkg_cmp_name_evr_rev);
207 + arr = n_array_new(size, (tn_fn_free)pkg_free,
208 + (tn_fn_cmp)pkg_cmp_name_dist_evr_rev);
209 n_array_ctl(arr, TN_ARRAY_AUTOSORTED);
212 --- poldek-0.18.6.orig/pkg.h 2004-03-22 17:31:51.000000000 +0000
213 +++ poldek-0.18.6/pkg.h 2004-09-15 16:11:48.000000000 +0000
220 tn_array *caps; /* capabilities */
221 tn_array *reqs; /* requirements */
223 struct pkg *pkg_new(const char *name, int32_t epoch,
224 const char *version, const char *release,
225 const char *arch, const char *os,
227 + const char *fn, const char *dist,
228 uint32_t size, uint32_t fsize,
232 int pkg_cmp_name_evr_rev_srcpri(const struct pkg *p1, const struct pkg *p2);
234 int pkg_cmp_pri(struct pkg *p1, struct pkg *p2);
235 +int pkg_cmp_dist_pri(struct pkg *p1, struct pkg *p2);
237 int pkg_cmp_btime(struct pkg *p1, struct pkg *p2);
238 int pkg_cmp_btime_rev(struct pkg *p1, struct pkg *p2);
239 --- poldek-0.18.6.orig/pkgdir.c 2004-05-06 07:57:31.000000000 +0000
240 +++ poldek-0.18.6/pkgdir.c 2004-09-15 17:52:26.000000000 +0000
243 int pkgdir_v016compat = 0; /* public */
244 int pkgdir_redhat9_zlib_in_rpm_workaround = 0;
247 #define PKGT_HAS_NAME (1 << 0)
248 #define PKGT_HAS_EVR (1 << 1)
250 #define PKGT_HAS_BTIME (1 << 11)
251 #define PKGT_HAS_GROUPID (1 << 12)
252 #define PKGT_HAS_FN (1 << 13)
253 +#define PKGT_HAS_DIST (1 << 14)
265 @@ -1093,6 +1096,7 @@
270 if (!add2pkgtags(&pkgt, *line, val, pkgdir->path, offs)) {
273 @@ -1320,6 +1324,16 @@
278 + if (pkgt->flags & PKGT_HAS_DIST) {
279 + logn(LOGERR, errmg_double_tag, pathname, offs, tag);
282 + memcpy(pkgt->dist, value, sizeof(pkgt->dist) - 1);
283 + pkgt->dist[ sizeof(pkgt->dist) - 1 ] = '\0';
284 + pkgt->flags |= PKGT_HAS_DIST;
289 if (pkgt->flags & PKGT_HAS_SIZE) {
290 @@ -1393,7 +1407,7 @@
291 struct pkg *pkg_new_from_tags(struct pkgtags_s *pkgt)
294 - char *version, *release, *arch = NULL, *os = NULL, *fn = NULL;
295 + char *version, *release, *arch = NULL, *os = NULL, *fn = NULL, *dist = NULL;
298 if (!(pkgt->flags & (PKGT_HAS_NAME | PKGT_HAS_EVR)))
299 @@ -1407,6 +1421,9 @@
301 if (pkgt->flags & PKGT_HAS_FN)
304 + if (pkgt->flags & PKGT_HAS_DIST)
307 if (*pkgt->name == '\0' || *pkgt->evr == '\0' || *pkgt->arch == '\0')
309 @@ -1419,7 +1436,7 @@
313 - pkg = pkg_new(pkgt->name, epoch, version, release, arch, os, fn,
314 + pkg = pkg_new(pkgt->name, epoch, version, release, arch, os, fn, dist,
315 pkgt->size, pkgt->fsize, pkgt->btime);
316 pkg->groupid = pkgt->groupid;
318 @@ -1488,7 +1505,7 @@
320 if (*p && parse_nevr(p, &name, &epoch, &ver, &rel)) {
321 struct pkg *pkg = pkg_new(name, epoch, ver, rel, NULL, NULL, NULL,
324 n_array_push(pkgs, pkg);
327 --- poldek-0.18.6.orig/pkgdir_save.c 2004-05-05 16:56:43.000000000 +0000
328 +++ poldek-0.18.6/pkgdir_save.c 2004-09-15 19:28:21.000000000 +0000
332 fprintf(stream, "n: %s\n", pkg->fn);
334 + if (pkg->dist && !no_distver)
335 + fprintf(stream, "D: %s\n", pkg->dist);
337 fprintf(stream, "F:\n");
338 store_pkg_fields(stream, pkg->size, pkg->fsize, pkg->btime, pkg->groupid);
339 --- poldek-0.18.6.orig/pkgset-install.c 2004-09-15 16:03:02.000000000 +0000
340 +++ poldek-0.18.6/pkgset-install.c 2004-09-15 17:20:34.000000000 +0000
341 @@ -1995,7 +1995,7 @@
342 if (is_installed == 0)
343 n_array_push(iinf->uninstalled_pkgs,
344 pkg_new(pkg->name, pkg->epoch, pkg->ver, pkg->rel,
345 - pkg->arch, pkg->os, NULL,
346 + pkg->arch, pkg->os, NULL, NULL,
347 pkg->size, pkg->fsize,
350 @@ -2186,10 +2186,14 @@
351 struct upgrade_s *upg = upgptr;
352 struct pkg *pkg, tmpkg;
355 + int i, cmprc, type, count;
360 + if (!(headerGetEntry(h, RPMTAG_DISTRIBUTION, &type, (void *)&tmpkg.dist,
361 + &count) && type == RPM_STRING_TYPE && count == 1))
364 if (!rpmhdr_nevr(h, &tmpkg.name, &epoch, &tmpkg.ver, &tmpkg.rel)) {
365 logn(LOGERR, _("db package header corrupted (!?)"));
366 @@ -2205,7 +2209,10 @@
369 pkg = n_array_nth(upg->avpkgs, i);
370 - cmprc = pkg_cmp_evr(pkg, &tmpkg);
372 + cmprc = pkg_cmp_evr(pkg, &tmpkg);
374 + cmprc = pkg_cmp_dist_evr(pkg, &tmpkg);
377 msg(3, "%-32s up to date\n", pkg_snprintf_s(&tmpkg));
378 --- poldek-0.18.6.orig/rpm.c 2004-09-15 16:03:02.000000000 +0000
379 +++ poldek-0.18.6/rpm.c 2004-09-15 17:24:02.000000000 +0000
385 +int hdr_pkg_cmp_dist_evr(Header h, const struct pkg *pkg)
393 + if (!(headerGetEntry(h, RPMTAG_DISTRIBUTION, &type, (void *)&tmpkg.dist,
394 + &count) && type == RPM_STRING_TYPE && count == 1))
397 + headerNVR(h, (void*)&tmpkg.name, (void*)&tmpkg.ver,
398 + (void*)&tmpkg.rel);
400 + if (tmpkg.name == NULL || tmpkg.ver == NULL || tmpkg.rel == NULL) {
401 + logn(LOGERR, "headerNVR() failed");
405 + if (headerGetEntry(h, RPMTAG_EPOCH, &rc, (void *)&epoch, NULL))
406 + tmpkg.epoch = *epoch;
410 + rc = pkg_cmp_dist_evr(&tmpkg, pkg);
416 int hdr_pkg_cmp_evr(Header h, const struct pkg *pkg)
421 - *cmprc = -hdr_pkg_cmp_evr(dbrec->h, pkg);
423 + *cmprc = -hdr_pkg_cmp_evr(dbrec->h, pkg);
425 + *cmprc = -hdr_pkg_cmp_dist_evr(dbrec->h, pkg);
428 dbrecp->recno = dbrec->recno;
429 --- poldek-0.18.6.orig/shell/shell.c 2004-09-15 16:03:02.000000000 +0000
430 +++ poldek-0.18.6/shell/shell.c 2004-09-15 17:18:04.000000000 +0000
434 if (compare_ver == 0)
435 - *cmprc = pkg_cmp_evr(lshpkg->pkg, shpkg->pkg);
437 + *cmprc = pkg_cmp_evr(lshpkg->pkg, shpkg->pkg);
439 + *cmprc = pkg_cmp_dist_evr(lshpkg->pkg, shpkg->pkg);
441 *cmprc = pkg_cmp_ver(lshpkg->pkg, shpkg->pkg);
443 --- poldek-0.18.6.orig/test_match.c 2004-05-05 16:57:09.000000000 +0000
444 +++ poldek-0.18.6/test_match.c 2004-09-15 16:11:48.000000000 +0000
448 pkg = pkg_new("poldek", epoch, versions[i], relases[j],
449 - NULL, NULL, NULL, 0, 0, 0);
450 + NULL, NULL, NULL, NULL, 0, 0, 0);
451 cap = capreq_new("poldek", epoch, versions[i++], relases[j++],
455 struct capreq *req, *cap;
458 - pkg = pkg_new("poldek", epoch, ver, rel, NULL, NULL, NULL, 0, 0, 0);
459 + pkg = pkg_new("poldek", epoch, ver, rel, NULL, NULL, NULL, NULL, 0, 0, 0);
460 cap = capreq_new("poldek", epoch, ver, rel, REL_EQ, 0);
462 req = capreq_new_evr("poldek", n_strdup(evr), relation, 0);
463 --- poldek-0.18.6.orig/usrset.c 2004-09-15 16:03:02.000000000 +0000
464 +++ poldek-0.18.6/usrset.c 2004-09-15 16:11:48.000000000 +0000
468 pdef->pkg = pkg_new(name, epoch, version, release, NULL, NULL, NULL,