Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/tatt:master commit in: scripts/, tatt/
Date: Fri, 11 Sep 2020 16:00:53
Message-Id: 1599764849.f36367445c64e28200a3fbb8ef7be4295cabeba9.sam@gentoo
1 commit: f36367445c64e28200a3fbb8ef7be4295cabeba9
2 Author: Sam James <sam <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 2 05:25:35 2020 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 10 19:07:29 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/tatt.git/commit/?id=f3636744
7
8 package lists: Use nattka to parse keywording bugs
9
10 NATTkA is now used for most of the package lists on Bugzilla.
11 Use it to parse the lists because currently we cannot handle
12 package atoms with no version in keywording bugs.
13
14 Closes: https://github.com/gentoo/tatt/issues/66
15 Closes: https://github.com/gentoo/tatt/issues/65
16 Signed-off-by: Sam James <sam <AT> gentoo.org>
17
18 scripts/tatt | 7 ++++---
19 tatt/packageFinder.py | 17 ++++++++++++++---
20 2 files changed, 18 insertions(+), 6 deletions(-)
21
22 diff --git a/scripts/tatt b/scripts/tatt
23 index b08adfd..9936006 100755
24 --- a/scripts/tatt
25 +++ b/scripts/tatt
26 @@ -166,9 +166,9 @@ if options.bugnum:
27 sys.exit(1)
28 if myJob.packageList==None:
29 if response["cf_stabilisation_atoms"]:
30 - myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], config['arch'])
31 + myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], config['arch'], config['repodir'], options.bugnum)
32 if len(myJob.packageList) == 0 and ("KEYWORDREQ" in response["keywords"] or response["component"] == "Keywording"):
33 - myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], '~' + config['arch'])
34 + myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], '~' + config['arch'], config['repodir'], options.bugnum)
35 else:
36 response = session.get(config["bugzilla-url"] + "/rest/bug/{}/attachment".format(options.bugnum), params=params).json()["bugs"][str(options.bugnum)]
37 for attachment in response:
38 @@ -176,7 +176,7 @@ if options.bugnum:
39 continue
40 for flag in attachment['flags']:
41 if flag["name"] == "stabilization-list" and flag["status"] == '+':
42 - myJob.packageList = packageFinder.findPackages(base64.b64decode(attachment["data"]).decode("utf8"), config['arch'])
43 + myJob.packageList = packageFinder.findPackages(base64.b64decode(attachment["data"]).decode("utf8"), config['arch'], config['repodir'], options.bugnum)
44
45
46 # joint code for -f and -b
47 @@ -209,6 +209,7 @@ if myJob.packageList is not None and len(myJob.packageList) > 0:
48
49 for p in myJob.packageList:
50 print("Found the following package atom : " + p.packageString())
51 +
52 # check if the package already has the needed keywords
53 kw = port.aux_get(dep_getcpv(p.packageString()), ["KEYWORDS"])
54 if len(kw) > 0:
55
56 diff --git a/tatt/packageFinder.py b/tatt/packageFinder.py
57 index a404d39..24c69ac 100644
58 --- a/tatt/packageFinder.py
59 +++ b/tatt/packageFinder.py
60 @@ -1,17 +1,28 @@
61 """module for extracting packages from a package/architecture list """
62 -
63 +import subprocess
64 from .gentooPackage import gentooPackage as gP
65
66 -def findPackages (s, arch):
67 +def findPackages (s, arch, repo, bugnum):
68 """ Given a string s,
69 and a string arch
70 return all gentooPackages from that string that need actioning on that arch """
71
72 packages = []
73
74 - for line in s.splitlines():
75 + if bugnum:
76 + print("Using Nattka to process the bug")
77 + output = subprocess.check_output(['nattka', '--repo', repo, 'apply', '-a', arch, '-n', bugnum, '--ignore-sanity-check', '--ignore-dependencies'])
78 + output = output.decode("utf8").split("\n")
79 + output = [line for line in output if not line.startswith("#")]
80 + output = [line.split(" ")[0] for line in output]
81 + else:
82 + print("Manually processing")
83 + output = s.splitlines()
84 +
85 + for line in output:
86 if not line:
87 continue
88 +
89 atom, _, arches = line.replace('\t', ' ').partition(' ')
90 archlist = arches.split(' ')
91 if not arches or arch in archlist or ('~' + arch) in archlist: