diff options
author | Anas Nashif <anas.nashif@intel.com> | 2012-10-11 12:40:31 -0700 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-02-02 16:44:15 -0800 |
commit | 8966e44f90581477f689e6e6673dec4cd0f44c30 (patch) | |
tree | f27c68e7f76aba1c1c460f41df82d0d73e41be70 /lib | |
parent | cd10f180b09bd91d4d720c66a0835b757d7f944f (diff) | |
download | librpm-tizen-8966e44f90581477f689e6e6673dec4cd0f44c30.tar.gz librpm-tizen-8966e44f90581477f689e6e6673dec4cd0f44c30.tar.bz2 librpm-tizen-8966e44f90581477f689e6e6673dec4cd0f44c30.zip |
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".
Diffstat (limited to 'lib')
-rw-r--r-- | lib/formats.c | 14 | ||||
-rw-r--r-- | lib/rpmds.c | 4 | ||||
-rw-r--r-- | lib/rpmds.h | 5 | ||||
-rw-r--r-- | lib/rpmtag.h | 16 | ||||
-rw-r--r-- | lib/rpmtd.h | 1 |
5 files changed, 30 insertions, 10 deletions
diff --git a/lib/formats.c b/lib/formats.c index 653f43d45..23f40277f 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -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 rpmHeaderFormats[] = { { 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 } }; diff --git a/lib/rpmds.c b/lib/rpmds.c index 04dc75816..1e6798648 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -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; } diff --git a/lib/rpmds.h b/lib/rpmds.h index 811ff862f..bceed0081 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -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) }; @@ -73,7 +73,8 @@ typedef rpmFlags rpmsenseFlags; RPMSENSE_PRETRANS | \ RPMSENSE_POSTTRANS | \ RPMSENSE_PREREQ | \ - RPMSENSE_MISSINGOK) + RPMSENSE_MISSINGOK | \ + RPMSENSE_STRONG) #define _notpre(_x) ((_x) & ~RPMSENSE_PREREQ) #define _INSTALL_ONLY_MASK \ diff --git a/lib/rpmtag.h b/lib/rpmtag.h index e8e9dee26..1295a711a 100644 --- a/lib/rpmtag.h +++ b/lib/rpmtag.h @@ -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) */ diff --git a/lib/rpmtd.h b/lib/rpmtd.h index a8f0b7121..de7101123 100644 --- a/lib/rpmtd.h +++ b/lib/rpmtd.h @@ -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 |