Skip to content
Snippets Groups Projects
Commit 3292de1d authored by Aurélien Dunand's avatar Aurélien Dunand Committed by Seblu
Browse files

Add update command

parent 1761d033
No related branches found
No related tags found
No related merge requests found
......@@ -180,6 +180,26 @@ def c_list(parser, args):
arrow("Image %s v%s" % (pkg.name, pkg.version))
pkg.show(verbose=args.detail)
def c_update(parser, args):
'''
Build and update image on repo
'''
c_build(parser, args)
simg = SourceImage(args.path)
repoman = load_repositories(args)
if len(repoman) == 0:
raise Exception("No repository selected")
elif len(repoman) > 1:
raise Exception("Please select only one repository")
repo = repoman[0]
image = simg.description["name"]
version = simg.description["version"]
if repo.has(image, version):
repo.delete(image, version)
pkg = PackageImage(simg.image_name)
repo.add(pkg, delete=not args.preserve)
def c_cat(parser, args):
'''
Display image's file(s)
......@@ -297,6 +317,17 @@ p_install.add_argument("-v", "--image-version", type=int, default=None,
p_install.add_argument("image", help="image to install (path or name)")
p_install.set_defaults(func=c_install, subparser=p_install)
# update command parser
p_update = subparsers.add_parser("update", help=c_update.__doc__.lower())
p_update.add_argument('-f', "--force", action="store_true", default=False,
help="overwrite existing image")
p_update.add_argument('-c', "--no-check", action="store_true", default=False,
help="do not check compilation before adding scripts")
p_update.add_argument('-p', "--preserve", action="store_true", default=False,
help="don't remove image after adding to database")
p_update.add_argument("path", nargs="?", default=".")
p_update.set_defaults(func=c_update)
# cat command parser
p_cat = subparsers.add_parser("cat", help=c_cat.__doc__.lower())
p_cat.add_argument("-v", "--image-version", type=int, default=None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment