From 6f54bf086ac3fdf39ac21c5e2090fcb8e4234b3d Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 18 Aug 2017 16:17:46 +0300 Subject: [PATCH] Silence harmless but bogus error message on noarch packages (#1482144) --- rpm-4.13.90-silent-lookup.patch | 94 +++++++++++++++++++++++++++++++++ rpm.spec | 6 ++- 2 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 rpm-4.13.90-silent-lookup.patch diff --git a/rpm-4.13.90-silent-lookup.patch b/rpm-4.13.90-silent-lookup.patch new file mode 100644 index 0000000..f66978f --- /dev/null +++ b/rpm-4.13.90-silent-lookup.patch @@ -0,0 +1,94 @@ +From 4afe09cbcfbc43c1385b8626e69bea216600ee59 Mon Sep 17 00:00:00 2001 +Message-Id: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com> +From: Panu Matilainen +Date: Fri, 18 Aug 2017 12:43:27 +0300 +Subject: [PATCH 1/2] Add a flag to allow quiet test for package existence with + lookupPackage() + +Turning "flag" into an actual bitfield requires testing for +PART_NAME/PART_SUBNAME differently, no actual changes here though. +--- + build/rpmbuild_internal.h | 1 + + build/spec.c | 16 +++++++++------- + 2 files changed, 10 insertions(+), 7 deletions(-) + +diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h +index c294d5ee2..439b7d3b5 100644 +--- a/build/rpmbuild_internal.h ++++ b/build/rpmbuild_internal.h +@@ -138,6 +138,7 @@ struct Package_s { + + #define PART_SUBNAME 0 + #define PART_NAME 1 ++#define PART_QUIET 2 + + /** \ingroup rpmbuild + * rpmSpec file parser states. +diff --git a/build/spec.c b/build/spec.c +index 17a9b7c5a..39599e284 100644 +--- a/build/spec.c ++++ b/build/spec.c +@@ -73,7 +73,7 @@ rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg) + } + + /* Construct partial package name */ +- if (flag == PART_SUBNAME) { ++ if (!(flag & PART_NAME)) { + rasprintf(&fullName, "%s-%s", + headerGetString(spec->packages->header, RPMTAG_NAME), name); + name = fullName; +@@ -87,12 +87,14 @@ rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg) + } + } + +- if (p == NULL && pkg != NULL) { +- rpmlog(RPMLOG_ERR, _("line %d: %s: package %s does not exist\n"), +- spec->lineNum, spec->line, name); +- } else if (p != NULL && pkg == NULL) { +- rpmlog(RPMLOG_ERR, _("line %d: %s: package %s already exists\n"), +- spec->lineNum, spec->line, name); ++ if (!(flag & PART_QUIET)) { ++ if (p == NULL && pkg != NULL) { ++ rpmlog(RPMLOG_ERR, _("line %d: %s: package %s does not exist\n"), ++ spec->lineNum, spec->line, name); ++ } else if (p != NULL && pkg == NULL) { ++ rpmlog(RPMLOG_ERR, _("line %d: %s: package %s already exists\n"), ++ spec->lineNum, spec->line, name); ++ } + } + + if (fullName == name) +-- +2.13.5 + +From 054de0f50fc1c8aacb6c45fa4a0fcd8d9ce5b2d1 Mon Sep 17 00:00:00 2001 +Message-Id: <054de0f50fc1c8aacb6c45fa4a0fcd8d9ce5b2d1.1503051023.git.pmatilai@redhat.com> +In-Reply-To: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com> +References: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com> +From: Panu Matilainen +Date: Fri, 18 Aug 2017 12:46:59 +0300 +Subject: [PATCH 2/2] Use silent lookup for debuginfo packages (#1482144) + +Noarch packages do not have debuginfo, this was causing harmless +but bogus error messages via lookupPackage(). Depends on commit +4afe09cbcfbc43c1385b8626e69bea216600ee59. +--- + build/files.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/build/files.c b/build/files.c +index c7fe2485c..5e84532f1 100644 +--- a/build/files.c ++++ b/build/files.c +@@ -2981,7 +2981,7 @@ static int addDebugSrc(Package pkg, char *buildroot) + static Package findDebuginfoPackage(rpmSpec spec) + { + Package pkg = NULL; +- if (lookupPackage(spec, "debuginfo", PART_SUBNAME, &pkg)) ++ if (lookupPackage(spec, "debuginfo", PART_SUBNAME|PART_QUIET, &pkg)) + return NULL; + return pkg && pkg->fileList ? pkg : NULL; + } +-- +2.13.5 + diff --git a/rpm.spec b/rpm.spec index 8fe7cc8..d1c4eb7 100644 --- a/rpm.spec +++ b/rpm.spec @@ -37,7 +37,7 @@ Summary: The RPM package management system Name: rpm Version: %{rpmver} -Release: %{?snapver:0.%{snapver}.}5%{?dist} +Release: %{?snapver:0.%{snapver}.}6%{?dist} Group: System Environment/Base Url: http://www.rpm.org/ Source0: http://ftp.rpm.org/releases/%{srcdir}/%{name}-%{srcver}.tar.bz2 @@ -66,6 +66,7 @@ Patch6: rpm-4.14-disable-sha256hdr.patch Patch7: rpm-4.13.90-macro-noquote.patch # Patches already upstream: +Patch100: rpm-4.13.90-silent-lookup.patch # These are not yet upstream Patch906: rpm-4.7.1-geode-i686.patch @@ -641,6 +642,9 @@ exit 0 %doc doc/librpm/html/* %changelog +* Fri Aug 18 2017 Panu Matilainen - 4.13.90-0.git14000.6 +- Silence harmless but bogus error message on noarch packages (#1482144) + * Thu Aug 17 2017 Miro HronĨok - 4.13.90-0.git14002.5 - Build with platform_python