diff options
author | 2017-11-05 10:57:34 +0100 | |
---|---|---|
committer | 2017-11-05 22:17:13 +1100 | |
commit | 43f9dfdf51a2e95754bb5c4cb529a28418d61473 (patch) | |
tree | e2302bd7fc668de998c76489e6df17104f54da7a | |
parent | write file permissions as octal (diff) | |
download | tatt-43f9dfdf51a2e95754bb5c4cb529a28418d61473.tar.gz tatt-43f9dfdf51a2e95754bb5c4cb529a28418d61473.tar.bz2 tatt-43f9dfdf51a2e95754bb5c4cb529a28418d61473.zip |
use portage API to skip already stable packages
-rw-r--r-- | tatt/scriptwriter.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tatt/scriptwriter.py b/tatt/scriptwriter.py index 2e445c3..2ab66f5 100644 --- a/tatt/scriptwriter.py +++ b/tatt/scriptwriter.py @@ -2,6 +2,7 @@ import random import os +import portage import sys from .usecombis import findUseFlagCombis @@ -40,6 +41,9 @@ def writeusecombiscript(job, config): except IOError: print("use-header not found in " + config['template-dir']) sys.exit(1) + + port = portage.db[portage.root]["porttree"].dbapi + useheader=useheaderfile.read().replace("@@JOB@@", job.name) outfilename = (job.name + "-useflags.sh") reportname = (job.name + ".report") @@ -48,6 +52,19 @@ def writeusecombiscript(job, config): outfile = open(outfilename, 'w') outfile.write(useheader) for p in job.packageList: + # check if the package already has the needed keywords + if config['arch']: + kw = port.aux_get(p.packageString()[1:], ["KEYWORDS"]) + if len(kw) > 0: + kwl = kw[0].split() + try: + kwl.index(config['arch']) + # the list of keywords in portage already contains the target + # keyword, skip this package + continue + except ValueError: + pass + outfile.write("# Code for " + p.packageCatName() + "\n") outfile.write(useCombiTestString(p, config).replace("@@REPORTFILE@@",reportname)) # Note: fchmod needs the filedescriptor which is an internal |