aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2018-09-14 17:49:36 +0200
committerRolf Eike Beer <eike@sf-mail.de>2018-09-14 18:07:53 +0200
commit0d2f086f835a0bd97ab6e0dac245f9153ab53e2c (patch)
treea96edb343f744f0e7d36aa14fce6e6e9db498ec0
parentuse https for tinderbox (diff)
downloadtatt-0d2f086f835a0bd97ab6e0dac245f9153ab53e2c.tar.gz
tatt-0d2f086f835a0bd97ab6e0dac245f9153ab53e2c.tar.bz2
tatt-0d2f086f835a0bd97ab6e0dac245f9153ab53e2c.zip
add use-loop template file to hold the per-package block of use tests
This is actually optional, if it's not present it will just be the loop body without anything else.
-rw-r--r--tatt/scriptwriter.py10
-rw-r--r--templates/use-loop4
2 files changed, 11 insertions, 3 deletions
diff --git a/tatt/scriptwriter.py b/tatt/scriptwriter.py
index 7b788db..4fbf015 100644
--- a/tatt/scriptwriter.py
+++ b/tatt/scriptwriter.py
@@ -66,6 +66,10 @@ def writeusecombiscript(job, config):
# job is a tatt job object
# config is a tatt configuration
useheader = scriptTemplate(job, config, "use-header")
+ if os.path.exists(config['template-dir'] + "use-loop"):
+ useloop = scriptTemplate(job, config, "use-loop")
+ else:
+ useloop = "@@LOOP_BODY@@"
outfilename = (job.name + "-useflags.sh")
reportname = (job.name + ".report")
@@ -75,9 +79,9 @@ def writeusecombiscript(job, config):
outfile.write(useheader)
port = portage.db[portage.root]["porttree"].dbapi
for p in job.packageList:
- outfile.write("\n# Code for " + p.packageString() + "\n")
- outfile.write(useCombiTestString(job, p, config, port))
- outfile.write("echo >> " + reportname + "\n")
+ loop = useloop.replace("@@LOOP_BODY@@", useCombiTestString(job, p, config, port))
+ loop = loop.replace("@@CPV@@", p.packageString())
+ outfile.write(loop)
# Note: fchmod needs the filedescriptor which is an internal
# integer retrieved by fileno().
os.fchmod(outfile.fileno(), 0o744) # rwxr--r--
diff --git a/templates/use-loop b/templates/use-loop
new file mode 100644
index 0000000..765f6a4
--- /dev/null
+++ b/templates/use-loop
@@ -0,0 +1,4 @@
+
+# Code for @@CPV@@
+@@LOOP_BODY@@
+echo >> @@REPORTFILE@@