Include -attic in retired calculations
The retired thing works pretty well with acls - but our attic repos
are different. Retire them too.
Change-Id: Id25743db58ce4a1e3ba42e84fc298e737ec5f8a3
diff --git a/jeepyb/cmd/create_cgitrepos.py b/jeepyb/cmd/create_cgitrepos.py
index 9d85b7d..fac86f7 100644
--- a/jeepyb/cmd/create_cgitrepos.py
+++ b/jeepyb/cmd/create_cgitrepos.py
@@ -61,10 +61,9 @@
'DEFAULT_ORG is set.' % project)
(org, name) = (DEFAULT_ORG, project)
description = entry.get('description', name)
- retired = entry.get('acl-config', '').endswith('/retired.config')
assert project not in names
names.add(project)
- gitorgs.setdefault(org, []).append((name, description, retired))
+ gitorgs.setdefault(org, []).append((name, description))
if SCRATCH_SUBPATH:
assert SCRATCH_SUBPATH not in gitorgs
scratch_path = os.path.join(REPO_PATH, SCRATCH_SUBPATH)
@@ -90,15 +89,14 @@
org_dir = os.path.join(REPO_PATH, org)
projects = gitorgs[org]
projects.sort()
- for (name, description, retired) in projects:
- if not retired:
- project_repo = "%s.git" % os.path.join(org_dir, name)
- cgit_file.write('\n')
- cgit_file.write('repo.url=%s/%s\n' % (org, name))
- cgit_file.write('repo.path=%s/\n' % (project_repo))
- cgit_file.write('repo.desc=%s\n' % (description))
- cgit_file.write(
- 'repo.desc=%s\n' % (clean_string(description)))
+ for (name, description) in projects:
+ project_repo = "%s.git" % os.path.join(org_dir, name)
+ cgit_file.write('\n')
+ cgit_file.write('repo.url=%s/%s\n' % (org, name))
+ cgit_file.write('repo.path=%s/\n' % (project_repo))
+ cgit_file.write('repo.desc=%s\n' % (description))
+ cgit_file.write(
+ 'repo.desc=%s\n' % (clean_string(description)))
if not os.path.exists(project_repo):
subprocess.call(['git', 'init', '--bare', project_repo])
subprocess.call(['chown', '-R', '%s:%s'
diff --git a/jeepyb/cmd/create_hound_config.py b/jeepyb/cmd/create_hound_config.py
index e624d09..0cb529f 100644
--- a/jeepyb/cmd/create_hound_config.py
+++ b/jeepyb/cmd/create_hound_config.py
@@ -30,8 +30,7 @@
def main():
registry = u.ProjectsRegistry(PROJECTS_YAML)
- projects = [entry['project'] for entry in registry.configs_list
- if not entry.get('acl-config', '').endswith('/retired.config')]
+ projects = [entry['project'] for entry in registry.configs_list]
repos = {}
for project in projects:
# Ignore attic and stackforge, those are repos that are not
diff --git a/jeepyb/utils.py b/jeepyb/utils.py
index f0b0265..21ae550 100644
--- a/jeepyb/utils.py
+++ b/jeepyb/utils.py
@@ -26,6 +26,18 @@
log = logging.getLogger("jeepyb.utils")
+def is_retired(entry):
+ """Is a project retired"""
+ if entry.get('acl-config', '').endswith('/retired.config'):
+ return True
+ project = entry['project']
+ if '/' in project:
+ (org, name) = project.split('/')
+ if org.endswith('-attic'):
+ return True
+ return False
+
+
def short_project_name(full_project_name):
"""Return the project part of the git repository name."""
return full_project_name.split('/')[-1]
@@ -173,15 +185,15 @@
self.yaml_doc = [c for c in yaml.safe_load_all(open(yaml_file))]
self.single_doc = single_doc
- self.configs_list = []
+ self._configs_list = []
self.defaults = {}
self._parse_file()
def _parse_file(self):
if self.single_doc:
- self.configs_list = self.yaml_doc[0]
+ self._configs_list = self.yaml_doc[0]
else:
- self.configs_list = self.yaml_doc[1]
+ self._configs_list = self.yaml_doc[1]
if os.path.exists(PROJECTS_INI):
self.defaults = ConfigParser.ConfigParser()
@@ -193,7 +205,7 @@
pass
configs = {}
- for section in self.configs_list:
+ for section in self._configs_list:
configs[section['project']] = section
self.configs = configs
@@ -221,3 +233,7 @@
return default
else:
return self.defaults.get(item, default)
+
+ @property
+ def configs_list(self):
+ return [entry for entry in self._configs_list if not is_retired(entry)]