* [gentoo-commits] proj/tatt:master commit in: tatt/, scripts/
@ 2020-09-11 16:00 Sam James
0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2020-09-11 16:00 UTC (permalink / raw
To: gentoo-commits
commit: cc36b5e3e11a4b07b4b4ee0da8e58f8d2da296af
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jun 20 18:13:23 2020 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 10 19:07:30 2020 +0000
URL: https://gitweb.gentoo.org/proj/tatt.git/commit/?id=cc36b5e3
tatt: Support file-only jobs via Nattka
Signed-off-by: Sam James <sam <AT> gentoo.org>
Closes: https://github.com/gentoo/tatt/pull/67
Signed-off-by: Sam James <sam <AT> gentoo.org>
scripts/tatt | 2 +-
tatt/packageFinder.py | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/scripts/tatt b/scripts/tatt
index 27e9b61..463e737 100755
--- a/scripts/tatt
+++ b/scripts/tatt
@@ -142,7 +142,7 @@ if options.infile:
else:
myJob.type="stable"
- myJob.packageList = packageFinder.findPackages(packraw, targetarch)
+ myJob.packageList = packageFinder.findPackages(packraw, targetarch, get_repo_dir(config['repodir']))
## -b and a bugnumber was given ?
if options.bugnum:
print("Bugnumber: " + options.bugnum)
diff --git a/tatt/packageFinder.py b/tatt/packageFinder.py
index 24c69ac..fe1256e 100644
--- a/tatt/packageFinder.py
+++ b/tatt/packageFinder.py
@@ -2,10 +2,10 @@
import subprocess
from .gentooPackage import gentooPackage as gP
-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 """
+def findPackages (s, arch, repo, bugnum=False):
+ """ Given a string s, a string arch, a string path to the repo, and
+ an integer bugnum, return all gentooPackages from that string
+ that need actioning on that arch """
packages = []
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/tatt:master commit in: tatt/, scripts/
@ 2020-09-11 16:00 Sam James
0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2020-09-11 16:00 UTC (permalink / raw
To: gentoo-commits
commit: 042010b840bd920cece9ef00d06db392f142a7b3
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 7 01:15:09 2020 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 10 19:07:29 2020 +0000
URL: https://gitweb.gentoo.org/proj/tatt.git/commit/?id=042010b8
tool: Refactor repodir handling
* Use given repodir in config if not blank
* Ditch ~/gentoo-x86 default (it's ancient)
and error out if it doesn't exist
* If no repodir given, guess:
* /var/db/repos/gentoo, and then
* /usr/portage
Now that we use nattka, we need a working repodir.
Try some sensible defaults if the given one doesn't
work.
tatt: Support file-only jobs via Nattka
Signed-off-by: Sam James <sam <AT> gentoo.org>
scripts/tatt | 8 ++++----
tatt/dot-tatt-spec | 2 +-
tatt/tool.py | 20 ++++++++++++++++++++
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/scripts/tatt b/scripts/tatt
index 9936006..27e9b61 100755
--- a/scripts/tatt
+++ b/scripts/tatt
@@ -19,6 +19,7 @@ from tatt.scriptwriter import writecommitscript as writeCommit
from tatt.scriptwriter import writeCleanUpScript as writeCleanup
from tatt.tattConfig import tattConfig as tattConfig
from tatt.job import job as job
+from tatt.tool import get_repo_dir
##### Generate a global config obj, reading from ~/.tatt #####
config = tattConfig()
@@ -142,7 +143,6 @@ if options.infile:
myJob.type="stable"
myJob.packageList = packageFinder.findPackages(packraw, targetarch)
-
## -b and a bugnumber was given ?
if options.bugnum:
print("Bugnumber: " + options.bugnum)
@@ -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'], config['repodir'], options.bugnum)
+ myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], config['arch'], get_repo_dir(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'], config['repodir'], options.bugnum)
+ myJob.packageList = packageFinder.findPackages(response["cf_stabilisation_atoms"], '~' + config['arch'], get_repo_dir(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'], config['repodir'], options.bugnum)
+ myJob.packageList = packageFinder.findPackages(base64.b64decode(attachment["data"]).decode("utf8"), config['arch'], get_repo_dir(config['repodir']), options.bugnum)
# joint code for -f and -b
diff --git a/tatt/dot-tatt-spec b/tatt/dot-tatt-spec
index 1d9fe9d..33aff95 100644
--- a/tatt/dot-tatt-spec
+++ b/tatt/dot-tatt-spec
@@ -7,7 +7,7 @@ defaultopts=string(default="")
emergeopts=string(default="")
rdeps=integer(0,512,default=10)
usecombis=integer(0,512,default=12)
-repodir=string(default="./gentoo-x86")
+repodir=string(default="")
tinderbox-url=string(default="https://qa-reports.gentoo.org/output/genrdeps/rindex/")
safedir=string(default="")
bugzilla-url=string(default="https://bugs.gentoo.org")
diff --git a/tatt/tool.py b/tatt/tool.py
index 450ed6a..1322315 100644
--- a/tatt/tool.py
+++ b/tatt/tool.py
@@ -1,3 +1,5 @@
+import os
+
""" Helper functions used in tatt"""
## Getting unique elements of a list ##
@@ -17,3 +19,21 @@ def unique(seq, idfun=None):
seen[marker] = 1
result.append(item)
return result
+
+def get_repo_dir(repodir):
+ # Prefer the repo dir in the config
+ if repodir:
+ if os.path.isdir(repodir):
+ return repodir
+ else:
+ raise ValueError("Repo dir does not seem to be a directory")
+
+ # No path given in config
+ if os.path.isdir("/var/db/repos/gentoo/"):
+ print("Using /var/db/repos/gentoo/ as fallback")
+ return "/var/db/repos/gentoo"
+ elif os.path.isdir("/usr/portage/"):
+ print("Using /usr/portage/ as fallback")
+ return "/usr/portage/"
+
+ raise ValueError("Repo dir not given and fallbacks failed")
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-11 16:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-11 16:00 [gentoo-commits] proj/tatt:master commit in: tatt/, scripts/ Sam James
-- strict thread matches above, loose matches on Subject: below --
2020-09-11 16:00 Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox