teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.6.0-inherit-group.patch

Jindrich Novy 84fa91
diff -up rpm-4.6.0/build/parsePreamble.c.inherit-group rpm-4.6.0/build/parsePreamble.c
Jindrich Novy 84fa91
--- rpm-4.6.0/build/parsePreamble.c.inherit-group	2008-12-05 12:49:44.000000000 +0100
Jindrich Novy 84fa91
+++ rpm-4.6.0/build/parsePreamble.c	2009-02-16 12:43:41.000000000 +0100
Jindrich Novy 84fa91
@@ -900,20 +900,30 @@ int parsePreamble(rpmSpec spec, int init
Jindrich Novy 84fa91
 	goto exit;
Jindrich Novy 84fa91
     }
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
-    if (pkg == spec->packages)
Jindrich Novy 84fa91
+    /* It is the main package */
Jindrich Novy 84fa91
+    if (pkg == spec->packages) {
Jindrich Novy 84fa91
 	fillOutMainPackage(pkg->header);
Jindrich Novy 84fa91
+	/* Define group tag to something when group is undefined in main package*/
Jindrich Novy 84fa91
+	if (!headerIsEntry(pkg->header, RPMTAG_GROUP)) {
Jindrich Novy 84fa91
+	    headerPutString(pkg->header, RPMTAG_GROUP, "Unspecified");
Jindrich Novy 84fa91
+	}
Jindrich Novy 84fa91
+    }
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
     if (checkForDuplicates(pkg->header, NVR)) {
Jindrich Novy 84fa91
 	goto exit;
Jindrich Novy 84fa91
     }
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
-    if (pkg != spec->packages)
Jindrich Novy 84fa91
+    if (pkg != spec->packages) {
Jindrich Novy 84fa91
 	headerCopyTags(spec->packages->header, pkg->header,
Jindrich Novy 84fa91
 			(rpmTag *)copyTagsDuringParse);
Jindrich Novy 84fa91
-
Jindrich Novy 84fa91
-    /* Many things expect group to always exist, put something in there... */
Jindrich Novy 84fa91
-    if (!headerIsEntry(pkg->header, RPMTAG_GROUP)) {
Jindrich Novy 84fa91
-	headerPutString(pkg->header, RPMTAG_GROUP, "Unspecified");
Jindrich Novy 84fa91
+	/* inherit group tag from the main package if unspecified */
Jindrich Novy 84fa91
+	if (!headerIsEntry(pkg->header, RPMTAG_GROUP)) {
Jindrich Novy 84fa91
+	    struct rpmtd_s td;
Jindrich Novy 84fa91
+
Jindrich Novy 84fa91
+	    headerGet(spec->packages->header, RPMTAG_GROUP, &td, HEADERGET_DEFAULT);
Jindrich Novy 84fa91
+	    headerPut(pkg->header, &td, HEADERPUT_DEFAULT);
Jindrich Novy 84fa91
+	    rpmtdFreeData(&td);
Jindrich Novy 84fa91
+	}
Jindrich Novy 84fa91
     }
Jindrich Novy 84fa91
 
Jindrich Novy 84fa91
     if (checkForRequired(pkg->header, NVR)) {