check-missing: work with any release, include openh264 repo

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2022-09-02 15:54:37 -07:00
parent 928dc71211
commit e879d077e8

View File

@ -1,11 +1,15 @@
#!/bin/python3 #!/bin/python3
# This script looks for the 'latest' comps-fXX.xml.in file, assumes it's # This script looks for the comps-fXX.xml.in file for the release version
# for Rawhide, and looks through its `pkgreq` lines for ones that specify # specified, grabs lists of all packages that exist in that release of
# packages that do not currently exist in Rawhide. It is arch-aware. It # Fedora, and looks through the comps `pkgreq` lines for ones that specify
# expects to be run on a Fedora system with network access, as it will # packages that do not currently exist . It is arch-aware. It expects to
# try to query the 'rawhide' dnf repo to get lists of currently-existing # be run on a Fedora system with network access, as it will try to query
# packages. You will need fedora-repos-rawhide and python3-lxml. # the dnf repos to get lists of currently-existing packages. It relies on
# the non-Rawhide repo definitions actually working for Rawhide if passed
# the Rawhide-matching release number, which is a kinda undocumented
# feature but we rely on it in other places too. You will need
# fedora-repos and python3-lxml packages installed.
import glob import glob
import argparse import argparse
@ -15,24 +19,24 @@ from collections import defaultdict
ARCHES = ('aarch64', 'ppc64le', 's390x', 'x86_64') ARCHES = ('aarch64', 'ppc64le', 's390x', 'x86_64')
parser = argparse.ArgumentParser(description='Check the comps file for missing packages and packages missing on architectures') parser = argparse.ArgumentParser(description='Check Fedora comps files for missing packages and packages missing on architectures')
parser.add_argument('relver', help='Release version to check')
parser.add_argument('--update', dest='update', action='store_true', default=False, parser.add_argument('--update', dest='update', action='store_true', default=False,
help='Update the comps file with the changes') help='Update the comps file with the changes')
args = parser.parse_args() args = parser.parse_args()
# gather package lists. this eats lots of RAM. I don't care. # gather package lists. this eats lots of RAM. I don't care.
# FIXME: for this script to work for EPEL and ELN someone would have
# to figure out the right tweaks to this command line.
pkgs = {} pkgs = {}
for arch in ARCHES: for arch in ARCHES:
pkgtext = subprocess.run(('dnf', '--forcearch={}'.format(arch), '--disablerepo=*', '--enablerepo=rawhide', 'repoquery', '--qf=%{NAME}'), capture_output=True, text=True).stdout pkgtext = subprocess.run(('dnf', f'--forcearch={arch}', f'--releasever={args.relver}', '--disablerepo=*', '--enablerepo=fedora', '--enablerepo=updates', '--enablerepo=fedora-cisco-openh264', 'repoquery', '--qf=%{NAME}'), capture_output=True, text=True).stdout
pkgs[arch] = pkgtext.splitlines() pkgs[arch] = pkgtext.splitlines()
# find the *latest* comps file (assume it's rawhide) compsfile = f'comps-f{args.relver}.xml.in'
compsfiles = glob.glob('comps-f*.xml.in')
latest = sorted(compsfiles, key=lambda x: int(''.join(c for c in x if c.isdigit())))[-1]
# find package reqs in comps # find package reqs in comps
tree = ET.parse(latest) #, ET.XMLParser(target=CommentedTreeBuilder())) tree = ET.parse(compsfile) #, ET.XMLParser(target=CommentedTreeBuilder()))
root = tree.getroot() root = tree.getroot()
pkgreqs = root.findall('.//packagereq') pkgreqs = root.findall('.//packagereq')