summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Festi <ffesti@redhat.com>2014-02-17 11:27:49 +0100
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-01-09 23:42:49 -0800
commitc31c49f42b54dcf6edb8804e633e6b6985acbb41 (patch)
treec43edfe5167a381ac93356ed776946a0d94de4f4
parent002013d7ce56a3d8e253cf276170af58f930a391 (diff)
downloadrpm-c31c49f42b54dcf6edb8804e633e6b6985acbb41.tar.gz
rpm-c31c49f42b54dcf6edb8804e633e6b6985acbb41.tar.bz2
rpm-c31c49f42b54dcf6edb8804e633e6b6985acbb41.zip
Add support for Recommends:, Suggests:, Supplements: and Enhances:
Change-Id: I24f0b1c0e98003a75b097c8afe7be19e21506695 Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
-rw-r--r--build/pack.c6
-rw-r--r--build/parsePreamble.c8
-rw-r--r--build/parseReqs.c12
-rw-r--r--build/reqprov.c24
-rw-r--r--build/rpmbuild_internal.h4
-rw-r--r--build/spec.c4
-rw-r--r--lib/rpmds.c16
-rw-r--r--tests/data/SPECS/deptest.spec4
-rw-r--r--tests/rpmbuild.at22
-rw-r--r--tests/rpmgeneral.at20
10 files changed, 112 insertions, 8 deletions
diff --git a/build/pack.c b/build/pack.c
index 6480cecaa..e426a75f7 100644
--- a/build/pack.c
+++ b/build/pack.c
@@ -232,8 +232,10 @@ static rpmTagVal depevrtags[] = {
RPMTAG_CONFLICTVERSION,
RPMTAG_ORDERVERSION,
RPMTAG_TRIGGERVERSION,
- RPMTAG_SUGGESTSVERSION,
- RPMTAG_ENHANCESVERSION,
+ RPMTAG_SUGGESTVERSION,
+ RPMTAG_ENHANCEVERSION,
+ RPMTAG_RECOMMENDVERSION,
+ RPMTAG_SUPPLEMENTVERSION,
0
};
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
index 523e452e3..bf6b26b04 100644
--- a/build/parsePreamble.c
+++ b/build/parsePreamble.c
@@ -785,6 +785,10 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
case RPMTAG_BUILDPREREQ:
case RPMTAG_BUILDREQUIRES:
case RPMTAG_BUILDCONFLICTS:
+ case RPMTAG_RECOMMENDFLAGS:
+ case RPMTAG_SUGGESTFLAGS:
+ case RPMTAG_SUPPLEMENTFLAGS:
+ case RPMTAG_ENHANCEFLAGS:
case RPMTAG_CONFLICTFLAGS:
case RPMTAG_OBSOLETEFLAGS:
case RPMTAG_PROVIDEFLAGS:
@@ -892,6 +896,10 @@ static struct PreambleRec_s const preambleList[] = {
{RPMTAG_ICON, 0, 0, LEN_AND_STR("icon")},
{RPMTAG_PROVIDEFLAGS, 0, 0, LEN_AND_STR("provides")},
{RPMTAG_REQUIREFLAGS, 2, 0, LEN_AND_STR("requires")},
+ {RPMTAG_RECOMMENDFLAGS, 0, 0, LEN_AND_STR("recommends")},
+ {RPMTAG_SUGGESTFLAGS, 0, 0, LEN_AND_STR("suggests")},
+ {RPMTAG_SUPPLEMENTFLAGS, 0, 0, LEN_AND_STR("supplements")},
+ {RPMTAG_ENHANCEFLAGS, 0, 0, LEN_AND_STR("enhances")},
{RPMTAG_PREREQ, 2, 1, LEN_AND_STR("prereq")},
{RPMTAG_CONFLICTFLAGS, 0, 0, LEN_AND_STR("conflicts")},
{RPMTAG_OBSOLETEFLAGS, 0, 0, LEN_AND_STR("obsoletes")},
diff --git a/build/parseReqs.c b/build/parseReqs.c
index 1507090d3..aa1758d9d 100644
--- a/build/parseReqs.c
+++ b/build/parseReqs.c
@@ -52,6 +52,18 @@ rpmRC parseRCPOT(rpmSpec spec, Package pkg, const char *field, rpmTagVal tagN,
nametag = RPMTAG_REQUIRENAME;
tagflags |= RPMSENSE_ANY;
break;
+ case RPMTAG_RECOMMENDFLAGS:
+ nametag = RPMTAG_RECOMMENDNAME;
+ break;
+ case RPMTAG_SUGGESTFLAGS:
+ nametag = RPMTAG_SUGGESTNAME;
+ break;
+ case RPMTAG_SUPPLEMENTFLAGS:
+ nametag = RPMTAG_SUPPLEMENTNAME;
+ break;
+ case RPMTAG_ENHANCEFLAGS:
+ nametag = RPMTAG_ENHANCENAME;
+ break;
case RPMTAG_PROVIDEFLAGS:
nametag = RPMTAG_PROVIDENAME;
break;
diff --git a/build/reqprov.c b/build/reqprov.c
index bc2f7ea26..cbfbe56b5 100644
--- a/build/reqprov.c
+++ b/build/reqprov.c
@@ -85,6 +85,30 @@ int addReqProv(Header h, rpmTagVal tagN,
flagtag = RPMTAG_ENHANCESFLAGS;
extra = Flags & _ALL_REQUIRES_MASK;
break;
+ case RPMTAG_RECOMMENDNAME:
+ versiontag = RPMTAG_RECOMMENDVERSION;
+ flagtag = RPMTAG_RECOMMENDFLAGS;
+ extra = Flags & _ALL_REQUIRES_MASK;
+ dsp = &pkg->recommends;
+ break;
+ case RPMTAG_SUGGESTNAME:
+ versiontag = RPMTAG_SUGGESTVERSION;
+ flagtag = RPMTAG_SUGGESTFLAGS;
+ extra = Flags & _ALL_REQUIRES_MASK;
+ dsp = &pkg->suggests;
+ break;
+ case RPMTAG_SUPPLEMENTNAME:
+ versiontag = RPMTAG_SUPPLEMENTVERSION;
+ flagtag = RPMTAG_SUPPLEMENTFLAGS;
+ extra = Flags & _ALL_REQUIRES_MASK;
+ dsp = &pkg->supplements;
+ break;
+ case RPMTAG_ENHANCENAME:
+ versiontag = RPMTAG_ENHANCEVERSION;
+ flagtag = RPMTAG_ENHANCEFLAGS;
+ extra = Flags & _ALL_REQUIRES_MASK;
+ dsp = &pkg->enhances;
+ break;
case RPMTAG_REQUIRENAME:
default:
tagN = RPMTAG_REQUIRENAME;
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
index fb6198d76..b7d8af578 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
@@ -88,6 +88,10 @@ struct rpmSpec_s {
struct Package_s {
Header header;
rpmds ds; /*!< Requires: N = EVR */
+ rpmds recommends;
+ rpmds suggests;
+ rpmds supplements;
+ rpmds enhances;
rpmfi cpioList;
struct Source * icon;
diff --git a/build/spec.c b/build/spec.c
index 4b6b6805d..98f7ff77b 100644
--- a/build/spec.c
+++ b/build/spec.c
@@ -129,6 +129,10 @@ static Package freePackage(Package pkg)
pkg->header = headerFree(pkg->header);
pkg->ds = rpmdsFree(pkg->ds);
+ pkg->recommends = rpmdsFree(pkg->recommends);
+ pkg->suggests = rpmdsFree(pkg->suggests);
+ pkg->supplements = rpmdsFree(pkg->supplements);
+ pkg->enhances = rpmdsFree(pkg->enhances);
pkg->fileList = argvFree(pkg->fileList);
pkg->fileFile = argvFree(pkg->fileFile);
pkg->policyList = argvFree(pkg->policyList);
diff --git a/lib/rpmds.c b/lib/rpmds.c
index 1e6798648..28eda9719 100644
--- a/lib/rpmds.c
+++ b/lib/rpmds.c
@@ -54,6 +54,22 @@ static int dsType(rpmTagVal tag,
t = "Requires";
evr = RPMTAG_REQUIREVERSION;
f = RPMTAG_REQUIREFLAGS;
+ } else if (tag == RPMTAG_SUPPLEMENTNAME) {
+ t = "Supplements";
+ evr = RPMTAG_SUPPLEMENTVERSION;
+ f = RPMTAG_SUPPLEMENTFLAGS;
+ } else if (tag == RPMTAG_ENHANCENAME) {
+ t = "Enhances";
+ evr = RPMTAG_ENHANCEVERSION;
+ f = RPMTAG_ENHANCEFLAGS;
+ } else if (tag == RPMTAG_RECOMMENDNAME) {
+ t = "Recommends";
+ evr = RPMTAG_RECOMMENDVERSION;
+ f = RPMTAG_RECOMMENDFLAGS;
+ } else if (tag == RPMTAG_SUGGESTNAME) {
+ t = "Suggests";
+ evr = RPMTAG_SUGGESTVERSION;
+ f = RPMTAG_SUGGESTFLAGS;
} else if (tag == RPMTAG_CONFLICTNAME) {
t = "Conflicts";
evr = RPMTAG_CONFLICTVERSION;
diff --git a/tests/data/SPECS/deptest.spec b/tests/data/SPECS/deptest.spec
index 7f2228f11..02616f8a4 100644
--- a/tests/data/SPECS/deptest.spec
+++ b/tests/data/SPECS/deptest.spec
@@ -10,6 +10,10 @@ BuildArch: noarch
%{?provs:Provides: %{provs}}
%{?cfls:Conflicts: %{cfls}}
%{?obs:Obsoletes: %{obs}}
+%{?recs:Recommends: %{recs}}
+%{?sugs:Suggests: %{sugs}}
+%{?sups:Supplements: %{sups}}
+%{?ens:Enhances: %{ens}}
%description
%{summary}
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 7661e35f5..b6a6ef02f 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -185,3 +185,25 @@ lrwxrwxrwx /opt/globtest/linkgood
],
[])
AT_CLEANUP
+
+# ------------------------------
+# Check if weak and reverse requires can be built
+AT_SETUP([Weak and reverse requires])
+AT_KEYWORDS([build])
+AT_CHECK([
+
+runroot rpmbuild -bb --quiet \
+ --define "pkg weakdeps" \
+ --define "recs foo > 1.2.3" \
+ --define "sugs bar >= 0.1.2" \
+ --define "sups baz" \
+ --define "ens zap = 3" \
+ /data/SPECS/deptest.spec
+
+runroot rpm -qp --qf "[%{supplementname}\n]" /build/RPMS/noarch/deptest-weakdeps-1.0-1.noarch.rpm
+],
+[0],
+[baz
+],
+[ignore])
+AT_CLEANUP
diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at
index eb0d86dda..bdef73dea 100644
--- a/tests/rpmgeneral.at
+++ b/tests/rpmgeneral.at
@@ -79,10 +79,10 @@ DISTTAG
DISTURL
DSAHEADER
E
+ENHANCEFLAGS
+ENHANCENAME
ENHANCES
-ENHANCESFLAGS
-ENHANCESNAME
-ENHANCESVERSION
+ENHANCEVERSION
EPOCH
EPOCHNUM
EVR
@@ -203,6 +203,10 @@ PROVIDES
PROVIDEVERSION
PUBKEYS
R
+RECOMMENDFLAGS
+RECOMMENDNAME
+RECOMMENDS
+RECOMMENDVERSION
RECONTEXTS
RELEASE
REMOVETID
@@ -223,11 +227,15 @@ SOURCE
SOURCEPACKAGE
SOURCEPKGID
SOURCERPM
+SUGGESTFLAGS
+SUGGESTNAME
SUGGESTS
-SUGGESTSFLAGS
-SUGGESTSNAME
-SUGGESTSVERSION
+SUGGESTVERSION
SUMMARY
+SUPPLEMENTFLAGS
+SUPPLEMENTNAME
+SUPPLEMENTS
+SUPPLEMENTVERSION
TRIGGERCONDS
TRIGGERFLAGS
TRIGGERINDEX