malmond / rpms / rpm

Forked from rpms/rpm 4 years ago
Clone

Blame SOURCES/0001-Show-list-of-files-only-once-when-use-rpm-ql-and-mul.patch

83a7c7
From 8dd8e37acc79da1ce0a36c3f86650defa474a6a9 Mon Sep 17 00:00:00 2001
83a7c7
From: Pavlina Moravcova Varekova <pmoravco@redhat.com>
83a7c7
Date: Thu, 14 Mar 2019 13:56:26 +0100
83a7c7
Subject: [PATCH] Show list of files only once when use rpm -ql and multiple
83a7c7
 rpm files
83a7c7
83a7c7
---
83a7c7
 lib/query.c       |  3 ++-
83a7c7
 tests/rpmquery.at | 18 ++++++++++++++++++
83a7c7
 2 files changed, 20 insertions(+), 1 deletion(-)
83a7c7
83a7c7
diff --git a/lib/query.c b/lib/query.c
83a7c7
index e5408e211..7568f67aa 100644
83a7c7
--- a/lib/query.c
83a7c7
+++ b/lib/query.c
83a7c7
@@ -574,7 +574,8 @@ int rpmcliArgIter(rpmts ts, QVA_t qva, ARGV_const_t argv)
83a7c7
 	    if (mi == NULL && qva->qva_source == RPMQV_PACKAGE) {
83a7c7
 		size_t l = strlen(*arg);
83a7c7
 		if (l > 4 && !strcmp(*arg + l - 4, ".rpm")) {
83a7c7
-		    rpmgi gi = rpmgiNew(ts, giFlags, argv);
83a7c7
+		    char * const argFirst[2] = { arg[0], NULL };
83a7c7
+		    rpmgi gi = rpmgiNew(ts, giFlags, argFirst);
83a7c7
 		    ecLocal = rpmgiShowMatches(qva, ts, gi);
83a7c7
 		    rpmgiFree(gi);
83a7c7
 		}
83a7c7
diff --git a/tests/rpmquery.at b/tests/rpmquery.at
83a7c7
index ab7bb3c46..0dc6d78b6 100644
83a7c7
--- a/tests/rpmquery.at
83a7c7
+++ b/tests/rpmquery.at
83a7c7
@@ -61,6 +61,24 @@ hello.spec
83a7c7
 [ignore])
83a7c7
 AT_CLEANUP
83a7c7
 
83a7c7
+# ------------------------------
83a7c7
+AT_SETUP([rpm -ql multiple *.rpm])
83a7c7
+AT_KEYWORDS([query])
83a7c7
+AT_CHECK([
83a7c7
+runroot rpm \
83a7c7
+  -ql \
83a7c7
+  /data/SRPMS/hello-1.0-1.src.rpm /data/RPMS/hello-1.0-1.i386.rpm
83a7c7
+],
83a7c7
+[0],
83a7c7
+[hello-1.0.tar.gz
83a7c7
+hello.spec
83a7c7
+/usr/local/bin/hello
83a7c7
+/usr/share/doc/hello-1.0
83a7c7
+/usr/share/doc/hello-1.0/FAQ
83a7c7
+],
83a7c7
+[ignore])
83a7c7
+AT_CLEANUP
83a7c7
+
83a7c7
 # ------------------------------
83a7c7
 AT_SETUP([rpmspec -q])
83a7c7
 AT_KEYWORDS([query])
83a7c7
-- 
83a7c7
2.17.2
83a7c7