summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyota Mibu <r-mibu@cq.jp.nec.com>2018-06-25 10:14:31 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-06-25 10:14:31 +0000
commit47ddd0ab7b50538e0f7e7c23ad7567a1126eac57 (patch)
treecd295410bd3ed3e4bfd5ddfda94fe1efe72c30e8
parentd2755cb7237222d0e6a0ebf88fcf2464c2708f86 (diff)
parentb6e3c8d163e20de08e612c300097523ba2fb36b6 (diff)
Merge "Update the repo script to only list repos once"
-rwxr-xr-x[-rw-r--r--]releases/scripts/release-status.sh4
-rw-r--r--releases/scripts/repos.py42
2 files changed, 40 insertions, 6 deletions
diff --git a/releases/scripts/release-status.sh b/releases/scripts/release-status.sh
index da66bc936..6790100a7 100644..100755
--- a/releases/scripts/release-status.sh
+++ b/releases/scripts/release-status.sh
@@ -12,6 +12,8 @@ set -o pipefail
TAG="${TAG:-opnfv-6.0.0}"
RELEASE="${RELEASE:-fraser}"
+[ -a repos.txt ] && rm repos.txt
+
for project in releases/$RELEASE/*; do
python releases/scripts/repos.py -n -f $project >> repos.txt
done
@@ -21,5 +23,3 @@ do
tag="$(git ls-remote "https://gerrit.opnfv.org/gerrit/$repo.git" "refs/tags/$TAG")"
echo "$repo $tag"
done < repos.txt
-
-# rm repos.txt
diff --git a/releases/scripts/repos.py b/releases/scripts/repos.py
index 0ded0207b..58454c318 100644
--- a/releases/scripts/repos.py
+++ b/releases/scripts/repos.py
@@ -15,6 +15,38 @@ import argparse
import yaml
+class Repo(object):
+ """Object representing a repo listed in the release file.
+
+ Includes eq, hash, and ne methods so set comparisons work
+ """
+
+ def __init__(self, repo=None, ref=None, version=None):
+ self.repo = repo
+ self.ref = ref
+ self.version = version
+
+ def __repr__(self):
+ if self.version:
+ return "%s %s %s" % (self.repo, self.ref, self.version)
+ elif self.ref:
+ return "%s %s" % (self.repo, self.ref)
+ return "%s" % self.repo
+
+ def __eq__(self, obj):
+ if isinstance(obj, Repo):
+ return ((self.repo == obj.repo) and
+ (self.ref == obj.ref) and
+ (self.version == obj.version))
+ return False
+
+ def __ne__(self, obj):
+ return (not self.__eq__(obj))
+
+ def __hash__(self):
+ return hash(self.__repr__())
+
+
def main():
"""Given a release yamlfile list the repos it contains"""
@@ -45,15 +77,17 @@ def list_repos(project, args):
if 'releases' not in project:
exit(0)
+ repos = set()
for item in lookup:
repo, ref = next(iter(item['location'].items()))
if args.names:
- print(repo)
+ repos.add(Repo(repo))
elif args.release and item['version'] == args.release:
- print("%s %s" % (repo, ref))
+ repos.add(Repo(repo, ref))
elif not args.release:
- # Print all releases
- print("%s %s %s" % (repo, item['version'], ref))
+ repos.add(Repo(repo, ref, item['version']))
+ for repo in repos:
+ print repo
if __name__ == "__main__":