Pass the entire package struct to rpmlibNeedsFeature()
authorPanu Matilainen <pmatilai@redhat.com>
Mon, 15 Apr 2013 11:08:24 +0000 (14:08 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Fri, 7 Jun 2013 09:22:24 +0000 (12:22 +0300)
- Doesn't make much difference as it is, but pre-requisites for
  sanitizing the way dependencies are carried around.
(cherry picked from commit 0252fdf04884da7b7d2437eeb8e6ca8c697d902a)

build/files.c
build/pack.c
build/parseScript.c
build/reqprov.c
build/rpmbuild_internal.h

index 72e1251..759eab3 100644 (file)
@@ -1163,15 +1163,15 @@ static void genCpioListAndHeader(FileList fl, Package pkg, int isSrc)
 
     if (digestalgo != defaultalgo) {
        headerPutUint32(h, RPMTAG_FILEDIGESTALGO, &digestalgo, 1);
-       rpmlibNeedsFeature(h, "FileDigests", "4.6.0-1");
+       rpmlibNeedsFeature(pkg, "FileDigests", "4.6.0-1");
     }
 
     if (fl->haveCaps) {
-       rpmlibNeedsFeature(h, "FileCaps", "4.6.1-1");
+       rpmlibNeedsFeature(pkg, "FileCaps", "4.6.1-1");
     }
 
     if (_addDotSlash)
-       (void) rpmlibNeedsFeature(h, "PayloadFilesHavePrefix", "4.0-1");
+       (void) rpmlibNeedsFeature(pkg, "PayloadFilesHavePrefix", "4.0-1");
 
   {
     struct rpmtd_s filenames;
@@ -1225,7 +1225,7 @@ static void genCpioListAndHeader(FileList fl, Package pkg, int isSrc)
     if (!(fl->pkgFlags & RPMBUILD_PKG_NODIRTOKENS)) {
        headerConvert(h, HEADERCONV_COMPRESSFILELIST);
        /* Binary packages with dirNames cannot be installed by legacy rpm. */
-       (void) rpmlibNeedsFeature(h, "CompressedFileNames", "3.0.4-1");
+       (void) rpmlibNeedsFeature(pkg, "CompressedFileNames", "3.0.4-1");
     }
 }
 
@@ -1914,8 +1914,7 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags,
 
     /* Verify that file attributes scope over hardlinks correctly. */
     if (checkHardLinks(&fl.files))
-       (void) rpmlibNeedsFeature(pkg->header,
-                       "PartialHardlinkSets", "4.0.4-1");
+       (void) rpmlibNeedsFeature(pkg, "PartialHardlinkSets", "4.0.4-1");
 
     genCpioListAndHeader(&fl, pkg, 0);
 
index 8b7e1e5..ab23908 100644 (file)
@@ -286,15 +286,15 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
        } else if (rstreq(s+1, "bzdio")) {
            compr = "bzip2";
            /* Add prereq on rpm version that understands bzip2 payloads */
-           (void) rpmlibNeedsFeature(pkg->header, "PayloadIsBzip2", "3.0.5-1");
+           (void) rpmlibNeedsFeature(pkg, "PayloadIsBzip2", "3.0.5-1");
 #endif
 #if HAVE_LZMA_H
        } else if (rstreq(s+1, "xzdio")) {
            compr = "xz";
-           (void) rpmlibNeedsFeature(pkg->header, "PayloadIsXz", "5.2-1");
+           (void) rpmlibNeedsFeature(pkg, "PayloadIsXz", "5.2-1");
        } else if (rstreq(s+1, "lzdio")) {
            compr = "lzma";
-           (void) rpmlibNeedsFeature(pkg->header, "PayloadIsLzma", "4.4.6-1");
+           (void) rpmlibNeedsFeature(pkg, "PayloadIsLzma", "4.4.6-1");
 #endif
        } else {
            rpmlog(RPMLOG_ERR, _("Unknown payload compression: %s\n"),
@@ -313,7 +313,7 @@ static rpmRC writeRPM(Package pkg, unsigned char ** pkgidp,
 
     /* check if the package has a dependency with a '~' */
     if (haveTildeDep(pkg->header))
-       (void) rpmlibNeedsFeature(pkg->header, "TildeInVersions", "4.10.0-1");
+       (void) rpmlibNeedsFeature(pkg, "TildeInVersions", "4.10.0-1");
 
     /* Create and add the cookie */
     if (cookie) {
@@ -572,7 +572,7 @@ rpmRC packageBinaries(rpmSpec spec, const char *cookie, int cheating)
        }
 
        if (cheating) {
-           (void) rpmlibNeedsFeature(pkg->header, "ShortCircuited", "4.9.0-1");
+           (void) rpmlibNeedsFeature(pkg, "ShortCircuited", "4.9.0-1");
        }
        
        {   char *binFormat = rpmGetPath("%{_rpmfilename}", NULL);
index 1a149e1..2800f7b 100644 (file)
@@ -292,8 +292,7 @@ int parseScript(rpmSpec spec, int parsePart)
        if (rpmluaCheckScript(lua, p, partname) != RPMRC_OK) {
            goto exit;
        }
-       (void) rpmlibNeedsFeature(pkg->header,
-                                 "BuiltinLuaScripts", "4.2.2-1");
+       (void) rpmlibNeedsFeature(pkg, "BuiltinLuaScripts", "4.2.2-1");
     } else
 #endif
     if (progArgv[0][0] == '<') {
@@ -307,7 +306,7 @@ int parseScript(rpmSpec spec, int parsePart)
     }
 
     if (scriptFlags) {
-       rpmlibNeedsFeature(pkg->header, "ScriptletExpansion", "4.9.0-1");
+       rpmlibNeedsFeature(pkg, "ScriptletExpansion", "4.9.0-1");
     }
 
     /* Trigger script insertion is always delayed in order to */
@@ -339,7 +338,7 @@ int parseScript(rpmSpec spec, int parsePart)
            td.data = (void *) *progArgv;
            td.type = RPM_STRING_TYPE;
        } else {
-           (void) rpmlibNeedsFeature(pkg->header,
+           (void) rpmlibNeedsFeature(pkg,
                        "ScriptletInterpreterArgs", "4.0.3-1");
            td.data = progArgv;
            td.type = RPM_STRING_ARRAY_TYPE;
index c506a10..4e39bab 100644 (file)
@@ -107,14 +107,14 @@ int addReqProv(Header h, rpmTagVal tagN,
     return 0;
 }
 
-int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR)
+int rpmlibNeedsFeature(Package pkg, const char * feature, const char * featureEVR)
 {
     char *reqname = NULL;
     int res;
 
     rasprintf(&reqname, "rpmlib(%s)", feature);
 
-    res = addReqProv(h, RPMTAG_REQUIRENAME, reqname, featureEVR,
+    res = addReqProv(pkg->header, RPMTAG_REQUIRENAME, reqname, featureEVR,
                     RPMSENSE_RPMLIB|(RPMSENSE_LESS|RPMSENSE_EQUAL), 0);
 
     free(reqname);
index 18f68b9..9aa417d 100644 (file)
@@ -410,13 +410,13 @@ int addReqProv(Header h, rpmTagVal tagN,
 
 /** \ingroup rpmbuild
  * Add rpmlib feature dependency.
- * @param h            header
+ * @param pkg          package
  * @param feature      rpm feature name (i.e. "rpmlib(Foo)" for feature Foo)
  * @param featureEVR   rpm feature epoch/version/release
  * @return             0 always
  */
 RPM_GNUC_INTERNAL
-int rpmlibNeedsFeature(Header h, const char * feature, const char * featureEVR);
+int rpmlibNeedsFeature(Package pkg, const char * feature, const char * featureEVR);
 
 #ifdef __cplusplus
 }