alexk / rpms / rpm

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