teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.5.90-noarch-subpackages.patch

Jindrich Novy 42d9f1
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
Jindrich Novy 42d9f1
index d168978..988b615 100644
Jindrich Novy 42d9f1
--- a/build/parsePreamble.c
Jindrich Novy 42d9f1
+++ b/build/parsePreamble.c
Jindrich Novy 42d9f1
@@ -632,19 +632,32 @@ static int handlePreambleTag(rpmSpec spec, Package pkg, rpmTag tag,
Jindrich Novy 42d9f1
     case RPMTAG_EXCLUSIVEOS:
Jindrich Novy 42d9f1
 	addOrAppendListEntry(spec->buildRestrictions, tag, field);
Jindrich Novy 42d9f1
 	break;
Jindrich Novy 42d9f1
-    case RPMTAG_BUILDARCHS:
Jindrich Novy 42d9f1
-	if ((rc = poptParseArgvString(field,
Jindrich Novy 42d9f1
-				      &(spec->BACount),
Jindrich Novy 42d9f1
-				      &(spec->BANames)))) {
Jindrich Novy 42d9f1
+    case RPMTAG_BUILDARCHS: {
Jindrich Novy 42d9f1
+	int BACount;
Jindrich Novy 42d9f1
+	const char **BANames = NULL;
Jindrich Novy 42d9f1
+	if ((rc = poptParseArgvString(field, &BACount, &BANames))) {
Jindrich Novy 42d9f1
 	    rpmlog(RPMLOG_ERR,
Jindrich Novy 42d9f1
 		     _("line %d: Bad BuildArchitecture format: %s\n"),
Jindrich Novy 42d9f1
 		     spec->lineNum, spec->line);
Jindrich Novy 42d9f1
 	    return RPMRC_FAIL;
Jindrich Novy 42d9f1
 	}
Jindrich Novy 42d9f1
-	if (!spec->BACount)
Jindrich Novy 42d9f1
+	if (spec->packages == pkg) {
Jindrich Novy 42d9f1
+	    spec->BACount = BACount;
Jindrich Novy 42d9f1
+	    spec->BANames = BANames;
Jindrich Novy 42d9f1
+	} else {
Jindrich Novy 42d9f1
+	    if (BACount != 1 || strcmp(BANames[0], "noarch")) {
Jindrich Novy 42d9f1
+		rpmlog(RPMLOG_ERR,
Jindrich Novy 42d9f1
+			 _("line %d: Only noarch subpackages are supported: %s\n"),
Jindrich Novy 42d9f1
+			spec->lineNum, spec->line);
Jindrich Novy 42d9f1
+		BANames = _free(BANames);
Jindrich Novy 42d9f1
+		return RPMRC_FAIL;
Jindrich Novy 42d9f1
+	    }
Jindrich Novy 42d9f1
+	    headerAddEntry(pkg->header, RPMTAG_ARCH, RPM_STRING_TYPE, "noarch", 1);
Jindrich Novy 42d9f1
+	}
Jindrich Novy 42d9f1
+	if (!BACount)
Jindrich Novy 42d9f1
 	    spec->BANames = _free(spec->BANames);
Jindrich Novy 42d9f1
 	break;
Jindrich Novy 42d9f1
-
Jindrich Novy 42d9f1
+    }
Jindrich Novy 42d9f1
     default:
Jindrich Novy 42d9f1
 	rpmlog(RPMLOG_ERR, _("Internal error: Bogus tag %d\n"), tag);
Jindrich Novy 42d9f1
 	return RPMRC_FAIL;