rpm/weakdeps.diff

288 lines
11 KiB
Diff
Raw Normal View History

Add support for weak dependencies:
A) use RPMTAG_SUGGESTS and RPMTAG_ENHANCES to store them.
This is different to upstream, which uses RPMSENSE_MISSINGOK
and RPMTAG_REQUIRES/RPMTAG_PROVIDES instead. I chose different
tags because I wanted to be compatible. The point is that
applications that don't know about the new MISSINGOK semantics
will mis-interpret the provides/requires otherwise, which
I deemed to risky.
B) use RPMSENSE_STRONG to support a "strong" version, "Recommends"
instead of "Suggests" and "Supplements" instead of "Enhances".
Needs extcond.diff for query operations.
--- ./build/parsePreamble.c.orig 2013-06-27 09:28:49.000000000 +0000
+++ ./build/parsePreamble.c 2013-07-12 11:32:45.000000000 +0000
@@ -341,6 +341,8 @@ static struct tokenBits_s const installS
{ "verify", RPMSENSE_SCRIPT_VERIFY },
{ "pretrans", RPMSENSE_PRETRANS },
{ "posttrans", RPMSENSE_POSTTRANS },
+ { "hint", RPMSENSE_MISSINGOK },
+ { "strong", RPMSENSE_STRONG },
{ NULL, 0 }
};
@@ -795,6 +797,18 @@ static rpmRC handlePreambleTag(rpmSpec s
if (parseRCPOT(spec, spec->sourcePackage, field, tag, 0, tagflags))
goto exit;
break;
+ case RPMTAG_SUGGESTSFLAGS:
+ case RPMTAG_ENHANCESFLAGS:
+ case RPMTAG_BUILDSUGGESTS:
+ case RPMTAG_BUILDENHANCES:
+ tagflags = RPMSENSE_MISSINGOK;
+ if (macro && (!strcmp(macro, "recommends") || !strcmp(macro, "buildrecommends")))
+ tagflags |= RPMSENSE_STRONG;
+ if (macro && (!strcmp(macro, "supplements") || !strcmp(macro, "buildsupplements")))
+ tagflags |= RPMSENSE_STRONG;
+ if ((rc = parseRCPOT(spec, pkg, field, tag, 0, tagflags)))
+ return rc;
+ break;
case RPMTAG_EXCLUDEARCH:
case RPMTAG_EXCLUSIVEARCH:
case RPMTAG_EXCLUDEOS:
@@ -903,6 +917,14 @@ static struct PreambleRec_s const preamb
{RPMTAG_BUGURL, 0, 0, LEN_AND_STR("bugurl")},
{RPMTAG_COLLECTIONS, 0, 0, LEN_AND_STR("collections")},
{RPMTAG_ORDERFLAGS, 2, 0, LEN_AND_STR("orderwithrequires")},
+ {RPMTAG_SUGGESTSFLAGS, 0, 0, LEN_AND_STR("recommends")},
+ {RPMTAG_SUGGESTSFLAGS, 0, 0, LEN_AND_STR("suggests")},
+ {RPMTAG_ENHANCESFLAGS, 0, 0, LEN_AND_STR("supplements")},
+ {RPMTAG_ENHANCESFLAGS, 0, 0, LEN_AND_STR("enhances")},
+ {RPMTAG_BUILDSUGGESTS, 0, 0, LEN_AND_STR("buildrecommends")},
+ {RPMTAG_BUILDSUGGESTS, 0, 0, LEN_AND_STR("buildsuggests")},
+ {RPMTAG_BUILDENHANCES, 0, 0, LEN_AND_STR("buildsupplements")},
+ {RPMTAG_BUILDENHANCES, 0, 0, LEN_AND_STR("buildenhances")},
{0, 0, 0, 0}
};
--- ./build/parseReqs.c.orig 2013-06-10 15:55:10.000000000 +0000
+++ ./build/parseReqs.c 2013-07-12 11:32:45.000000000 +0000
@@ -92,6 +92,18 @@ rpmRC parseRCPOT(rpmSpec spec, Package p
case RPMTAG_BUILDCONFLICTS:
nametag = RPMTAG_CONFLICTNAME;
break;
+ case RPMTAG_SUGGESTSFLAGS:
+ nametag = RPMTAG_SUGGESTSNAME;
+ break;
+ case RPMTAG_ENHANCESFLAGS:
+ nametag = RPMTAG_ENHANCESNAME;
+ break;
+ case RPMTAG_BUILDSUGGESTS:
+ nametag = RPMTAG_SUGGESTSNAME;
+ break;
+ case RPMTAG_BUILDENHANCES:
+ nametag = RPMTAG_ENHANCESNAME;
+ break;
}
for (r = field; *r != '\0'; r = re) {
--- ./build/reqprov.c.orig 2013-06-10 15:55:10.000000000 +0000
+++ ./build/reqprov.c 2013-07-12 11:32:45.000000000 +0000
@@ -81,6 +81,16 @@ int addReqProv(Package pkg, rpmTagVal ta
extra = Flags & RPMSENSE_TRIGGER;
dsp = &pkg->triggers;
break;
+ case RPMTAG_SUGGESTSNAME:
+ versiontag = RPMTAG_SUGGESTSVERSION;
+ flagtag = RPMTAG_SUGGESTSFLAGS;
+ extra = Flags & _ALL_REQUIRES_MASK;
+ break;
+ case RPMTAG_ENHANCESNAME:
+ versiontag = RPMTAG_ENHANCESVERSION;
+ flagtag = RPMTAG_ENHANCESFLAGS;
+ extra = Flags & _ALL_REQUIRES_MASK;
+ break;
case RPMTAG_REQUIRENAME:
default:
tagN = RPMTAG_REQUIRENAME;
--- ./build/rpmfc.c.orig 2013-06-10 15:55:10.000000000 +0000
+++ ./build/rpmfc.c 2013-07-12 11:32:45.000000000 +0000
@@ -1087,6 +1087,12 @@ static struct DepMsg_s depMsgs[] = {
{ "Obsoletes", { "%{?__find_obsoletes}", NULL, NULL, NULL },
RPMTAG_OBSOLETENAME, RPMTAG_OBSOLETEVERSION, RPMTAG_OBSOLETEFLAGS,
0, -1 },
+ { "Enhances", { "%{?__find_enhances}", NULL, NULL, NULL },
+ RPMTAG_ENHANCESNAME, RPMTAG_ENHANCESVERSION, RPMTAG_ENHANCESFLAGS,
+ RPMSENSE_STRONG, RPMSENSE_STRONG },
+ { "Supplements", { "%{?__find_supplements}", NULL, NULL, NULL },
+ RPMTAG_ENHANCESNAME, RPMTAG_ENHANCESVERSION, RPMTAG_ENHANCESFLAGS,
+ RPMSENSE_STRONG, 0 },
{ NULL, { NULL, NULL, NULL, NULL }, 0, 0, 0, 0, 0 }
};
@@ -1163,6 +1169,14 @@ static rpmRC rpmfcGenerateDependsHelper(
continue;
tagflags = RPMSENSE_FIND_REQUIRES;
break;
+ case RPMTAG_ENHANCESFLAGS:
+ if (!pkg->autoProv)
+ continue;
+ failnonzero = 0;
+ tagflags = RPMSENSE_FIND_REQUIRES | RPMSENSE_MISSINGOK;
+ if (strcmp(dm->msg, "Supplements") == 0)
+ tagflags |= RPMSENSE_STRONG;
+ break;
default:
continue;
break;
--- ./lib/formats.c.orig 2012-11-18 08:21:06.000000000 +0000
+++ ./lib/formats.c 2013-07-12 11:32:45.000000000 +0000
@@ -486,6 +486,19 @@ static char * depflagsFormat(rpmtd td)
return val;
}
+static char * depflag_strongFormat(rpmtd td)
+{
+ char * val = NULL;
+
+ if (rpmtdClass(td) != RPM_NUMERIC_CLASS) {
+ val = xstrdup(_("(not a number)"));
+ } else {
+ uint64_t anint = rpmtdGetNumber(td);
+ val = xstrdup(anint & RPMSENSE_STRONG ? "strong" : "");
+ }
+ return val;
+}
+
/**
* Return tag container array size.
* @param td tag data container
@@ -591,6 +604,7 @@ static const struct headerFormatFunc_s r
{ RPMTD_FORMAT_VFLAGS, "vflags", vflagsFormat },
{ RPMTD_FORMAT_EXPAND, "expand", expandFormat },
{ RPMTD_FORMAT_FSTATUS, "fstatus", fstatusFormat },
+ { RPMTD_FORMAT_DEPFLAG_STRONG, "depflag_strong", depflag_strongFormat },
{ -1, NULL, NULL }
};
--- ./lib/rpmds.c.orig 2013-06-10 15:55:10.000000000 +0000
+++ ./lib/rpmds.c 2013-07-12 11:32:45.000000000 +0000
@@ -70,6 +70,10 @@ static int dsType(rpmTagVal tag,
t = "Trigger";
evr = RPMTAG_TRIGGERVERSION;
f = RPMTAG_TRIGGERFLAGS;
+ } else if (tag == RPMTAG_ENHANCESNAME) {
+ t = "Enhances";
+ evr = RPMTAG_ENHANCESVERSION;
+ f = RPMTAG_ENHANCESFLAGS;
} else {
rc = 1;
}
--- ./lib/rpmds.h.orig 2013-06-10 15:55:10.000000000 +0000
+++ ./lib/rpmds.h 2013-07-12 11:32:45.000000000 +0000
@@ -48,7 +48,7 @@ enum rpmsenseFlags_e {
RPMSENSE_RPMLIB = (1 << 24), /*!< rpmlib(feature) dependency. */
RPMSENSE_TRIGGERPREIN = (1 << 25), /*!< %triggerprein dependency. */
RPMSENSE_KEYRING = (1 << 26),
- /* bit 27 unused */
+ RPMSENSE_STRONG = (1 << 27),
RPMSENSE_CONFIG = (1 << 28)
};
@@ -70,6 +70,7 @@ typedef rpmFlags rpmsenseFlags;
RPMSENSE_FIND_REQUIRES | \
RPMSENSE_RPMLIB | \
RPMSENSE_KEYRING | \
Accepting request 147491 from devel:Factory:ARM - Update to 4.10.2 - Update to 4.10.2 - update to 4.10.2 (bnc#796375): * Fix missing error code on unparseable signature in packages, regression introduced in rpm 4.10.0. This could result in packages with malformed signature falling through signature checking. * Fix missing error code on --import on bogus key file (RhBug:869667) * Fix installation of packages containing skipped hardlinks (RhBug:864622) * Fix --setperms regression introduced in rpm 4.10.0 (RhBug:881835) * Fix locale dependent behavior in rpm2cpio.sh (RhBug:878363) * Add --undefine cli switch for undefining macros (related to RhBug:876308) * Fix warnings when building with gcc >= 4.7 * Permit key imports on transactions where signature checking is disabled, regression of sorts introduced in 4.10.0 (RhBug:856225) * Fix RPMPROB_FILTER_FORCERELOCATE aka --badreloc, regression introduced in 4.9.0 (RhBug:828784) * Verify files from non-installed packages again, regression introduced in 4.9.0 (RhBug:826589) * Fix large (> 4GB) package support, regression introduced in 4.9.0 (RhBug:844936) * Only create the first instance of a file shared between multiple packages on install (speedup + improved verification timestamp behavior) * Report config and missinok flags too in deptype format extension * Fix relative path handling in --whatprovides query * Add --noclean and --nocheck options to rpmbuild (RhBug:756531) * Permit non-existent %ghost directories to be packaged (RhBug:839656) * Dont silence patch by default (RhBug:678000, RhBug:773503) * Accept "owner" as an alias to "user" %verify attribute (RhBug:838657) OBS-URL: https://build.opensuse.org/request/show/147491 OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=245
2013-01-09 10:46:46 +01:00
+ RPMSENSE_STRONG | \
RPMSENSE_PRETRANS | \
Accepting request 147491 from devel:Factory:ARM - Update to 4.10.2 - Update to 4.10.2 - update to 4.10.2 (bnc#796375): * Fix missing error code on unparseable signature in packages, regression introduced in rpm 4.10.0. This could result in packages with malformed signature falling through signature checking. * Fix missing error code on --import on bogus key file (RhBug:869667) * Fix installation of packages containing skipped hardlinks (RhBug:864622) * Fix --setperms regression introduced in rpm 4.10.0 (RhBug:881835) * Fix locale dependent behavior in rpm2cpio.sh (RhBug:878363) * Add --undefine cli switch for undefining macros (related to RhBug:876308) * Fix warnings when building with gcc >= 4.7 * Permit key imports on transactions where signature checking is disabled, regression of sorts introduced in 4.10.0 (RhBug:856225) * Fix RPMPROB_FILTER_FORCERELOCATE aka --badreloc, regression introduced in 4.9.0 (RhBug:828784) * Verify files from non-installed packages again, regression introduced in 4.9.0 (RhBug:826589) * Fix large (> 4GB) package support, regression introduced in 4.9.0 (RhBug:844936) * Only create the first instance of a file shared between multiple packages on install (speedup + improved verification timestamp behavior) * Report config and missinok flags too in deptype format extension * Fix relative path handling in --whatprovides query * Add --noclean and --nocheck options to rpmbuild (RhBug:756531) * Permit non-existent %ghost directories to be packaged (RhBug:839656) * Dont silence patch by default (RhBug:678000, RhBug:773503) * Accept "owner" as an alias to "user" %verify attribute (RhBug:838657) OBS-URL: https://build.opensuse.org/request/show/147491 OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=245
2013-01-09 10:46:46 +01:00
RPMSENSE_POSTTRANS | \
RPMSENSE_PREREQ | \
--- ./lib/rpmtag.h.orig 2012-11-18 08:21:06.000000000 +0000
+++ ./lib/rpmtag.h 2013-07-12 11:32:45.000000000 +0000
@@ -217,14 +217,14 @@ typedef enum rpmTag_e {
RPMTAG_PRETRANSPROG = 1153, /* s[] */
RPMTAG_POSTTRANSPROG = 1154, /* s[] */
RPMTAG_DISTTAG = 1155, /* s */
- RPMTAG_SUGGESTSNAME = 1156, /* s[] extension (unimplemented) */
-#define RPMTAG_SUGGESTS RPMTAG_SUGGESTSNAME /* s[] (unimplemented) */
- RPMTAG_SUGGESTSVERSION = 1157, /* s[] extension (unimplemented) */
- RPMTAG_SUGGESTSFLAGS = 1158, /* i[] extension (unimplemented) */
- RPMTAG_ENHANCESNAME = 1159, /* s[] extension placeholder (unimplemented) */
-#define RPMTAG_ENHANCES RPMTAG_ENHANCESNAME /* s[] (unimplemented) */
- RPMTAG_ENHANCESVERSION = 1160, /* s[] extension placeholder (unimplemented) */
- RPMTAG_ENHANCESFLAGS = 1161, /* i[] extension placeholder (unimplemented) */
+ RPMTAG_SUGGESTSNAME = 1156, /* s[] extension */
+#define RPMTAG_SUGGESTS RPMTAG_SUGGESTSNAME /* s[] */
+ RPMTAG_SUGGESTSVERSION = 1157, /* s[] extension */
+ RPMTAG_SUGGESTSFLAGS = 1158, /* i[] extension */
+ RPMTAG_ENHANCESNAME = 1159, /* s[] extension */
+#define RPMTAG_ENHANCES RPMTAG_ENHANCESNAME /* s[] */
+ RPMTAG_ENHANCESVERSION = 1160, /* s[] extension */
+ RPMTAG_ENHANCESFLAGS = 1161, /* i[] extension */
RPMTAG_PRIORITY = 1162, /* i[] extension placeholder (unimplemented) */
RPMTAG_CVSID = 1163, /* s (unimplemented) */
#define RPMTAG_SVNID RPMTAG_CVSID /* s (unimplemented) */
--- ./lib/rpmtd.h.orig 2012-11-18 08:21:06.000000000 +0000
+++ ./lib/rpmtd.h 2013-07-12 11:32:45.000000000 +0000
@@ -228,6 +228,7 @@ typedef enum rpmtdFormats_e {
RPMTD_FORMAT_VFLAGS = 17, /* file verify flags (int types) */
RPMTD_FORMAT_EXPAND = 18, /* macro expansion (string types) */
RPMTD_FORMAT_FSTATUS = 19, /* file verify status (int types) */
+ RPMTD_FORMAT_DEPFLAG_STRONG = 20, /* strong dependency (int types) */
} rpmtdFormats;
/** \ingroup rpmtd
--- ./python/rpmmodule.c.orig 2012-11-18 08:21:06.000000000 +0000
+++ ./python/rpmmodule.c 2013-07-12 11:32:45.000000000 +0000
@@ -393,6 +393,7 @@ static int initModule(PyObject *m)
REGISTER_ENUM(RPMSENSE_RPMLIB);
REGISTER_ENUM(RPMSENSE_TRIGGERPREIN);
REGISTER_ENUM(RPMSENSE_KEYRING);
+ REGISTER_ENUM(RPMSENSE_STRONG);
REGISTER_ENUM(RPMSENSE_CONFIG);
REGISTER_ENUM(RPMTRANS_FLAG_TEST);
--- ./rpmpopt.in.orig 2012-12-18 15:50:36.000000000 +0000
+++ ./rpmpopt.in 2013-07-12 11:32:45.000000000 +0000
@@ -67,6 +67,22 @@ rpm alias --requires --qf \
--POPTdesc=$"list capabilities required by package(s)"
rpm alias -R --requires
+rpm alias --suggests --qf \
+ "[%|SUGGESTSFLAGS:depflag_strong?{}:{%{SUGGESTSNAME} %{SUGGESTSFLAGS:depflags} %{SUGGESTSVERSION}\n}|]" \
+ --POPTdesc=$"list capabilities this package suggests"
+
+rpm alias --recommends --qf \
+ "[%|SUGGESTSFLAGS:depflag_strong?{%{SUGGESTSNAME} %{SUGGESTSFLAGS:depflags} %{SUGGESTSVERSION}\n}|]" \
+ --POPTdesc=$"list capabilities this package recommends"
+
+rpm alias --enhances --qf \
+ "[%|ENHANCESFLAGS:depflag_strong?{}:{%{ENHANCESNAME} %{ENHANCESFLAGS:depflags} %{ENHANCESVERSION}\n}|]" \
+ --POPTdesc=$"list capabilities this package enhances"
+
+rpm alias --supplements --qf \
+ "[%|ENHANCESFLAGS:depflag_strong?{%{ENHANCESNAME} %{ENHANCESFLAGS:depflags} %{ENHANCESVERSION}\n}|]" \
+ --POPTdesc=$"list capabilities this package supplements"
+
rpm alias --info --qf '\
Name : %{NAME}\n\
%|EPOCH?{Epoch : %{EPOCH}\n}|\
--- ./tests/rpmgeneral.at.orig 2012-11-18 08:21:06.000000000 +0000
+++ ./tests/rpmgeneral.at 2013-07-12 11:32:45.000000000 +0000
@@ -79,6 +79,10 @@ DISTTAG
DISTURL
DSAHEADER
E
+ENHANCES
+ENHANCESFLAGS
+ENHANCESNAME
+ENHANCESVERSION
EPOCH
EPOCHNUM
EVR
@@ -219,6 +223,10 @@ SOURCE
SOURCEPACKAGE
SOURCEPKGID
SOURCERPM
+SUGGESTS
+SUGGESTSFLAGS
+SUGGESTSNAME
+SUGGESTSVERSION
SUMMARY
TRIGGERCONDS
TRIGGERFLAGS