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