Allow specifying which projects to update
This allows to specify which projects to update instead of running on all of them. The project should be provided in form of namespace/name, for example: ``-p rpms/koji rpms/guake``. Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
parent
d3b7be42b4
commit
4c697a63ce
1 changed files with 17 additions and 8 deletions
|
@ -484,10 +484,14 @@ class DistgitBugzillaSync:
|
||||||
parser.add_argument('--add-email-overrides-file', metavar='EMAIL_OVERRIDES_FILE',
|
parser.add_argument('--add-email-overrides-file', metavar='EMAIL_OVERRIDES_FILE',
|
||||||
dest='addl_email_overrides_files', action='append',
|
dest='addl_email_overrides_files', action='append',
|
||||||
help="File(s) from which to read additional email overrides")
|
help="File(s) from which to read additional email overrides")
|
||||||
|
parser.add_argument(
|
||||||
|
'-p', '--project', dest='projects', nargs='+',
|
||||||
|
help='Update one or more projects (provided as namespace/name), '
|
||||||
|
'in all of its products')
|
||||||
|
|
||||||
self.args = parser.parse_args()
|
self.args = parser.parse_args()
|
||||||
|
|
||||||
def get_pagure_project(self):
|
def get_pagure_project(self, project_list=None):
|
||||||
""" Builds a large list of all the projects on pagure.
|
""" Builds a large list of all the projects on pagure.
|
||||||
Each item in that list is a dict containing:
|
Each item in that list is a dict containing:
|
||||||
- the namespace of the project
|
- the namespace of the project
|
||||||
|
@ -511,14 +515,17 @@ class DistgitBugzillaSync:
|
||||||
|
|
||||||
# Combine and collapse those two into a single list:
|
# Combine and collapse those two into a single list:
|
||||||
self.pagure_projects = []
|
self.pagure_projects = []
|
||||||
|
if project_list:
|
||||||
|
project_list = set(tuple(p.split("/", 1)) for p in project_list)
|
||||||
for namespace, entries in pagure_namespace_to_poc.items():
|
for namespace, entries in pagure_namespace_to_poc.items():
|
||||||
for name, poc in entries.items():
|
for name, poc in entries.items():
|
||||||
self.pagure_projects.append(dict(
|
if not project_list or (namespace, name) in project_list:
|
||||||
namespace=namespace,
|
self.pagure_projects.append(dict(
|
||||||
name=name,
|
namespace=namespace,
|
||||||
poc=poc,
|
name=name,
|
||||||
watchers=pagure_namespace_to_cc[namespace][name],
|
poc=poc,
|
||||||
))
|
watchers=pagure_namespace_to_cc[namespace][name],
|
||||||
|
))
|
||||||
|
|
||||||
def add_branches_product_and_summary(self):
|
def add_branches_product_and_summary(self):
|
||||||
""" For each project retrieved this method adds branches, products
|
""" For each project retrieved this method adds branches, products
|
||||||
|
@ -645,12 +652,14 @@ class DistgitBugzillaSync:
|
||||||
print("Building a cache of the rpm packages' summary")
|
print("Building a cache of the rpm packages' summary")
|
||||||
self.rpm_summary = package_summary.get_package_summary()
|
self.rpm_summary = package_summary.get_package_summary()
|
||||||
|
|
||||||
self.get_pagure_project()
|
self.get_pagure_project(self.args.projects)
|
||||||
self.add_branches_product_and_summary()
|
self.add_branches_product_and_summary()
|
||||||
|
|
||||||
if self.env["verbose"]:
|
if self.env["verbose"]:
|
||||||
print(f"{len(self.pagure_projects)} projects to consider")
|
print(f"{len(self.pagure_projects)} projects to consider")
|
||||||
|
|
||||||
|
if not self.pagure_projects:
|
||||||
|
return
|
||||||
if self.env["verbose"]:
|
if self.env["verbose"]:
|
||||||
times["data structure end"] = time.time()
|
times["data structure end"] = time.time()
|
||||||
delta = times["data structure end"] - times["start"]
|
delta = times["data structure end"] - times["start"]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue