[master 26/30] Add glob support for the -a/--add option in makeupdates
KosiehBarter
installerbot-noreply at redhat.com
Thu Jul 16 12:00:50 UTC 2015
From: Martin Kolman <mkolman at redhat.com>
This makes it possible to easily add multiple RPMs to the
updates image without the need to individually name them all.
Usage examples:
makeupdates --add rpm/*.rpm
or
makeupdates --add rpm/libblockdev*.rpm
---
scripts/makeupdates | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/scripts/makeupdates b/scripts/makeupdates
index f3d0559..e03dd79 100755
--- a/scripts/makeupdates
+++ b/scripts/makeupdates
@@ -502,7 +502,17 @@ def addRpms(updates_path, add_rpms):
# relative paths can be used with -a/--add
add_rpms = map(os.path.abspath, add_rpms)
+ # resolve wildcards and also eliminate non-existing RPMs
+ resolved_rpms = []
for rpm in add_rpms:
+ resolved_path = glob.glob(rpm)
+ if not(resolved_path):
+ print("warning: requested rpm %s does not exist and can't be aded" % rpm)
+ elif len(resolved_path) > 1:
+ print("wildcard %s resolved to %d paths" % (rpm, len(resolved_path)))
+ resolved_rpms.extend(resolved_path)
+
+ for rpm in resolved_rpms:
cmd = "cd %s && rpm2cpio %s | cpio -dium" % (updates_path, rpm)
sys.stdout.write(cmd+"\n")
os.system(cmd)
@@ -989,7 +999,7 @@ def main():
parser.add_argument('-a', '--add', action=ExtendAction, type=str, nargs='+',
dest='add_rpms', metavar='PATH_TO_RPM', default=[],
- help='add contents of RPMs to the updates image')
+ help='add contents of RPMs to the updates image (glob supported)')
parser.add_argument('-f', '--fetch', action='store', type=str, metavar="ARCH",
help='autofetch new dependencies from Koji for ARCH')
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/39da315581bad00fe79a0c3f52bf28d2f8a99961
More information about the anaconda-patches
mailing list