From 0d2f086f835a0bd97ab6e0dac245f9153ab53e2c Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Fri, 14 Sep 2018 17:49:36 +0200 Subject: 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. --- tatt/scriptwriter.py | 10 +++++++--- templates/use-loop | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 templates/use-loop 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@@ -- cgit v1.2.3-65-gdbad