From f4e6afd358db361ccda7e9da3a4bc7e7bb945a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Dunand?= Date: Tue, 19 Jun 2012 09:59:48 +0200 Subject: [PATCH] Update repo command, display repository uuid and version (if online) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Luttringer --- bin/is | 7 ++++++- completion/bash/is | 2 +- completion/zsh/_installsystems | 2 ++ doc/is.1.rst | 8 +++++++- installsystems/repository.py | 12 ++++++++++-- 5 files changed, 26 insertions(+), 5 deletions(-) diff --git a/bin/is b/bin/is index 28b1c57..207c050 100755 --- a/bin/is +++ b/bin/is @@ -430,7 +430,8 @@ def c_repo(args): repoman.show_repositories(args.repository, online=args.online, local=args.local, o_url=args.url, o_state=args.state, - o_json=args.json) + o_uuid=args.uuid, o_json=args.json, + o_version=args.repo_version) def c_search(args): ''' @@ -712,6 +713,10 @@ def arg_parser_init(): help="display repository state (online/offline/local/remote)") p.add_argument("-u", "--url", action="store_true", help="display repository url") + p.add_argument("-U", "--uuid", action="store_true", + help="display repository UUID") + p.add_argument("-v", "--version", dest="repo_version", action="store_true", + help="display repository version") p.add_argument("--purge", action="store_true", help="remove cache databases") p.add_argument("repository", nargs='*', default=[u"*"], help="repository pattern") diff --git a/completion/bash/is b/completion/bash/is index b4971a7..aa28f64 100644 --- a/completion/bash/is +++ b/completion/bash/is @@ -178,7 +178,7 @@ _is() { _filedir -d ;; repo) - [[ "$cur" == -* ]] && _opt '-h --help -l --local -r --remote -o --online -O --offline -s --state --force-offline --purge -u --url -j --json' && return 0 + [[ "$cur" == -* ]] && _opt '-h --help -l --local -r --remote -o --online -O --offline -s --state --force-offline --purge -u --url -U --uuid -j --json -v --version' && return 0 _repo ;; search) diff --git a/completion/zsh/_installsystems b/completion/zsh/_installsystems index 26eea1c..42e45f0 100644 --- a/completion/zsh/_installsystems +++ b/completion/zsh/_installsystems @@ -301,6 +301,8 @@ _is() { '(-O --offline)'{-O,--offline}'[list offline repository (filter)]' '(-s --state)'{-s,--state}'[display repository state (online/offline/local/remote)]' '(-u --url)'{-u,--url}'[display repository url]' + '(-U --uuid)'{-U,--uuid}'[display repository UUID]' + '(-v --version)'{-v,--version}'[display repository version]' '--purge[remove cache databases]' '*:repo:_installsystems_repo' ) diff --git a/doc/is.1.rst b/doc/is.1.rst index e5167de..9bf42ac 100644 --- a/doc/is.1.rst +++ b/doc/is.1.rst @@ -299,7 +299,7 @@ prepare_chroot [-h] [-m] *path* disable mounting of /{proc,dev,sys} -repo [-h] [-j] [-l|-r] [-o|-O] [-s] [-u] [--purge] [repository]... +repo [-h] [-j] [-l|-r] [-o|-O] [-s] [-u] [-U] [-v] [--purge] [repository]... List available repositories. By defaut, only names are displayed. -j, --json @@ -323,6 +323,12 @@ repo [-h] [-j] [-l|-r] [-o|-O] [-s] [-u] [--purge] [repository]... -u, --url display repository url + -U, --uuid + display repository UUID + + -v, --version + display repository version + --purge remove cache databases diff --git a/installsystems/repository.py b/installsystems/repository.py index 1021b58..05c54f2 100644 --- a/installsystems/repository.py +++ b/installsystems/repository.py @@ -1047,8 +1047,8 @@ class RepositoryManager(object): else: arrow("nothing to do", 1) - def show_repositories(self, patterns, local=None, online=None, - o_url=False, o_state=False, o_json=False): + def show_repositories(self, patterns, local=None, online=None, o_url=False, + o_state=False, o_uuid=False, o_json=False, o_version=False): ''' Show repository inside manager if :param online: is true, list only online repositories @@ -1072,6 +1072,9 @@ class RepositoryManager(object): continue repos[reponame] = dict(repo.config.items()) repos[reponame]["local"] = repo.local + if not repo.config.offline: + repos[reponame]["uuid"] = repo.uuid + repos[reponame]["version"] = repo.version # display result if o_json: s = json.dumps(repos) @@ -1088,6 +1091,11 @@ class RepositoryManager(object): ln += u"%s%s#R#"% (rc, name) if o_url: ln += u" (%s)" % repo["path"] + if not repo["offline"]: + if o_version: + ln += u" (#p#v%s#R#)" % repo["version"] + if o_uuid: + ln += u" [%s]" % repo["uuid"] l.append(ln) s = os.linesep.join(l) out(s) -- GitLab