dcavalca / rpms / rpm

Forked from rpms/rpm a year ago
Clone
James Antill ee2eaf
From 8390fa8515f499994646cf3bd113423744dc7bd9 Mon Sep 17 00:00:00 2001
James Antill ee2eaf
From: Florian Festi <ffesti@redhat.com>
James Antill ee2eaf
Date: Fri, 30 Nov 2018 11:02:52 +0100
James Antill ee2eaf
Subject: [PATCH] Add RPMTAG_MODULARITYLABEL to distinguish packages build for
James Antill ee2eaf
 modularity
James Antill ee2eaf
James Antill ee2eaf
Tag can be set with a ModularityLabel: statement in the spec file preamble or
James Antill ee2eaf
via the modularitylabel macro
James Antill ee2eaf
---
James Antill ee2eaf
 build/parsePreamble.c | 4 ++++
James Antill ee2eaf
 build/parseSpec.c     | 1 +
James Antill ee2eaf
 lib/rpmtag.h          | 1 +
James Antill ee2eaf
 macros.in             | 5 +++++
James Antill ee2eaf
 tests/rpmgeneral.at   | 1 +
James Antill ee2eaf
 5 files changed, 12 insertions(+)
James Antill ee2eaf
James Antill ee2eaf
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
James Antill ee2eaf
index f5e06bac8..e340e5c7a 100644
James Antill ee2eaf
--- a/build/parsePreamble.c
James Antill ee2eaf
+++ b/build/parsePreamble.c
James Antill ee2eaf
@@ -43,6 +43,7 @@ static const rpmTagVal copyTagsDuringParse[] = {
James Antill ee2eaf
     RPMTAG_DISTTAG,
James Antill ee2eaf
     RPMTAG_BUGURL,
James Antill ee2eaf
     RPMTAG_GROUP,
James Antill ee2eaf
+    RPMTAG_MODULARITYLABEL,
James Antill ee2eaf
     0
James Antill ee2eaf
 };
James Antill ee2eaf
 
James Antill ee2eaf
@@ -526,6 +527,7 @@ static struct optionalTag {
James Antill ee2eaf
     { RPMTAG_DISTURL,		"%{disturl}" },
James Antill ee2eaf
     { RPMTAG_DISTTAG,		"%{disttag}" },
James Antill ee2eaf
     { RPMTAG_BUGURL,		"%{bugurl}" },
James Antill ee2eaf
+    { RPMTAG_MODULARITYLABEL,	"%{modularitylabel}"},
James Antill ee2eaf
     { -1, NULL }
James Antill ee2eaf
 };
James Antill ee2eaf
 
James Antill ee2eaf
@@ -779,6 +781,7 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
James Antill ee2eaf
     case RPMTAG_URL:
James Antill ee2eaf
     case RPMTAG_DISTTAG:
James Antill ee2eaf
     case RPMTAG_BUGURL:
James Antill ee2eaf
+    case RPMTAG_MODULARITYLABEL:
James Antill ee2eaf
     /* XXX TODO: validate format somehow */
James Antill ee2eaf
     case RPMTAG_VCS:
James Antill ee2eaf
 	SINGLE_TOKEN_ONLY;
James Antill ee2eaf
@@ -1018,6 +1021,7 @@ static struct PreambleRec_s const preambleList[] = {
James Antill ee2eaf
     {RPMTAG_BUGURL,		0, 0, LEN_AND_STR("bugurl")},
James Antill ee2eaf
     {RPMTAG_ORDERNAME,		2, 0, LEN_AND_STR("orderwithrequires")},
James Antill ee2eaf
     {RPMTAG_REMOVEPATHPOSTFIXES,0, 0, LEN_AND_STR("removepathpostfixes")},
James Antill ee2eaf
+    {RPMTAG_MODULARITYLABEL,	0, 0, LEN_AND_STR("modularitylabel")},
James Antill ee2eaf
     {0, 0, 0, 0}
James Antill ee2eaf
 };
James Antill ee2eaf
 
James Antill ee2eaf
diff --git a/build/parseSpec.c b/build/parseSpec.c
James Antill ee2eaf
index bf4789942..c80802baf 100644
James Antill ee2eaf
--- a/build/parseSpec.c
James Antill ee2eaf
+++ b/build/parseSpec.c
James Antill ee2eaf
@@ -517,6 +517,7 @@ static const rpmTagVal sourceTags[] = {
James Antill ee2eaf
     RPMTAG_BUGURL,
James Antill ee2eaf
     RPMTAG_HEADERI18NTABLE,
James Antill ee2eaf
     RPMTAG_VCS,
James Antill ee2eaf
+    RPMTAG_MODULARITYLABEL,
James Antill ee2eaf
     0
James Antill ee2eaf
 };
James Antill ee2eaf
 
James Antill ee2eaf
diff --git a/lib/rpmtag.h b/lib/rpmtag.h
James Antill ee2eaf
index 973a6b69d..b9623ef24 100644
James Antill ee2eaf
--- a/lib/rpmtag.h
James Antill ee2eaf
+++ b/lib/rpmtag.h
James Antill ee2eaf
@@ -368,6 +368,7 @@
James Antill ee2eaf
     RPMTAG_FILESIGNATURELENGTH  = 5091, /* i */
James Antill ee2eaf
     RPMTAG_PAYLOADDIGEST	= 5092, /* s[] */
James Antill ee2eaf
     RPMTAG_PAYLOADDIGESTALGO	= 5093, /* i */
James Antill ee2eaf
+    RPMTAG_MODULARITYLABEL	= 5096, /* s */
James Antill ee2eaf
 
James Antill ee2eaf
     RPMTAG_FIRSTFREE_TAG	/*!< internal */
James Antill ee2eaf
 } rpmTag;
James Antill ee2eaf
diff --git a/macros.in b/macros.in
James Antill ee2eaf
index e0a1aea4e..cb4929c10 100644
James Antill ee2eaf
--- a/macros.in
James Antill ee2eaf
+++ b/macros.in
James Antill ee2eaf
@@ -357,6 +357,11 @@ package or when debugging this package.\
James Antill ee2eaf
 %_javadir      %{_datadir}/java
James Antill ee2eaf
 %_javadocdir   %{_datadir}/javadoc
James Antill ee2eaf
 
James Antill ee2eaf
+
James Antill ee2eaf
+#	Set ModularityLabel: for packages being build
James Antill ee2eaf
+#
James Antill ee2eaf
+#%modularitylabel
James Antill ee2eaf
+
James Antill ee2eaf
 #	A colon separated list of paths where files should *not* be installed.
James Antill ee2eaf
 #	Usually, these are network file system mount points.
James Antill ee2eaf
 #
James Antill ee2eaf
diff --git a/tests/rpmgeneral.at b/tests/rpmgeneral.at
James Antill ee2eaf
index 509277f2c..45d38698b 100644
James Antill ee2eaf
--- a/tests/rpmgeneral.at
James Antill ee2eaf
+++ b/tests/rpmgeneral.at
James Antill ee2eaf
@@ -150,6 +150,7 @@ LONGARCHIVESIZE
James Antill ee2eaf
 LONGFILESIZES
James Antill ee2eaf
 LONGSIGSIZE
James Antill ee2eaf
 LONGSIZE
James Antill ee2eaf
+MODULARITYLABEL
James Antill ee2eaf
 N
James Antill ee2eaf
 NAME
James Antill ee2eaf
 NEVR
James Antill ee2eaf
-- 
James Antill ee2eaf
2.17.2
James Antill ee2eaf