From 80934099292c9e5acfb98216bfcd6ef73bf7df13 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 8 Nov 2017 11:15:01 +0200 Subject: [PATCH] Mark build-id and dwz entries in packages as %artifact files In worst-case scenarios (packages with lots of binaries but little else), the build-id entries can dominate the query output to the point its hard to see the actual content. Marking these things as %artifact entries (artificial by-products of our processing) allows them to be easily filtered out from queries, eg: $ rpm -qpl can-utils-20170830git-1.fc27.x86_64.rpm | wc -l 76 $ rpm -qpl --noartifact /can-utils-20170830git-1.fc27.x86_64.rpm | wc -l 28 Besides build-ids in the main package(s), this also marks the build-id and dwz-related entries in the debuginfo packages as %artifacts. The debuginfo files exist solely for carrying debuginfo data so its perhaps arguable whether these should be %artifacts in there too or only in the main packages, but ... if the very same thing is artifact in one then is it not also in the other? Additionally, all these build-ids and the dwz entries are in hidden directories on the filesystem even in the debuginfo packages which suggests they might be best swiped out of sight. --- build/files.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build/files.c b/build/files.c index 3c1e13b48..8d44d072e 100644 --- a/build/files.c +++ b/build/files.c @@ -1699,7 +1699,7 @@ static int addNewIDSymlink(ARGV_t *files, rpmlog(RPMLOG_ERR, "%s: %s -> %s: %m\n", linkerr, linkpath, targetpath); } else { - rc = argvAdd(files, linkpath); + argvAddAttr(files, RPMFILE_ARTIFACT, linkpath); } if (nr > 0) { @@ -1900,7 +1900,7 @@ static int generateBuildIDs(FileList fl, ARGV_t *files) if ((rc = rpmioMkpath(mainiddir, 0755, -1, -1)) != 0) { rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, mainiddir); } else { - argvAddAttr(files, RPMFILE_DIR, mainiddir); + argvAddAttr(files, RPMFILE_DIR|RPMFILE_ARTIFACT, mainiddir); } } @@ -1908,7 +1908,7 @@ static int generateBuildIDs(FileList fl, ARGV_t *files) if ((rc = rpmioMkpath(debugiddir, 0755, -1, -1)) != 0) { rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, debugiddir); } else { - argvAddAttr(files, RPMFILE_DIR, debugiddir); + argvAddAttr(files, RPMFILE_DIR|RPMFILE_ARTIFACT, debugiddir); } } } @@ -1948,7 +1948,7 @@ static int generateBuildIDs(FileList fl, ARGV_t *files) rpmlog(RPMLOG_ERR, "%s %s: %m\n", errdir, buildidsubdir); } else { if (addsubdir) - argvAddAttr(files, RPMFILE_DIR, buildidsubdir); + argvAddAttr(files, RPMFILE_DIR|RPMFILE_ARTIFACT, buildidsubdir); if (rc == 0) { char *linkpattern, *targetpattern; char *linkpath, *targetpath; @@ -2944,10 +2944,10 @@ static int addDebugDwz(Package pkg, char *buildroot) if (!pkg->fileList) { char *attr = mkattr(); argvAdd(&pkg->fileList, attr); - argvAddAttr(&pkg->fileList, RPMFILE_DIR, DEBUG_LIB_DIR); + argvAddAttr(&pkg->fileList, RPMFILE_DIR|RPMFILE_ARTIFACT, DEBUG_LIB_DIR); free(attr); } - argvAdd(&pkg->fileList, DEBUG_DWZ_DIR); + argvAddAttr(&pkg->fileList, RPMFILE_ARTIFACT, DEBUG_DWZ_DIR); ret = 1; } path = _free(path);