A new user interface for you! Read more...

File findsupplements.diff of Package rpm

--- ./build/rpmfc.c.orig	2014-02-20 12:56:59.836814478 +0000
+++ ./build/rpmfc.c	2014-02-20 12:58:18.886814338 +0000
@@ -59,6 +59,7 @@ struct rpmfc_s {
     rpmstrPool pool;	/*!< general purpose string storage */
     rpmds provides;	/*!< (no. provides) package provides */
     rpmds requires;	/*!< (no. requires) package requires */
+    rpmds supplements;	/*!< (no. supplements) package supplements */
 };
 
 struct rpmfcTokens_s {
@@ -583,6 +584,22 @@ static int rpmfcHelperRequires(rpmfc fc,
 			RPMSENSE_FIND_REQUIRES, RPMTAG_REQUIRENAME);
 }
 
+/**
+ * Run per-interpreter Supplements: dependency helper.
+ * @param fc		file classifier
+ * @param nsdep		class name for interpreter (e.g. "perl")
+ * @return		0
+ */
+static int rpmfcHelperSupplements(rpmfc fc, const char * nsdep)
+{
+    if (fc->skipReq)
+	return 0;
+
+    rpmfcHelper(fc, nsdep, "supplements", &fc->supplements, RPMSENSE_FIND_REQUIRES, RPMTAG_SUPPLEMENTNAME);
+
+    return 0;
+}
+
 /* Only used for elf coloring and controlling RPMTAG_FILECLASS inclusion now */
 static const struct rpmfcTokens_s rpmfcTokens[] = {
   { "directory",		RPMFC_INCLUDE },
@@ -800,6 +817,8 @@ rpmfc rpmfcFree(rpmfc fc)
 
 	rpmdsFree(fc->provides);
 	rpmdsFree(fc->requires);
+	rpmdsFree(fc->supplements);
+
 	rpmstrPoolFree(fc->pool);
 	memset(fc, 0, sizeof(*fc)); /* trash and burn */
 	free(fc);
@@ -833,6 +852,11 @@ rpmds rpmfcRequires(rpmfc fc)
     return (fc != NULL ? fc->requires : NULL);
 }
 
+rpmds rpmfcSupplements(rpmfc fc)
+{
+    return (fc != NULL ? fc->supplements : NULL);
+}
+
 rpmRC rpmfcApply(rpmfc fc)
 {
     const char * s;
@@ -853,6 +877,7 @@ rpmRC rpmfcApply(rpmfc fc)
 	for (ARGV_t fattr = fc->fattrs[fc->ix]; fattr && *fattr; fattr++) {
 	    rpmfcHelperProvides(fc, *fattr);
 	    rpmfcHelperRequires(fc, *fattr);
+	    rpmfcHelperSupplements(fc, *fattr);
 	}
     }
     /* No more additions after this, freeze pool to minimize memory use */
@@ -897,6 +922,11 @@ rpmRC rpmfcApply(rpmfc fc)
 	    dix = rpmdsFind(fc->requires, ds);
 	    rpmdsFree(ds);
 	    break;
+	case 'S':
+	    ds = rpmdsSingle(RPMTAG_SUPPLEMENTNAME, N, EVR, Flags);
+	    dix = rpmdsFind(fc->supplements, ds);
+	    ds = rpmdsFree(ds);
+	    break;
 	}
 
 	if (dix < 0)
@@ -1380,6 +1410,18 @@ rpmRC rpmfcGenerateDepends(const rpmSpec
 	}
     }
 
+    /* Add Supplements: */
+    if (!fc->skipReq) {
+	rpmds pi = rpmdsInit(fc->supplements);
+	while (rpmdsNext(pi) >= 0) {
+	    rpmsenseFlags flags = rpmdsFlags(pi);
+	
+	    headerPutString(pkg->header, RPMTAG_SUPPLEMENTNAME, rpmdsN(pi));
+	    headerPutString(pkg->header, RPMTAG_SUPPLEMENTVERSION, rpmdsEVR(pi));
+	    headerPutUint32(pkg->header, RPMTAG_SUPPLEMENTFLAGS, &flags, 1);
+	}
+    }
+
     /* Add dependency dictionary(#dependencies) */
     if (rpmtdFromArgi(&td, RPMTAG_DEPENDSDICT, fc->ddictx)) {
 	headerPut(pkg->header, &td, HEADERPUT_DEFAULT);
--- ./build/rpmfc.h.orig	2012-11-07 12:55:24.000000000 +0000
+++ ./build/rpmfc.h	2014-02-20 12:57:04.466814469 +0000
@@ -106,6 +106,13 @@ rpmds rpmfcProvides(rpmfc fc);
  */
 rpmds rpmfcRequires(rpmfc fc);
 
+/** \ingroup rpmfc
+ * Retrieve file classification supplements
+ * @param fc		file classifier
+ * @return		rpmds dependency set of fc requires
+ */
+rpmds rpmfcSupplements(rpmfc fc);
+
 #ifdef __cplusplus
 }
 #endif