diff --git a/0050-Consolidate-defattr-attr-root-root-generation-to-hel.patch b/0050-Consolidate-defattr-attr-root-root-generation-to-hel.patch new file mode 100644 index 0000000..3f8c576 --- /dev/null +++ b/0050-Consolidate-defattr-attr-root-root-generation-to-hel.patch @@ -0,0 +1,102 @@ +From c24003b77926967589546681ef893e4e11f6b77f Mon Sep 17 00:00:00 2001 +From: Panu Matilainen +Date: Fri, 19 May 2017 11:01:12 +0300 +Subject: [PATCH 50/53] Consolidate %defattr/%attr(-,root,root) generation to + helper function + +(cherry picked from commit b71d63ef598cb5bf504265a18166d782fb017569) +--- + build/files.c | 33 ++++++++++++++++++++++++--------- + 1 file changed, 24 insertions(+), 9 deletions(-) + +diff --git a/build/files.c b/build/files.c +index f27dcc7..e93efeb 100644 +--- a/build/files.c ++++ b/build/files.c +@@ -193,6 +193,16 @@ static void dupAttrRec(const AttrRec oar, AttrRec nar) + *nar = *oar; /* struct assignment */ + } + ++static char *mkattr(const char *fn) ++{ ++ char *s = NULL; ++ if (fn) ++ rasprintf(&s, "%s(-,%s,%s) %s", "%attr", "root", "root", fn); ++ else ++ rasprintf(&s, "%s(-,%s,%s)", "%defattr", "root", "root"); ++ return s; ++} ++ + static void copyFileEntry(FileEntry src, FileEntry dest) + { + /* Copying struct makes just shallow copy */ +@@ -1820,7 +1830,7 @@ static int generateBuildIDs(FileList fl) + fl->cur.verifyFlags = RPMVERIFY_ALL; + fl->def.specdFlags |= SPECD_VERIFY; + fl->cur.specdFlags |= SPECD_VERIFY; +- attrstr = xstrdup ("%defattr(-,root,root)"); ++ attrstr = mkattr(NULL); + parseForAttr(fl->pool, attrstr, 1, &fl->def); + free (attrstr); + +@@ -1833,8 +1843,7 @@ static int generateBuildIDs(FileList fl) + if ((rc = rpmioMkpath(mainiddir, 0755, -1, -1)) != 0) { + rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, mainiddir); + } else { +- rasprintf (&attrstr, "%s %s", "%attr(-,root,root) ", +- mainiddir); ++ attrstr = mkattr(mainiddir); + parseForAttr(fl->pool, attrstr, 0, &fl->cur); + fl->cur.isDir = 1; + rc = addFile(fl, mainiddir, NULL); +@@ -1846,8 +1855,7 @@ static int generateBuildIDs(FileList fl) + if ((rc = rpmioMkpath(debugiddir, 0755, -1, -1)) != 0) { + rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, debugiddir); + } else { +- rasprintf (&attrstr, "%s %s", "%attr(-,root,root) ", +- debugiddir); ++ attrstr = mkattr(debugiddir); + parseForAttr(fl->pool, attrstr, 0, &fl->cur); + fl->cur.isDir = 1; + rc = addFile(fl, debugiddir, NULL); +@@ -2739,8 +2747,10 @@ static void filterDebuginfoPackage(rpmSpec spec, Package pkg, + if (access(path, F_OK) == 0) { + /* Append the file list preamble */ + if (!files) { +- argvAdd(&files, "%defattr(-,root,root)"); ++ char *attr = mkattr(NULL); ++ argvAdd(&files, attr); + argvAddDir(&files, DEBUG_LIB_DIR); ++ free(attr); + } + + /* Add the files main debug-info file */ +@@ -2797,8 +2807,10 @@ static int addDebugDwz(Package pkg, char *buildroot) + rasprintf(&path, "%s%s", buildroot, DEBUG_DWZ_DIR); + if (lstat(path, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)) { + if (!pkg->fileList) { +- argvAdd(&pkg->fileList, "%defattr(-,root,root)"); ++ char *attr = mkattr(NULL); ++ argvAdd(&pkg->fileList, attr); + argvAddDir(&pkg->fileList, DEBUG_LIB_DIR); ++ free(attr); + } + argvAdd(&pkg->fileList, DEBUG_DWZ_DIR); + ret = 1; +@@ -2828,8 +2840,11 @@ static int addDebugSrc(Package pkg, char *buildroot) + if (!strcmp(de->d_name, ".") || !strcmp(de->d_name, "..")) + continue; + rasprintf(&path, "%s/%s", DEBUG_SRC_DIR, de->d_name); +- if (!pkg->fileList) +- argvAdd(&pkg->fileList, "%defattr(-,root,root)"); ++ if (!pkg->fileList) { ++ char *attr = mkattr(NULL); ++ argvAdd(&pkg->fileList, attr); ++ free(attr); ++ } + argvAdd(&pkg->fileList, path); + path = _free(path); + ret = 1; +-- +2.9.4 + diff --git a/0050-fixup-Support-debuginfo-subpackages.patch b/0050-fixup-Support-debuginfo-subpackages.patch deleted file mode 100644 index 95caa0c..0000000 --- a/0050-fixup-Support-debuginfo-subpackages.patch +++ /dev/null @@ -1,25 +0,0 @@ -From bacdd7eeac9abb5046f5163a79ec8296287d83fc Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Fri, 30 Jun 2017 16:52:03 +0200 -Subject: [PATCH 50/50] fixup! Support debuginfo subpackages - ---- - build/files.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/build/files.c b/build/files.c -index 933fad35b..f27dcc7c1 100644 ---- a/build/files.c -+++ b/build/files.c -@@ -2930,7 +2930,7 @@ rpmRC processBinaryFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, - rpmlog(RPMLOG_NOTICE, _("Processing files: %s\n"), nvr); - free(nvr); - -- if ((rc = processPackageFiles(spec, pkgFlags, pkg, didInstall, test)) != RPMRC_OK) -+ if ((rc = processPackageFiles(spec, pkgFlags, pkg, installSpecialDoc, test)) != RPMRC_OK) - goto exit; - - if (maindbg) --- -2.13.2 - diff --git a/0051-Extract-package-file-list-processing-in-separate-fun.patch b/0051-Extract-package-file-list-processing-in-separate-fun.patch new file mode 100644 index 0000000..a35e5ab --- /dev/null +++ b/0051-Extract-package-file-list-processing-in-separate-fun.patch @@ -0,0 +1,259 @@ +From bc5990647ad94fcb4acdb68612e16fe514ee59b7 Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 29 Jun 2017 13:26:24 +0200 +Subject: [PATCH 51/53] Extract package file list processing in separate + functions. + +Extract two functions resetPackageFilesDefaults() and addPackageFileList() +from processPackageFiles(). This will make it possible to add multiple +(generated) file lists to a package later. + +Signed-off-by: Mark Wielaard +(cherry picked from commit 139d62d3b8068b0e39893babf13f0c3cc5329e75) +--- + build/files.c | 170 ++++++++++++++++++++++++++++++++++++---------------------- + 1 file changed, 107 insertions(+), 63 deletions(-) + +diff --git a/build/files.c b/build/files.c +index e93efeb..8baf85e 100644 +--- a/build/files.c ++++ b/build/files.c +@@ -2307,45 +2307,35 @@ static void processSpecialDir(rpmSpec spec, Package pkg, FileList fl, + freeStringBuf(docScript); + free(mkdocdir); + } +- + +-static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, +- Package pkg, int installSpecialDoc, int test) ++ ++/* Resets the default settings for files in the package list. ++ Used in processPackageFiles whenever a new set of files is added. */ ++static void resetPackageFilesDefaults (struct FileList_s *fl, ++ rpmBuildPkgFlags pkgFlags) + { + struct AttrRec_s root_ar = { 0, 0, 0, 0, 0, 0 }; +- struct FileList_s fl; +- ARGV_t fileNames = NULL; +- specialDir specialDoc = NULL; +- specialDir specialLic = NULL; + +- pkg->cpioList = NULL; ++ root_ar.ar_user = rpmstrPoolId(fl->pool, "root", 1); ++ root_ar.ar_group = rpmstrPoolId(fl->pool, "root", 1); ++ dupAttrRec(&root_ar, &fl->def.ar); /* XXX assume %defattr(-,root,root) */ + +- for (ARGV_const_t fp = pkg->fileFile; fp && *fp != NULL; fp++) { +- if (readFilesManifest(spec, pkg, *fp)) +- return RPMRC_FAIL; +- } +- /* Init the file list structure */ +- memset(&fl, 0, sizeof(fl)); +- +- fl.pool = rpmstrPoolLink(spec->pool); +- /* XXX spec->buildRoot == NULL, then xstrdup("") is returned */ +- fl.buildRoot = rpmGenPath(spec->rootDir, spec->buildRoot, NULL); +- fl.buildRootLen = strlen(fl.buildRoot); ++ fl->def.verifyFlags = RPMVERIFY_ALL; + +- root_ar.ar_user = rpmstrPoolId(fl.pool, "root", 1); +- root_ar.ar_group = rpmstrPoolId(fl.pool, "root", 1); +- dupAttrRec(&root_ar, &fl.def.ar); /* XXX assume %defattr(-,root,root) */ +- +- fl.def.verifyFlags = RPMVERIFY_ALL; +- +- fl.pkgFlags = pkgFlags; ++ fl->pkgFlags = pkgFlags; ++} + +- { char *docs = rpmGetPath("%{?__docdir_path}", NULL); +- argvSplit(&fl.docDirs, docs, ":"); +- free(docs); +- } +- +- for (ARGV_const_t fp = pkg->fileList; *fp != NULL; fp++) { ++/* Adds the given fileList to the package. If fromSpecFileList is not zero ++ then the specialDirs are also filled in and the files are sanitized ++ through processBinaryFile(). Otherwise no special files are processed ++ and the files are added directly through addFile(). */ ++static void addPackageFileList (struct FileList_s *fl, Package pkg, ++ ARGV_t *fileList, ++ specialDir *specialDoc, specialDir *specialLic, ++ int fromSpecFileList) ++{ ++ ARGV_t fileNames = NULL; ++ for (ARGV_const_t fp = *fileList; *fp != NULL; fp++) { + char buf[strlen(*fp) + 1]; + const char *s = *fp; + SKIPSPACE(s); +@@ -2355,41 +2345,63 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, + rstrlcpy(buf, s, sizeof(buf)); + + /* Reset for a new line in %files */ +- FileEntryFree(&fl.cur); ++ FileEntryFree(&fl->cur); + + /* turn explicit flags into %def'd ones (gosh this is hacky...) */ +- fl.cur.specdFlags = ((unsigned)fl.def.specdFlags) >> 8; +- fl.cur.verifyFlags = fl.def.verifyFlags; +- +- if (parseForVerify(buf, 0, &fl.cur) || +- parseForVerify(buf, 1, &fl.def) || +- parseForAttr(fl.pool, buf, 0, &fl.cur) || +- parseForAttr(fl.pool, buf, 1, &fl.def) || +- parseForDev(buf, &fl.cur) || +- parseForConfig(buf, &fl.cur) || +- parseForLang(buf, &fl.cur) || +- parseForCaps(buf, &fl.cur) || +- parseForSimple(buf, &fl.cur, &fileNames)) ++ fl->cur.specdFlags = ((unsigned)fl->def.specdFlags) >> 8; ++ fl->cur.verifyFlags = fl->def.verifyFlags; ++ ++ if (parseForVerify(buf, 0, &fl->cur) || ++ parseForVerify(buf, 1, &fl->def) || ++ parseForAttr(fl->pool, buf, 0, &fl->cur) || ++ parseForAttr(fl->pool, buf, 1, &fl->def) || ++ parseForDev(buf, &fl->cur) || ++ parseForConfig(buf, &fl->cur) || ++ parseForLang(buf, &fl->cur) || ++ parseForCaps(buf, &fl->cur) || ++ parseForSimple(buf, &fl->cur, &fileNames)) + { +- fl.processingFailed = 1; ++ fl->processingFailed = 1; + continue; + } + + for (ARGV_const_t fn = fileNames; fn && *fn; fn++) { +- if (fl.cur.attrFlags & RPMFILE_SPECIALDIR) { +- rpmFlags oattrs = (fl.cur.attrFlags & ~RPMFILE_SPECIALDIR); ++ ++ /* For file lists that don't come from a spec file list ++ processing is easy. There are no special files and the ++ file names don't need to be adjusted. */ ++ if (!fromSpecFileList) { ++ if (fl->cur.attrFlags & RPMFILE_SPECIALDIR ++ || fl->cur.attrFlags & RPMFILE_DOCDIR ++ || fl->cur.attrFlags & RPMFILE_PUBKEY) { ++ rpmlog(RPMLOG_ERR, ++ _("Special file in generated file list: %s\n"), ++ *fn); ++ fl->processingFailed = 1; ++ continue; ++ } ++ if (fl->cur.attrFlags & RPMFILE_DIR) ++ fl->cur.isDir = 1; ++ addFile(fl, *fn, NULL); ++ continue; ++ } ++ ++ /* File list does come from the spec, try to detect special ++ files and adjust the actual file names. */ ++ if (fl->cur.attrFlags & RPMFILE_SPECIALDIR) { ++ rpmFlags oattrs = (fl->cur.attrFlags & ~RPMFILE_SPECIALDIR); + specialDir *sdp = NULL; + if (oattrs == RPMFILE_DOC) { +- sdp = &specialDoc; ++ sdp = specialDoc; + } else if (oattrs == RPMFILE_LICENSE) { +- sdp = &specialLic; ++ sdp = specialLic; + } + + if (sdp == NULL || **fn == '/') { + rpmlog(RPMLOG_ERR, + _("Can't mix special %s with other forms: %s\n"), + (oattrs & RPMFILE_DOC) ? "%doc" : "%license", *fn); +- fl.processingFailed = 1; ++ fl->processingFailed = 1; + continue; + } + +@@ -2397,32 +2409,65 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, + if (*sdp == NULL) { + *sdp = specialDirNew(pkg->header, oattrs); + } +- addSpecialFile(*sdp, *fn, &fl.cur, &fl.def); ++ addSpecialFile(*sdp, *fn, &fl->cur, &fl->def); + continue; + } + + /* this is now an artificial limitation */ + if (fn != fileNames) { + rpmlog(RPMLOG_ERR, _("More than one file on a line: %s\n"),*fn); +- fl.processingFailed = 1; ++ fl->processingFailed = 1; + continue; + } + +- if (fl.cur.attrFlags & RPMFILE_DOCDIR) { +- argvAdd(&(fl.docDirs), *fn); +- } else if (fl.cur.attrFlags & RPMFILE_PUBKEY) { +- (void) processMetadataFile(pkg, &fl, *fn, RPMTAG_PUBKEYS); ++ if (fl->cur.attrFlags & RPMFILE_DOCDIR) { ++ argvAdd(&(fl->docDirs), *fn); ++ } else if (fl->cur.attrFlags & RPMFILE_PUBKEY) { ++ (void) processMetadataFile(pkg, fl, *fn, RPMTAG_PUBKEYS); + } else { +- if (fl.cur.attrFlags & RPMFILE_DIR) +- fl.cur.isDir = 1; +- (void) processBinaryFile(pkg, &fl, *fn); ++ if (fl->cur.attrFlags & RPMFILE_DIR) ++ fl->cur.isDir = 1; ++ (void) processBinaryFile(pkg, fl, *fn); + } + } + +- if (fl.cur.caps) +- fl.haveCaps = 1; ++ if (fl->cur.caps) ++ fl->haveCaps = 1; ++ } ++ argvFree(fileNames); ++} ++ ++static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, ++ Package pkg, int installSpecialDoc, int test) ++{ ++ struct FileList_s fl; ++ specialDir specialDoc = NULL; ++ specialDir specialLic = NULL; ++ ++ pkg->cpioList = NULL; ++ ++ for (ARGV_const_t fp = pkg->fileFile; fp && *fp != NULL; fp++) { ++ if (readFilesManifest(spec, pkg, *fp)) ++ return RPMRC_FAIL; ++ } ++ /* Init the file list structure */ ++ memset(&fl, 0, sizeof(fl)); ++ ++ fl.pool = rpmstrPoolLink(spec->pool); ++ /* XXX spec->buildRoot == NULL, then xstrdup("") is returned */ ++ fl.buildRoot = rpmGenPath(spec->rootDir, spec->buildRoot, NULL); ++ fl.buildRootLen = strlen(fl.buildRoot); ++ ++ resetPackageFilesDefaults (&fl, pkgFlags); ++ ++ { char *docs = rpmGetPath("%{?__docdir_path}", NULL); ++ argvSplit(&fl.docDirs, docs, ":"); ++ free(docs); + } + ++ addPackageFileList (&fl, pkg, &pkg->fileList, ++ &specialDoc, &specialLic, 1); ++ + /* Now process special docs and licenses if present */ + if (specialDoc) + processSpecialDir(spec, pkg, &fl, specialDoc, installSpecialDoc, test); +@@ -2451,7 +2496,6 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, + genCpioListAndHeader(&fl, pkg, 0); + + exit: +- argvFree(fileNames); + FileListFree(&fl); + specialDirFree(specialDoc); + specialDirFree(specialLic); +-- +2.9.4 + diff --git a/0052-Use-a-file-list-to-add-build-id-files-to-pkgList.patch b/0052-Use-a-file-list-to-add-build-id-files-to-pkgList.patch new file mode 100644 index 0000000..74b4de3 --- /dev/null +++ b/0052-Use-a-file-list-to-add-build-id-files-to-pkgList.patch @@ -0,0 +1,193 @@ +From 97ad525723d0c9af382acadc823b6a744d5426cf Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 29 Jun 2017 13:26:25 +0200 +Subject: [PATCH 52/53] Use a file list to add build-id files to pkgList. + +Change the generation of build-id files to a file list using ARGV_t. +First go through the current package list and generate a files list. +Then add those files as if they were part of the original package file +list using the new resetPackageFilesDefaults() and addPackageFileList(). + +Signed-off-by: Mark Wielaard +(cherry picked from commit 88b7f24547afbfec42bb727e28d929a815db971a) +--- + build/files.c | 74 ++++++++++++++++++++++++++--------------------------------- + 1 file changed, 33 insertions(+), 41 deletions(-) + +diff --git a/build/files.c b/build/files.c +index 8baf85e..e88a5d2 100644 +--- a/build/files.c ++++ b/build/files.c +@@ -1576,6 +1576,15 @@ exit: + return rc; + } + ++/* add a directory to the file list */ ++static void argvAddDir(ARGV_t *filesp, const char *dir) ++{ ++ char *line = NULL; ++ rasprintf(&line, "%%dir %s", dir); ++ argvAdd(filesp, line); ++ _free(line); ++} ++ + #if HAVE_LIBDW + /* How build id links are generated. See macros.in for description. */ + #define BUILD_IDS_NONE 0 +@@ -1583,7 +1592,7 @@ exit: + #define BUILD_IDS_SEPARATE 2 + #define BUILD_IDS_COMPAT 3 + +-static int addNewIDSymlink(FileList fl, ++static int addNewIDSymlink(ARGV_t *files, + char *targetpath, char *idlinkpath, + int isDbg, int *dups) + { +@@ -1632,8 +1641,7 @@ static int addNewIDSymlink(FileList fl, + rpmlog(RPMLOG_ERR, "%s: %s -> %s: %m\n", + linkerr, linkpath, targetpath); + } else { +- fl->cur.isDir = 0; +- rc = addFile(fl, linkpath, NULL); ++ rc = argvAdd(files, linkpath); + } + + if (nr > 0) { +@@ -1671,7 +1679,7 @@ static int addNewIDSymlink(FileList fl, + return rc; + } + +-static int generateBuildIDs(FileList fl) ++static int generateBuildIDs(FileList fl, ARGV_t *files) + { + int rc = 0; + int i; +@@ -1820,18 +1828,9 @@ static int generateBuildIDs(FileList fl) + mainiddir = rpmGetPath(fl->buildRoot, BUILD_ID_DIR, NULL); + debugiddir = rpmGetPath(fl->buildRoot, DEBUG_ID_DIR, NULL); + +- /* Make sure to reset all file flags to defaults. +- Uses parseForAttr to reset ar, arFlags, and specdFlags. +- Note that parseForAttr pokes at the attrstr, so we cannot +- just pass a static string. */ +- fl->cur.attrFlags = 0; +- fl->def.attrFlags = 0; +- fl->def.verifyFlags = RPMVERIFY_ALL; +- fl->cur.verifyFlags = RPMVERIFY_ALL; +- fl->def.specdFlags |= SPECD_VERIFY; +- fl->cur.specdFlags |= SPECD_VERIFY; ++ /* Make sure to reset all file flags to defaults. */ + attrstr = mkattr(NULL); +- parseForAttr(fl->pool, attrstr, 1, &fl->def); ++ argvAdd(files, attrstr); + free (attrstr); + + /* Supported, but questionable. */ +@@ -1843,11 +1842,7 @@ static int generateBuildIDs(FileList fl) + if ((rc = rpmioMkpath(mainiddir, 0755, -1, -1)) != 0) { + rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, mainiddir); + } else { +- attrstr = mkattr(mainiddir); +- parseForAttr(fl->pool, attrstr, 0, &fl->cur); +- fl->cur.isDir = 1; +- rc = addFile(fl, mainiddir, NULL); +- free (attrstr); ++ argvAddDir(files, mainiddir); + } + } + +@@ -1855,11 +1850,7 @@ static int generateBuildIDs(FileList fl) + if ((rc = rpmioMkpath(debugiddir, 0755, -1, -1)) != 0) { + rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, debugiddir); + } else { +- attrstr = mkattr(debugiddir); +- parseForAttr(fl->pool, attrstr, 0, &fl->cur); +- fl->cur.isDir = 1; +- rc = addFile(fl, debugiddir, NULL); +- free (attrstr); ++ argvAddDir(files, debugiddir); + } + } + } +@@ -1898,9 +1889,9 @@ static int generateBuildIDs(FileList fl) + && (rc = rpmioMkpath(buildidsubdir, 0755, -1, -1)) != 0) { + rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, buildidsubdir); + } else { +- fl->cur.isDir = 1; +- if (!addsubdir +- || (rc = addFile(fl, buildidsubdir, NULL)) == 0) { ++ if (addsubdir) ++ argvAddDir (files, buildidsubdir); ++ if (rc == 0) { + char *linkpattern, *targetpattern; + char *linkpath, *targetpath; + int dups = 0; +@@ -1914,7 +1905,7 @@ static int generateBuildIDs(FileList fl) + rasprintf(&linkpath, linkpattern, + buildidsubdir, &ids[i][2]); + rasprintf(&targetpath, targetpattern, paths[i]); +- rc = addNewIDSymlink(fl, targetpath, linkpath, ++ rc = addNewIDSymlink(files, targetpath, linkpath, + isDbg, &dups); + + /* We might want to have a link from the debug +@@ -1960,7 +1951,7 @@ static int generateBuildIDs(FileList fl) + "../../../.build-id%s/%s.%d", + subdir, &ids[i][2], dups); + } +- rc = addNewIDSymlink(fl, targetpath, linkpath, ++ rc = addNewIDSymlink(files, targetpath, linkpath, + 0, NULL); + } + +@@ -1998,7 +1989,7 @@ static int generateBuildIDs(FileList fl) + buildidsubdir, &ids[i][2]); + rasprintf(&targetpath, "../../../../..%s", + targetstr); +- rc = addNewIDSymlink(fl, targetpath, ++ rc = addNewIDSymlink(files, targetpath, + linkpath, 0, &dups); + free(targetstr); + } +@@ -2481,11 +2472,21 @@ static rpmRC processPackageFiles(rpmSpec spec, rpmBuildPkgFlags pkgFlags, + /* Check build-ids and add build-ids links for files to package list. */ + const char *arch = headerGetString(pkg->header, RPMTAG_ARCH); + if (!rstreq(arch, "noarch")) { +- if (generateBuildIDs (&fl) != 0) { ++ /* Go through the current package list and generate a files list. */ ++ ARGV_t idFiles = NULL; ++ if (generateBuildIDs (&fl, &idFiles) != 0) { + rpmlog(RPMLOG_ERR, _("Generating build-id links failed\n")); + fl.processingFailed = 1; + goto exit; + } ++ ++ if (idFiles != NULL) { ++ resetPackageFilesDefaults (&fl, pkgFlags); ++ addPackageFileList (&fl, pkg, &idFiles, NULL, NULL, 0); ++ } ++ ++ if (fl.processingFailed) ++ goto exit; + } + #endif + +@@ -2743,15 +2744,6 @@ static Package cloneDebuginfoPackage(rpmSpec spec, Package pkg, Package maindbg) + return dbg; + } + +-/* add a directory to the file list */ +-static void argvAddDir(ARGV_t *filesp, const char *dir) +-{ +- char *line = NULL; +- rasprintf(&line, "%%dir %s", dir); +- argvAdd(filesp, line); +- _free(line); +-} +- + /* collect the debug files for package pkg and put them into + * a (possibly new) debuginfo subpackage */ + static void filterDebuginfoPackage(rpmSpec spec, Package pkg, +-- +2.9.4 + diff --git a/0053-Change-mkattr-to-always-create-a-defattr-with-explic.patch b/0053-Change-mkattr-to-always-create-a-defattr-with-explic.patch new file mode 100644 index 0000000..e435496 --- /dev/null +++ b/0053-Change-mkattr-to-always-create-a-defattr-with-explic.patch @@ -0,0 +1,85 @@ +From 13369a562f5cba34779e238b2d6ae0b683ff3b1e Mon Sep 17 00:00:00 2001 +From: Mark Wielaard +Date: Thu, 29 Jun 2017 13:26:26 +0200 +Subject: [PATCH 53/53] Change mkattr to always create a %defattr with + explicitly set modes. + +mkattr used "-" as default mode which would pick up the mode for files +as they were on disk. This could cause files generated by rpmbuild to +use a "non-standard" mode if umask was set by the user. Explitictly +use 755 for directories and 644 for files to make builds independent +of any umask settings. + +This works as is for both files and directories, so no file argument +is necessary anymore. + +https://bugzilla.redhat.com/show_bug.cgi?id=1452893 +https://bugzilla.redhat.com/show_bug.cgi?id=1458839 + +Signed-off-by: Mark Wielaard +(cherry picked from commit 261ba91172ca1536eaa1d76e9cde58643b66c8f3) +--- + build/files.c | 17 ++++++++--------- + 1 file changed, 8 insertions(+), 9 deletions(-) + +diff --git a/build/files.c b/build/files.c +index e88a5d2..2927492 100644 +--- a/build/files.c ++++ b/build/files.c +@@ -193,13 +193,12 @@ static void dupAttrRec(const AttrRec oar, AttrRec nar) + *nar = *oar; /* struct assignment */ + } + +-static char *mkattr(const char *fn) ++/* Creates a default $defattr string. Can be used with argvAdd(). ++ Caller owns the new string which needs to be freed when done. */ ++static char *mkattr(void) + { + char *s = NULL; +- if (fn) +- rasprintf(&s, "%s(-,%s,%s) %s", "%attr", "root", "root", fn); +- else +- rasprintf(&s, "%s(-,%s,%s)", "%defattr", "root", "root"); ++ rasprintf(&s, "%s(644,%s,%s,755)", "%defattr", "root", "root"); + return s; + } + +@@ -1829,7 +1828,7 @@ static int generateBuildIDs(FileList fl, ARGV_t *files) + debugiddir = rpmGetPath(fl->buildRoot, DEBUG_ID_DIR, NULL); + + /* Make sure to reset all file flags to defaults. */ +- attrstr = mkattr(NULL); ++ attrstr = mkattr(); + argvAdd(files, attrstr); + free (attrstr); + +@@ -2783,7 +2782,7 @@ static void filterDebuginfoPackage(rpmSpec spec, Package pkg, + if (access(path, F_OK) == 0) { + /* Append the file list preamble */ + if (!files) { +- char *attr = mkattr(NULL); ++ char *attr = mkattr(); + argvAdd(&files, attr); + argvAddDir(&files, DEBUG_LIB_DIR); + free(attr); +@@ -2843,7 +2842,7 @@ static int addDebugDwz(Package pkg, char *buildroot) + rasprintf(&path, "%s%s", buildroot, DEBUG_DWZ_DIR); + if (lstat(path, &sbuf) == 0 && S_ISDIR(sbuf.st_mode)) { + if (!pkg->fileList) { +- char *attr = mkattr(NULL); ++ char *attr = mkattr(); + argvAdd(&pkg->fileList, attr); + argvAddDir(&pkg->fileList, DEBUG_LIB_DIR); + free(attr); +@@ -2877,7 +2876,7 @@ static int addDebugSrc(Package pkg, char *buildroot) + continue; + rasprintf(&path, "%s/%s", DEBUG_SRC_DIR, de->d_name); + if (!pkg->fileList) { +- char *attr = mkattr(NULL); ++ char *attr = mkattr(); + argvAdd(&pkg->fileList, attr); + free(attr); + } +-- +2.9.4 + diff --git a/rpm.spec b/rpm.spec index 03e728c..689380c 100644 --- a/rpm.spec +++ b/rpm.spec @@ -33,7 +33,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}28%{?dist} +Release: %{?snapver:0.%{snapver}.}29%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2 @@ -130,6 +130,14 @@ Patch313: 0047-Re-enable-rich-dependecies-for-build-requires-and-co.patch Patch314: 0048-add-support-for-rich-dependencies-from-dependency-ge.patch Patch315: 0049-Pass-proper-file-index-when-recording-generated-depe.patch +# Use file list to explicitly set mode for build-id dirs/files. +# https://bugzilla.redhat.com/show_bug.cgi?id=1452893 +# https://bugzilla.redhat.com/show_bug.cgi?id=1458839 +Patch320: 0050-Consolidate-defattr-attr-root-root-generation-to-hel.patch +Patch321: 0051-Extract-package-file-list-processing-in-separate-fun.patch +Patch322: 0052-Use-a-file-list-to-add-build-id-files-to-pkgList.patch +Patch323: 0053-Change-mkattr-to-always-create-a-defattr-with-explic.patch + # These are not yet upstream Patch902: rpm-4.7.1-geode-i686.patch # Probably to be upstreamed in slightly different form @@ -628,6 +636,11 @@ exit 0 %doc doc/librpm/html/* %changelog +* Tue Jul 04 2017 Mark Wielaard - 4.13.0.1-29 +- Track patches using https://pagure.io/rpm-fedora +- Use file list to explicitly set mode for build-id dirs/files + (#1452893, #1458839) + * Thu Jun 29 2017 Mark Wielaard - 4.13.0.1-28 - Add debugedit-prefix.patch. - Add find-debuginfo-filter-built-ins.patch.