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:
Pierre-Yves Chibon 2019-11-21 11:18:08 +01:00
parent d3b7be42b4
commit 4c697a63ce

View file

@ -484,10 +484,14 @@ class DistgitBugzillaSync:
parser.add_argument('--add-email-overrides-file', metavar='EMAIL_OVERRIDES_FILE',
dest='addl_email_overrides_files', action='append',
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()
def get_pagure_project(self):
def get_pagure_project(self, project_list=None):
""" Builds a large list of all the projects on pagure.
Each item in that list is a dict containing:
- the namespace of the project
@ -511,14 +515,17 @@ class DistgitBugzillaSync:
# Combine and collapse those two into a single list:
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 name, poc in entries.items():
self.pagure_projects.append(dict(
namespace=namespace,
name=name,
poc=poc,
watchers=pagure_namespace_to_cc[namespace][name],
))
if not project_list or (namespace, name) in project_list:
self.pagure_projects.append(dict(
namespace=namespace,
name=name,
poc=poc,
watchers=pagure_namespace_to_cc[namespace][name],
))
def add_branches_product_and_summary(self):
""" For each project retrieved this method adds branches, products
@ -645,12 +652,14 @@ class DistgitBugzillaSync:
print("Building a cache of the rpm packages' 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()
if self.env["verbose"]:
print(f"{len(self.pagure_projects)} projects to consider")
if not self.pagure_projects:
return
if self.env["verbose"]:
times["data structure end"] = time.time()
delta = times["data structure end"] - times["start"]