[makeupdates][master][PATCH] Add glob support for the -a/--add option in makeupdates
Brian C. Lane
bcl at redhat.com
Wed Mar 11 14:53:48 UTC 2015
On Wed, Mar 11, 2015 at 03:09:35PM +0100, Martin Kolman wrote:
> 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
>
> Signed-off-by: Martin Kolman <mkolman at redhat.com>
> ---
> 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')
> --
> 2.1.0
Ack.
--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
More information about the anaconda-patches
mailing list