Author: sebb Date: Thu Mar 11 11:48:30 2021 New Revision: 1887472 URL: http://svn.apache.org/viewvc?rev=1887472&view=rev Log: Allow for multiple JIRA projects
Modified: attic/site/retire.py attic/site/xdocs/projects/_template.xml Modified: attic/site/retire.py URL: http://svn.apache.org/viewvc/attic/site/retire.py?rev=1887472&r1=1887471&r2=1887472&view=diff ============================================================================== --- attic/site/retire.py (original) +++ attic/site/retire.py Thu Mar 11 11:48:30 2021 @@ -25,12 +25,14 @@ from inspect import getsourcefile from string import Template import os import re -from urlutils import loadyaml +from urlutils import loadyaml, loadjson if len(sys.argv) == 1: print("Please provide a list of project ids") sys.exit(1) +JIRA='https://issues.apache.org/jira/rest/api/2/project' + MYHOME = dirname(abspath(getsourcefile(lambda:0))) projects = join((MYHOME), 'xdocs', 'projects') stylesheets = join((MYHOME), 'xdocs', 'stylesheets') @@ -44,6 +46,20 @@ for host,names in loadyaml('https://list if proj in retirees: lists[proj] = list(names.keys()) +def list_jira(pid): + jira = loadjson(JIRA) + jiras = [] + for project in jira: + key = project['key'] + catname = '' + if 'projectCategory' in project: + catname = project['projectCategory']['name'] + if pid.upper() == key: + jiras.append(key) + elif catname.lower() == pid: + jiras.append(key) + return jiras + # updates xdocs/stylesheets/project.xml # <li><a href="/projects/abdera.html">Abdera</a></li> def update_stylesheet(pid): @@ -94,16 +110,17 @@ def create_project(pid): meta = retirees[pid] mnames = lists[pid] mnames.remove('dev') + jiras = list_jira(pid) out = template.substitute(tlpid = pid, FullName = meta['display_name'], Month_Year = meta['retired'], mail_names = ",".join(sorted(mnames)), + jira_names = ",".join(sorted(jiras)), description = meta['description']) with open(outfile, 'w') as o: o.write(out) os.system("svn add %s" % outfile) print("Check XML file for customisations such as JIRA and mailing lists") - update_stylesheet(pid) for arg in sys.argv[1:]: print("Processing "+arg) @@ -113,11 +130,12 @@ for arg in sys.argv[1:]: flagdir = join(flagged, arg) if os.path.exists(flagdir): print("flagged/%s already exists" % arg) - continue + continue create_jira_template(arg) try: os.mkdir(flagdir) os.system("svn add %s" % flagdir) create_project(arg) + update_stylesheet(arg) except Exception as e: print(e) Modified: attic/site/xdocs/projects/_template.xml URL: http://svn.apache.org/viewvc/attic/site/xdocs/projects/_template.xml?rev=1887472&r1=1887471&r2=1887472&view=diff ============================================================================== --- attic/site/xdocs/projects/_template.xml (original) +++ attic/site/xdocs/projects/_template.xml Thu Mar 11 11:48:30 2021 @@ -46,7 +46,7 @@ --> <mail name="${mail_names}"/> <!-- use attribute key="" to override default JIRA --> - <jira/> + <jira key="${jira_names}"/> <!-- use the tag <no_downloads/> to suppress the Downloads links -->