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