Skip to content

Commit

Permalink
misc: copr_new_packages, drop requests to koji api, use repoquery
Browse files Browse the repository at this point in the history
Asking koji for each package was slow, also we were spamming koji API.
This gets every package just once.
  • Loading branch information
nikromen committed Nov 11, 2024
1 parent 1ed8800 commit 12c4380
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions misc/copr_new_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ def pick_project_candidates(client, projects, since):
Magazine article). By such projects we consider those with at least one
succeeded build and at least some project information filled.
"""
rawhide_pks_resp = subprocess.run(
["dnf", "repoquery", "rawhide", "--queryformat", "%{name}", "*"],
stdout=subprocess.PIPE,
)
fedora_rawhide_pkgs = {x for x in rawhide_pks_resp.stdout.decode().split("\n")}

picked = []
for project in projects:
if project.unlisted_on_hp:
Expand All @@ -55,7 +61,9 @@ def pick_project_candidates(client, projects, since):
continue

builds = filter_unique_package_builds(builds)
builds = [b for b in builds if not is_in_fedora(b.source_package["name"])]
builds = [
b for b in builds if b.source_package["name"] not in fedora_rawhide_pkgs
]
if not builds:
print("Skipping {}, all packages already in Fedora".format(project.full_name))
continue
Expand All @@ -81,14 +89,6 @@ def filter_unique_package_builds(builds):
return unique.values()


def is_in_fedora(packagename):
"""
Check if a given package is already provided by Fedora official repositories
"""
cmd = ["koji", "search", "package", packagename]
return bool(subprocess.check_output(cmd))


def get_parser():
description = ("This tool lists new packages in Copr, that are not yet "
"available in Fedora. It's main purpose is to help us pick "
Expand Down

0 comments on commit 12c4380

Please sign in to comment.