Be more selective about legacy retrofits on package read
authorPanu Matilainen <pmatilai@redhat.com>
Sat, 15 Sep 2012 09:14:43 +0000 (12:14 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Sat, 15 Sep 2012 09:17:31 +0000 (12:17 +0300)
- Missing RPMTAG_DIRNAME can mean either a package with uncompressed
  filenames OR a new package with no files, in which case the retrofits
  should not be performed. Also a newer package can be built with
  --nodirtokens, requiring filelist compression but no other retrofits.
- Test for immutable region presence for more accurate v3 package
  detection, if not present do a full retrofit. For others, explicitly
  test for OLDFILENAMES presence and only compress the filelist if needed.e

lib/package.c

index ce1c71e..6fb95a6 100644 (file)
@@ -680,12 +680,15 @@ exit:
            headerPutString(h, RPMTAG_SOURCERPM, "(none)");
        }
        /* 
-         * Convert legacy headers on the fly. Not having "new" style compressed
-         * filenames is close enough estimate for legacy indication... 
+         * Convert legacy headers on the fly. Not having immutable region
+         * equals a truly ancient package, do full retrofit. OTOH newer
+         * packages might have been built with --nodirtokens, test and handle
+         * the non-compressed filelist case separately.
          */
-       if (!headerIsEntry(h, RPMTAG_DIRNAMES)) {
+       if (!headerIsEntry(h, RPMTAG_HEADERIMMUTABLE))
            headerConvert(h, HEADERCONV_RETROFIT_V3);
-       }
+       else if (headerIsEntry(h, RPMTAG_OLDFILENAMES))
+           headerConvert(h, HEADERCONV_COMPRESSFILELIST);
        
        /* Append (and remap) signature tags to the metadata. */
        headerMergeLegacySigs(h, sigh);