Make headerGetNEVRA() return "src" as the arch of source packages
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 9 Apr 2008 09:17:36 +0000 (12:17 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 9 Apr 2008 09:17:36 +0000 (12:17 +0300)
rpmdb/hdrNVR.c

index 37bc11b..5d026f4 100644 (file)
@@ -69,14 +69,16 @@ char * headerGetNEVR(Header h, const char ** np)
 
 char * headerGetNEVRA(Header h, const char ** np)
 {
-    const char *n, *a;
+    const char *n = NULL, *a = NULL;
     char *nevr, *nevra = NULL;
 
     nevr = headerGetNEVR(h, &n);
     headerGetEntry(h, RPMTAG_ARCH, NULL, (rpm_data_t *) &a, NULL);
+
     /* XXX gpg-pubkey packages have no arch, urgh... */
     if (a) {
-       rasprintf(&nevra, "%s.%s", nevr, a);
+       const char *arch = headerIsSource(h) ? "src" : a;
+       rasprintf(&nevra, "%s.%s", nevr, arch);
        free(nevr);
     } else {
        nevra = nevr;