pkgcore / pkgdev

collection of tools for Gentoo development
https://pkgcore.github.io/pkgdev/
BSD 3-Clause "New" or "Revised" License
29 stars 11 forks source link

pkgdev bugs: allow searching by maintainer, inc. project #157

Closed thesamesam closed 9 months ago

thesamesam commented 1 year ago

Right now, I run something like this to generate a list of stablereq candidates for each project I'm a member of (or I just set maint=sam for myself):

(maint=base-system@gentoo.org; pkgdev bugs --api-key $(<~/.bugz_token) $(git grep -l "${maint}" */*/metadata.xml | cut -d/ -f1-2 | pkgcheck scan -k StableRequest -R FormatReporter --format "={category}/{package}-{version}" - | vipe) --auto-cc-arches ${maint})

In a sense, I don't mind this too much, as it shows the composability of our tools, but it's a bit of a mouthful, and it also doesn't handle automatically including the projects I'm a member of.

So, two suggestions:

  1. Include a search / intergration with pkgcheck scan for packages with `StableRequest
  2. Allow filtering by maintainer, including projects of which I'm a member (by using data from https://api.gentoo.org/metastructure/projects.xml)
arthurzam commented 9 months ago

OK, so some results of this idea, to show feasibility:

The following function takes around ~1.4 seconds to find all packages under a maintainer, which I think is fast enough.

def all_maintainer_pkgs(search_repo, emails: set[str]):
    for cat, pkgs in search_repo.packages.items():
        for pkg in pkgs:
            xml = LocalMetadataXml(pjoin(search_repo.location[0], cat, pkg, "metadata.xml"))
            if emails.intersection(m.email for m in xml.maintainers):
                yield f"{cat}/{pkg}"
thesamesam commented 9 months ago

That sounds fast enough - it's about what a slow grep might take with no parallelisation or restriction to .xml files.