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

File newweakdeps.diff of Package rpm.SLE_11

--- ./lib/formats.c.orig	2014-06-25 14:19:57.593897111 +0000
+++ ./lib/formats.c	2014-06-25 14:21:27.199450044 +0000
@@ -1358,6 +1358,119 @@ static int groupTag(Header h, /*@out@*/
     return i18nTag(h, RPMTAG_GROUP, type, data, count, freeData);
 }
 
+static int weakdepsTag(Header h, rpmTagType * type, const void ** data, int_32 * count, int * freeData, int_32 oldname, int_32 oldversion, int_32 oldflags, int strong, int_32 newname, int_32 newversion, int_32 newflags)
+{
+    HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+    HFD_t hfd = headerFreeData;
+    rpmTagType t;
+    char **names, **evrs;
+    int *flags;
+    int cnt;
+    int rc;
+    int i;
+    char **res;
+    int neededspace = 0;
+    
+    rc = hge(h, newname, &t, (void **)&names, count);
+    if (rc && t != RPM_STRING_ARRAY_TYPE)
+	rc = 0;
+    if (rc) {
+	rc = hge(h, newversion, &t, (void **)&evrs, &cnt);
+	if (rc && (cnt != *count || t != RPM_STRING_ARRAY_TYPE))
+	    rc = 0;
+	if (rc)
+	    rc = hge(h, newflags, &t, (void **)&flags, &cnt);
+	if (rc && (cnt != *count || t != RPM_INT32_TYPE))
+	    rc = 0;
+    }
+    if (!rc) {
+	rc = hge(h, oldname, &t, (void **)&names, count);
+	if (rc && t != RPM_STRING_ARRAY_TYPE)
+	    rc = 0;
+	if (rc)
+	    rc = hge(h, oldversion, &t, (void **)&evrs, &cnt);
+	if (rc && (cnt != *count || t != RPM_STRING_ARRAY_TYPE))
+	    rc = 0;
+	if (rc)
+	    rc = hge(h, oldflags, &t, (void **)&flags, &cnt);
+	if (rc && (cnt != *count || t != RPM_INT32_TYPE))
+	    rc = 0;
+	if (strong)
+	    strong = RPMSENSE_STRONG;
+    } else {
+	strong = -1;
+    }
+    if (!rc) {
+	*freeData = 0;
+	*data = NULL;
+	*count = 0;
+	return 1;
+    }
+    cnt = 0;
+    for (i = 0; i < *count; i++) {
+	if (strong >= 0 && (flags[i] & RPMSENSE_STRONG) != strong)
+	    continue;
+	neededspace += strlen(names[i]) + 5 + strlen(evrs[i]) + 1;
+	cnt++;
+    }
+    if (!cnt) {
+	names = hfd(names, RPM_STRING_ARRAY_TYPE);
+	evrs = hfd(evrs, RPM_STRING_ARRAY_TYPE);
+	*freeData = 0;
+	*data = NULL;
+	*count = 0;
+	return 1;
+    }
+    res = xmalloc(cnt * sizeof(char *) + neededspace);
+    neededspace = cnt * sizeof(char *);
+    cnt = 0;
+    for (i = 0; i < *count; i++) {
+	char fl[4], *flp;
+	if (strong >= 0 && (flags[i] & RPMSENSE_STRONG) != strong)
+	    continue;
+	res[cnt] = (char *)res + neededspace;
+	flp = fl;
+	if (flags[i] & RPMSENSE_LESS) 
+	   *flp++ = '<';
+	if (flags[i] & RPMSENSE_GREATER) 
+	   *flp++ = '>';
+	if (flags[i] & RPMSENSE_EQUAL) 
+	   *flp++ = '=';
+	*flp = 0;
+	sprintf(res[cnt], "%s %s %s", names[i], fl, evrs[i]);
+	neededspace += strlen(res[cnt]) + 1;
+	cnt++;
+    }
+    names = hfd(names, RPM_STRING_ARRAY_TYPE);
+    evrs = hfd(evrs, RPM_STRING_ARRAY_TYPE);
+    *type = RPM_STRING_ARRAY_TYPE;
+    *freeData = 1;
+    *count = cnt;
+    *data = res;
+    return 0;
+}
+
+static int recommendnevrsTag(Header h, rpmTagType * type, const void ** data, int_32 * count, int * freeData)
+{
+    return weakdepsTag(h, type, data, count, freeData, RPMTAG_SUGGESTSNAME, RPMTAG_SUGGESTSVERSION, RPMTAG_SUGGESTSFLAGS, 1, 5046, 5047, 5048);
+}
+
+static int suggestnevrsTag(Header h, rpmTagType * type, const void ** data, int_32 * count, int * freeData)
+{
+    return weakdepsTag(h, type, data, count, freeData, RPMTAG_SUGGESTSNAME, RPMTAG_SUGGESTSVERSION, RPMTAG_SUGGESTSFLAGS, 0, 5049, 5050, 5051);
+}
+
+static int supplementnevrsTag(Header h, rpmTagType * type, const void ** data, int_32 * count, int * freeData)
+{
+    return weakdepsTag(h, type, data, count, freeData, RPMTAG_ENHANCESNAME, RPMTAG_ENHANCESVERSION, RPMTAG_ENHANCESFLAGS, 1, 5052, 5053, 5054);
+}
+
+static int enhancenevrsTag(Header h, rpmTagType * type, const void ** data, int_32 * count, int * freeData)
+{
+    return weakdepsTag(h, type, data, count, freeData, RPMTAG_ENHANCESNAME, RPMTAG_ENHANCESVERSION, RPMTAG_ENHANCESFLAGS, 0, 5055, 5056, 5057);
+}
+
+
 /*@-type@*/ /* FIX: cast? */
 const struct headerSprintfExtension_s rpmHeaderFormats[] = {
     { HEADER_EXT_TAG, "RPMTAG_GROUP",		{ groupTag } },
@@ -1377,6 +1490,10 @@ const struct headerSprintfExtension_s rp
     { HEADER_EXT_TAG, "RPMTAG_RECONTEXTS",	{ recontextsTag } },
     { HEADER_EXT_TAG, "RPMTAG_TRIGGERCONDS",	{ triggercondsTag } },
     { HEADER_EXT_TAG, "RPMTAG_TRIGGERTYPE",	{ triggertypeTag } },
+    { HEADER_EXT_TAG, "RPMTAG_RECOMMENDNEVRS",	{ recommendnevrsTag } },
+    { HEADER_EXT_TAG, "RPMTAG_SUGGESTNEVRS",	{ suggestnevrsTag } },
+    { HEADER_EXT_TAG, "RPMTAG_SUPPLEMENTNEVRS",	{ supplementnevrsTag } },
+    { HEADER_EXT_TAG, "RPMTAG_ENHANCENEVRS",	{ enhancenevrsTag } },
     { HEADER_EXT_FORMAT, "armor",		{ armorFormat } },
     { HEADER_EXT_FORMAT, "base64",		{ base64Format } },
     { HEADER_EXT_FORMAT, "pgpsig",		{ pgpsigFormat } },
--- ./lib/rpmlib.h.orig	2014-06-25 14:19:57.594897116 +0000
+++ ./lib/rpmlib.h	2014-06-25 14:20:01.890875678 +0000
@@ -462,6 +462,10 @@ typedef enum rpmTag_e {
     RPMTAG_BUILDCPUCLOCK	= 1176, /*!< i */
     /* tags 1997-4999 reserved */
     RPMTAG_FILEDIGESTALGO       = 5011, /* i file digest algorithm */
+    RPMTAG_RECOMMENDNEVRS       = 5058, /* s[] */
+    RPMTAG_SUGGESTNEVRS         = 5059, /* s[] */
+    RPMTAG_SUPPLEMENTNEVRS      = 5060, /* s[] */
+    RPMTAG_ENHANCENEVRS         = 5061, /* s[] */
 
 /*@-enummemuse@*/
     RPMTAG_FIRSTFREE_TAG	/*!< internal */
--- ./rpmpopt.in.orig	2014-06-25 14:19:57.595897120 +0000
+++ ./rpmpopt.in	2014-06-25 14:20:01.891875674 +0000
@@ -69,19 +69,19 @@ rpm	alias --requires	--qf \
 rpm	alias -R --requires
 
 rpm	alias --suggests	--qf \
-  "[%|SUGGESTSFLAGS:depflag_strong?{}:{%{SUGGESTSNAME} %{SUGGESTSFLAGS:depflags} %{SUGGESTSVERSION}\n}|]" \
+  "[%{SUGGESTNEVRS}\n]" \
 	--POPTdesc=$"list capabilities this package suggests"
 
 rpm	alias --recommends	--qf \
-  "[%|SUGGESTSFLAGS:depflag_strong?{%{SUGGESTSNAME} %{SUGGESTSFLAGS:depflags} %{SUGGESTSVERSION}\n}|]" \
+  "[%{RECOMMENDNEVRS}\n]" \
 	--POPTdesc=$"list capabilities this package recommends"
 
 rpm	alias --enhances	--qf \
-  "[%|ENHANCESFLAGS:depflag_strong?{}:{%{ENHANCESNAME} %{ENHANCESFLAGS:depflags} %{ENHANCESVERSION}\n}|]" \
+  "[%{ENHANCENEVRS}\n]" \
 	--POPTdesc=$"list capabilities this package enhances"
 
 rpm	alias --supplements	--qf \
-  "[%|ENHANCESFLAGS:depflag_strong?{%{ENHANCESNAME} %{ENHANCESFLAGS:depflags} %{ENHANCESVERSION}\n}|]" \
+  "[%{SUPPLEMENTNEVRS}\n]" \
 	--POPTdesc=$"list capabilities this package supplements"
 
 rpm	alias --basedon		--qf \