[PATCH 1/2] Add the -A option to makeupdates to allow easy extraction of multiple RPMs

Vratislav Podzimek vpodzime at redhat.com
Sun Feb 1 18:21:15 UTC 2015


This is very useful if we need to test a new version of some tool/library that
has multiple RPMs (as e.g. libblockdev with all its plugins).

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 scripts/makeupdates | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/scripts/makeupdates b/scripts/makeupdates
index ab420e3..0c8195a 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -978,6 +978,10 @@ def main():
                         dest='add_rpms', metavar='PATH_TO_RPM', default=[],
                         help='add contents of RPMs to the updates image')
 
+    parser.add_argument('-A', '--add-dir-rpms', action='append', type=str, nargs='+',
+                        dest='add_dir_rpms', metavar='PATH_TO_RPM_DIR', default=[],
+                        help='add contents of RPMs from the directory to the updates image')
+
     parser.add_argument('-f', '--fetch', action='store', type=str, metavar="ARCH",
                         help='autofetch new dependencies from Koji for ARCH')
 
@@ -1025,6 +1029,21 @@ def main():
     if args.po:
         copyTranslations(updates, cwd, builddir)
 
+    if args.add_dir_rpms:
+        # as using -A or --add-dir-rpms mutltiple times adds a new list to the
+        # list instead of extending the original list, we need to "normalize" to
+        # a one-level list of strings
+        rpm_dirs = []
+        for item in args.add_dir_rpms:
+            if isinstance(item, list):
+                rpm_dirs.extend(item)
+            else:
+                rpm_dirs.append(item)
+
+        # and now add the RPMs from all the dirs to the list of RPMs to add
+        for dir_path in rpm_dirs:
+            args.add_rpms.extend(glob.glob(os.path.join(dir_path, "*.rpm")))
+
     if args.add_rpms:
         # as using -a or --add mutltiple times
         # adds a new list to the list instead of extending the
-- 
2.1.0



More information about the anaconda-patches mailing list