From 16c7e1e023784b0311e151b8a55b7d50a8732efe Mon Sep 17 00:00:00 2001 From: Sebastien Luttringer <sebastien.luttringer@smartjog.com> Date: Tue, 18 Oct 2011 18:33:53 +0200 Subject: [PATCH] Add command changelog --- bin/is | 18 ++++++++++++++++++ installsystems/image.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/bin/is b/bin/is index 8016075..d54e2a5 100755 --- a/bin/is +++ b/bin/is @@ -100,6 +100,15 @@ def c_cat(parser, args): for filename in args.file: img.cat(filename) +def c_changelog(parser, args): + ''' + Display image's changelog + ''' + # looks if arguments is a file or image name + repoman = load_repositories(args) + img, repo = select_image(args.image, repoman, args.best) + img.changelog.show(int(img.version), args.verbose) + def c_check(parser, args): ''' Check for unreferenced and missing files inside a repository @@ -341,6 +350,15 @@ p_cat.add_argument("file", nargs="+", help="file inside image to cat (globbing allowed)") p_cat.set_defaults(func=c_cat) +# changelog command parser +p_changelog = subparsers.add_parser("changelog", help=c_changelog.__doc__.lower()) +p_changelog.add_argument("-b", "--best", action="store_true", default=False, + help="in best mode, image is the most recent in all repositories") +p_changelog.add_argument("-v", action="store_true", dest="verbose", default=False, + help="display changelog for all versions") +p_changelog.add_argument("image", help="<path|[repository/]image[:version]>") +p_changelog.set_defaults(func=c_changelog) + # check command parser p_check = subparsers.add_parser("check", help=c_check.__doc__.lower()) p_check.add_argument("repository", nargs="+", help="repositories to check") diff --git a/installsystems/image.py b/installsystems/image.py index 5f4a790..4e3e52e 100644 --- a/installsystems/image.py +++ b/installsystems/image.py @@ -517,7 +517,7 @@ class PackageImage(Image): img_changelog = self._tarball.get_str("changelog") desc["changelog"] = Changelog(img_changelog) except KeyError: - pass + desc["changelog"] = Changelog("") except Exception as e: warn("Invalid changelog: %s" % e) return desc -- GitLab