- accept files as command line arguments to rpmdeps again (#807767)

This commit is contained in:
Panu Matilainen 2012-03-29 11:41:48 +03:00
parent f34c5bc80a
commit 99eadda673
2 changed files with 50 additions and 1 deletions

View File

@ -0,0 +1,44 @@
commit 9a2547ff49ae2fa9a4c9118e5472bba045379f3d
Author: Panu Matilainen <pmatilai@redhat.com>
Date: Thu Mar 29 11:26:57 2012 +0300
Accept files as command line arguments again in rpmdeps (RhBug:807767)
- Commit a25c3c7bac95ab7eb55f0ecf0b8793d8da341611 removed what was
supposedly a non-supported method of passing files as arguments
(instead of the normal stdin method) to rpmdeps. Turns out
rpmdeps is even documented to take files as cli args, and that's
how Fedora's %filter_setup macros are calling it...
- Allow files as arguments again, but in a way that doesn't cause
argvFoo() vs popt crash-n-burn.
(cherry picked from commit fe252f21b370331016a952b085465cd97837aaef)
diff --git a/tools/rpmdeps.c b/tools/rpmdeps.c
index 6b0b527..c3112eb 100644
--- a/tools/rpmdeps.c
+++ b/tools/rpmdeps.c
@@ -60,11 +60,19 @@ main(int argc, char *argv[])
if (optCon == NULL)
goto exit;
- while (fgets(buf, sizeof(buf), stdin) != NULL) {
- char *be = buf + strlen(buf) - 1;
- while (strchr("\r\n", *be) != NULL)
- *be-- = '\0';
- argvAdd(&av, buf);
+ /* normally files get passed through stdin but also accept files as args */
+ if (poptPeekArg(optCon)) {
+ const char *arg;
+ while ((arg = poptGetArg(optCon)) != NULL) {
+ argvAdd(&av, arg);
+ }
+ } else {
+ while (fgets(buf, sizeof(buf), stdin) != NULL) {
+ char *be = buf + strlen(buf) - 1;
+ while (strchr("\r\n", *be) != NULL)
+ *be-- = '\0';
+ argvAdd(&av, buf);
+ }
}
/* Make sure file names are sorted. */
argvSort(av, NULL);

View File

@ -22,7 +22,7 @@
Summary: The RPM package management system
Name: rpm
Version: %{rpmver}
Release: %{?snapver:0.%{snapver}.}8%{?dist}
Release: %{?snapver:0.%{snapver}.}9%{?dist}
Group: System Environment/Base
Url: http://www.rpm.org/
Source0: http://rpm.org/releases/testing/%{name}-%{srcver}.tar.bz2
@ -48,6 +48,7 @@ Patch200: rpm-4.9.90-rpmte-fileinfo.patch
Patch201: rpm-4.9.90-rpmte-fileinfo-2.patch
Patch202: rpm-4.9.90-keyid-size.patch
Patch203: rpm-4.9.90-header-datalength.patch
Patch204: rpm-4.9.90-rpmdeps-args.patch
# These are not yet upstream
Patch301: rpm-4.6.0-niagara.patch
@ -221,6 +222,7 @@ packages on a system.
%patch201 -p1 -b .rpmte-fileinfo-2
%patch202 -p1 -b .keyid-size
%patch203 -p1 -b .header-datalength
%patch204 -p1 -b .rpmdeps-args
%patch301 -p1 -b .niagara
%patch302 -p1 -b .geode
@ -447,6 +449,9 @@ exit 0
%doc COPYING doc/librpm/html/*
%changelog
* Thu Mar 29 2012 Panu Matilainen <pmatilai@redhat.com> - 4.9.90-0.git11505.9
- accept files as command line arguments to rpmdeps again (#807767)
* Mon Mar 26 2012 Panu Matilainen <pmatilai@redhat.com> - 4.9.90-0.git11505.8
- remove fake library provide hacks now that deltarpm got rebuilt