teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame rpm-4.11.1-rc1-lookup-mainpkg.patch

Panu Matilainen 4cf31c
commit eacb69f779cc5fd7b651d7a7cf450b327e5735f8
Panu Matilainen 4cf31c
Author: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 4cf31c
Date:   Tue Jun 11 09:51:48 2013 +0300
Panu Matilainen 4cf31c
Panu Matilainen 4cf31c
    Fix regression on addressing main package by its name (RhBug:972994)
Panu Matilainen 4cf31c
    
Panu Matilainen 4cf31c
    - The main package name is not known when we start parsing the preamble,
Panu Matilainen 4cf31c
      so newPackage() is called with NULL name and the early callers use
Panu Matilainen 4cf31c
      NULL to find it. Populate the name as soon as we know it so
Panu Matilainen 4cf31c
      various "%foo -n <name>" operations work on the main package too,
Panu Matilainen 4cf31c
      which got broken by commit 9929459f9967ecfe0a05d557bc42531944faa70a.
Panu Matilainen 4cf31c
    (cherry picked from commit fed1298af7911145c953da8910fd5f2f15976374)
Panu Matilainen 4cf31c
Panu Matilainen 4cf31c
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
Panu Matilainen 4cf31c
index f7cc167..e4b1f94 100644
Panu Matilainen 4cf31c
--- a/build/parsePreamble.c
Panu Matilainen 4cf31c
+++ b/build/parsePreamble.c
Panu Matilainen 4cf31c
@@ -670,6 +670,9 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
Panu Matilainen 4cf31c
 	if (rpmCharCheck(spec, field, strlen(field), ".-_+%{}"))
Panu Matilainen 4cf31c
 	   goto exit;
Panu Matilainen 4cf31c
 	headerPutString(pkg->header, tag, field);
Panu Matilainen 4cf31c
+	/* Main pkg name is unknown at the start, populate as soon as we can */
Panu Matilainen 4cf31c
+	if (pkg == spec->packages)
Panu Matilainen 4cf31c
+	    pkg->name = rpmstrPoolId(spec->pool, field, 1);
Panu Matilainen 4cf31c
 	break;
Panu Matilainen 4cf31c
     case RPMTAG_VERSION:
Panu Matilainen 4cf31c
     case RPMTAG_RELEASE: