diff options
author | 2020-06-07 01:15:09 +0000 | |
---|---|---|
committer | 2020-09-10 19:07:29 +0000 | |
commit | 042010b840bd920cece9ef00d06db392f142a7b3 (patch) | |
tree | 445a86445f5e50390fe85c08e4c8802ee5055872 /tatt | |
parent | package lists: Use nattka to parse keywording bugs (diff) | |
download | tatt-042010b840bd920cece9ef00d06db392f142a7b3.tar.gz tatt-042010b840bd920cece9ef00d06db392f142a7b3.tar.bz2 tatt-042010b840bd920cece9ef00d06db392f142a7b3.zip |
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@gentoo.org>
Diffstat (limited to 'tatt')
-rw-r--r-- | tatt/dot-tatt-spec | 2 | ||||
-rw-r--r-- | tatt/tool.py | 20 |
2 files changed, 21 insertions, 1 deletions
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") |