Panu Matilainen 6f54bf
From 4afe09cbcfbc43c1385b8626e69bea216600ee59 Mon Sep 17 00:00:00 2001
Panu Matilainen 6f54bf
Message-Id: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com>
Panu Matilainen 6f54bf
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 6f54bf
Date: Fri, 18 Aug 2017 12:43:27 +0300
Panu Matilainen 6f54bf
Subject: [PATCH 1/2] Add a flag to allow quiet test for package existence with
Panu Matilainen 6f54bf
 lookupPackage()
Panu Matilainen 6f54bf
Panu Matilainen 6f54bf
Turning "flag" into an actual bitfield requires testing for
Panu Matilainen 6f54bf
PART_NAME/PART_SUBNAME differently, no actual changes here though.
Panu Matilainen 6f54bf
---
Panu Matilainen 6f54bf
 build/rpmbuild_internal.h |  1 +
Panu Matilainen 6f54bf
 build/spec.c              | 16 +++++++++-------
Panu Matilainen 6f54bf
 2 files changed, 10 insertions(+), 7 deletions(-)
Panu Matilainen 6f54bf
Panu Matilainen 6f54bf
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
Panu Matilainen 6f54bf
index c294d5ee2..439b7d3b5 100644
Panu Matilainen 6f54bf
--- a/build/rpmbuild_internal.h
Panu Matilainen 6f54bf
+++ b/build/rpmbuild_internal.h
Panu Matilainen 6f54bf
@@ -138,6 +138,7 @@ struct Package_s {
Panu Matilainen 6f54bf
 
Panu Matilainen 6f54bf
 #define PART_SUBNAME  0
Panu Matilainen 6f54bf
 #define PART_NAME     1
Panu Matilainen 6f54bf
+#define PART_QUIET    2
Panu Matilainen 6f54bf
 
Panu Matilainen 6f54bf
 /** \ingroup rpmbuild
Panu Matilainen 6f54bf
  * rpmSpec file parser states.
Panu Matilainen 6f54bf
diff --git a/build/spec.c b/build/spec.c
Panu Matilainen 6f54bf
index 17a9b7c5a..39599e284 100644
Panu Matilainen 6f54bf
--- a/build/spec.c
Panu Matilainen 6f54bf
+++ b/build/spec.c
Panu Matilainen 6f54bf
@@ -73,7 +73,7 @@ rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg)
Panu Matilainen 6f54bf
     }
Panu Matilainen 6f54bf
 
Panu Matilainen 6f54bf
     /* Construct partial package name */
Panu Matilainen 6f54bf
-    if (flag == PART_SUBNAME) {
Panu Matilainen 6f54bf
+    if (!(flag & PART_NAME)) {
Panu Matilainen 6f54bf
 	rasprintf(&fullName, "%s-%s",
Panu Matilainen 6f54bf
 		 headerGetString(spec->packages->header, RPMTAG_NAME), name);
Panu Matilainen 6f54bf
 	name = fullName;
Panu Matilainen 6f54bf
@@ -87,12 +87,14 @@ rpmRC lookupPackage(rpmSpec spec, const char *name, int flag,Package *pkg)
Panu Matilainen 6f54bf
 	}
Panu Matilainen 6f54bf
     }
Panu Matilainen 6f54bf
 
Panu Matilainen 6f54bf
-    if (p == NULL && pkg != NULL) {
Panu Matilainen 6f54bf
-	rpmlog(RPMLOG_ERR, _("line %d: %s: package %s does not exist\n"),
Panu Matilainen 6f54bf
-				spec->lineNum, spec->line, name);
Panu Matilainen 6f54bf
-    } else if (p != NULL && pkg == NULL) {
Panu Matilainen 6f54bf
-	rpmlog(RPMLOG_ERR, _("line %d: %s: package %s already exists\n"),
Panu Matilainen 6f54bf
-				spec->lineNum, spec->line, name);
Panu Matilainen 6f54bf
+    if (!(flag & PART_QUIET)) {
Panu Matilainen 6f54bf
+	if (p == NULL && pkg != NULL) {
Panu Matilainen 6f54bf
+	    rpmlog(RPMLOG_ERR, _("line %d: %s: package %s does not exist\n"),
Panu Matilainen 6f54bf
+				    spec->lineNum, spec->line, name);
Panu Matilainen 6f54bf
+	} else if (p != NULL && pkg == NULL) {
Panu Matilainen 6f54bf
+	    rpmlog(RPMLOG_ERR, _("line %d: %s: package %s already exists\n"),
Panu Matilainen 6f54bf
+				    spec->lineNum, spec->line, name);
Panu Matilainen 6f54bf
+	}
Panu Matilainen 6f54bf
     }
Panu Matilainen 6f54bf
 
Panu Matilainen 6f54bf
     if (fullName == name)
Panu Matilainen 6f54bf
-- 
Panu Matilainen 6f54bf
2.13.5
Panu Matilainen 6f54bf
Panu Matilainen 6f54bf
From 054de0f50fc1c8aacb6c45fa4a0fcd8d9ce5b2d1 Mon Sep 17 00:00:00 2001
Panu Matilainen 6f54bf
Message-Id: <054de0f50fc1c8aacb6c45fa4a0fcd8d9ce5b2d1.1503051023.git.pmatilai@redhat.com>
Panu Matilainen 6f54bf
In-Reply-To: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com>
Panu Matilainen 6f54bf
References: <4afe09cbcfbc43c1385b8626e69bea216600ee59.1503051023.git.pmatilai@redhat.com>
Panu Matilainen 6f54bf
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen 6f54bf
Date: Fri, 18 Aug 2017 12:46:59 +0300
Panu Matilainen 6f54bf
Subject: [PATCH 2/2] Use silent lookup for debuginfo packages (#1482144)
Panu Matilainen 6f54bf
Panu Matilainen 6f54bf
Noarch packages do not have debuginfo, this was causing harmless
Panu Matilainen 6f54bf
but bogus error messages via lookupPackage(). Depends on commit
Panu Matilainen 6f54bf
4afe09cbcfbc43c1385b8626e69bea216600ee59.
Panu Matilainen 6f54bf
---
Panu Matilainen 6f54bf
 build/files.c | 2 +-
Panu Matilainen 6f54bf
 1 file changed, 1 insertion(+), 1 deletion(-)
Panu Matilainen 6f54bf
Panu Matilainen 6f54bf
diff --git a/build/files.c b/build/files.c
Panu Matilainen 6f54bf
index c7fe2485c..5e84532f1 100644
Panu Matilainen 6f54bf
--- a/build/files.c
Panu Matilainen 6f54bf
+++ b/build/files.c
Panu Matilainen 6f54bf
@@ -2981,7 +2981,7 @@ static int addDebugSrc(Package pkg, char *buildroot)
Panu Matilainen 6f54bf
 static Package findDebuginfoPackage(rpmSpec spec)
Panu Matilainen 6f54bf
 {
Panu Matilainen 6f54bf
     Package pkg = NULL;
Panu Matilainen 6f54bf
-    if (lookupPackage(spec, "debuginfo", PART_SUBNAME, &pkg))
Panu Matilainen 6f54bf
+    if (lookupPackage(spec, "debuginfo", PART_SUBNAME|PART_QUIET, &pkg))
Panu Matilainen 6f54bf
 	return NULL;
Panu Matilainen 6f54bf
     return pkg && pkg->fileList ? pkg : NULL;
Panu Matilainen 6f54bf
 }
Panu Matilainen 6f54bf
-- 
Panu Matilainen 6f54bf
2.13.5
Panu Matilainen 6f54bf