Merge "Include -attic in retired calculations"
This commit is contained in:
commit
ec7dd47748
|
@ -61,10 +61,9 @@ def main():
|
|||
'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 @@ def main():
|
|||
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'
|
||||
|
|
|
@ -30,8 +30,7 @@ GIT_PROTOCOL = os.environ.get('GIT_PROTOCOL', 'git://')
|
|||
|
||||
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
|
||||
|
|
|
@ -26,6 +26,18 @@ PROJECTS_YAML = os.environ.get('PROJECTS_YAML', '/home/gerrit2/projects.yaml')
|
|||
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 @@ class ProjectsRegistry(object):
|
|||
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 @@ class ProjectsRegistry(object):
|
|||
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 @@ class ProjectsRegistry(object):
|
|||
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)]
|
||||
|
|
Loading…
Reference in New Issue