diff options
author | Sam James <sam@gentoo.org> | 2020-05-02 05:25:35 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2020-09-10 19:07:29 +0000 |
commit | f36367445c64e28200a3fbb8ef7be4295cabeba9 (patch) | |
tree | 4b93c7ee8992919b8cdca7be1da793ff056e8611 | |
parent | remove unmaskfile config option, use unmaskdir instead (diff) | |
download | tatt-f36367445c64e28200a3fbb8ef7be4295cabeba9.tar.gz tatt-f36367445c64e28200a3fbb8ef7be4295cabeba9.tar.bz2 tatt-f36367445c64e28200a3fbb8ef7be4295cabeba9.zip |
package lists: Use nattka to parse keywording bugs
NATTkA is now used for most of the package lists on Bugzilla.
Use it to parse the lists because currently we cannot handle
package atoms with no version in keywording bugs.
Closes: https://github.com/gentoo/tatt/issues/66
Closes: https://github.com/gentoo/tatt/issues/65
Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-x | scripts/tatt | 7 | ||||
-rw-r--r-- | tatt/packageFinder.py | 17 |
2 files changed, 18 insertions, 6 deletions
diff --git a/scripts/tatt b/scripts/tatt index b08adfd..9936006 100755 --- a/scripts/tatt +++ b/scripts/tatt @@ -166,9 +166,9 @@ if options.bugnum: sys.exit(1) if myJob.packageList==None: if response["cf_stabilisation_atoms"]: - myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], config['arch']) + myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], config['arch'], config['repodir'], options.bugnum) if len(myJob.packageList) == 0 and ("KEYWORDREQ" in response["keywords"] or response["component"] == "Keywording"): - myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], '~' + config['arch']) + myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], '~' + config['arch'], config['repodir'], options.bugnum) else: response = session.get(config["bugzilla-url"] + "/rest/bug/{}/attachment".format(options.bugnum), params=params).json()["bugs"][str(options.bugnum)] for attachment in response: @@ -176,7 +176,7 @@ if options.bugnum: continue for flag in attachment['flags']: if flag["name"] == "stabilization-list" and flag["status"] == '+': - myJob.packageList = packageFinder.findPackages(base64.b64decode(attachment["data"]).decode("utf8"), config['arch']) + myJob.packageList = packageFinder.findPackages(base64.b64decode(attachment["data"]).decode("utf8"), config['arch'], config['repodir'], options.bugnum) # joint code for -f and -b @@ -209,6 +209,7 @@ if myJob.packageList is not None and len(myJob.packageList) > 0: for p in myJob.packageList: print("Found the following package atom : " + p.packageString()) + # check if the package already has the needed keywords kw = port.aux_get(dep_getcpv(p.packageString()), ["KEYWORDS"]) if len(kw) > 0: diff --git a/tatt/packageFinder.py b/tatt/packageFinder.py index a404d39..24c69ac 100644 --- a/tatt/packageFinder.py +++ b/tatt/packageFinder.py @@ -1,17 +1,28 @@ """module for extracting packages from a package/architecture list """ - +import subprocess from .gentooPackage import gentooPackage as gP -def findPackages (s, arch): +def findPackages (s, arch, repo, bugnum): """ Given a string s, and a string arch return all gentooPackages from that string that need actioning on that arch """ packages = [] - for line in s.splitlines(): + if bugnum: + print("Using Nattka to process the bug") + output = subprocess.check_output(['nattka', '--repo', repo, 'apply', '-a', arch, '-n', bugnum, '--ignore-sanity-check', '--ignore-dependencies']) + output = output.decode("utf8").split("\n") + output = [line for line in output if not line.startswith("#")] + output = [line.split(" ")[0] for line in output] + else: + print("Manually processing") + output = s.splitlines() + + for line in output: if not line: continue + atom, _, arches = line.replace('\t', ' ').partition(' ') archlist = arches.split(' ') if not arches or arch in archlist or ('~' + arch) in archlist: |