1 |
commit: a5f83728d12e841c67e9e264baa4d71d26aba0d4 |
2 |
Author: Rolf Eike Beer <eike <AT> sf-mail <DOT> de> |
3 |
AuthorDate: Sat May 2 10:32:37 2020 +0000 |
4 |
Commit: Rolf Eike Beer <eike <AT> sf-mail <DOT> de> |
5 |
CommitDate: Sat May 2 10:48:43 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/tatt.git/commit/?id=a5f83728 |
7 |
|
8 |
remove unmaskfile config option, use unmaskdir instead |
9 |
|
10 |
Write one unmask file per job, so cleanup can simply be rm. |
11 |
|
12 |
Signed-off-by: Rolf Eike Beer <eike <AT> sf-mail.de> |
13 |
|
14 |
README.md | 5 +++-- |
15 |
scripts/tatt | 30 ++++++++++++++++++------------ |
16 |
tatt.5 | 5 +++-- |
17 |
tatt/dot-tatt-spec | 2 +- |
18 |
tatt/scriptwriter.py | 4 ++-- |
19 |
templates/cleanup | 2 +- |
20 |
6 files changed, 28 insertions(+), 20 deletions(-) |
21 |
|
22 |
diff --git a/README.md b/README.md |
23 |
index 6e6799a..46b7f7d 100644 |
24 |
--- a/README.md |
25 |
+++ b/README.md |
26 |
@@ -100,8 +100,9 @@ The specification of the configuration file can be found in dot-tatt-spec which |
27 |
# to change this) |
28 |
# template-dir="/usr/share/tatt/templates/" |
29 |
|
30 |
-# Where do you want tatt to put unmasked packages. |
31 |
-# unmaskfile="/etc/portage/package.accept_keywords/archtest" |
32 |
+# Where do you want tatt to put unmasked packages. Writes one file per |
33 |
+# job in this directory. |
34 |
+# unmaskdir="/etc/portage/package.accept_keywords" |
35 |
|
36 |
# You can customize the maximal number of rdeps to be tested as follows: |
37 |
# rdeps=3 |
38 |
|
39 |
diff --git a/scripts/tatt b/scripts/tatt |
40 |
index 3e0d56c..b08adfd 100755 |
41 |
--- a/scripts/tatt |
42 |
+++ b/scripts/tatt |
43 |
@@ -239,30 +239,36 @@ if myJob.packageList is not None and len(myJob.packageList) > 0: |
44 |
myJob.packageList = filteredPackages |
45 |
|
46 |
# Unmasking: |
47 |
+ unmaskname=config['unmaskdir'] |
48 |
+ if os.path.exists(unmaskname) and not os.path.isdir(unmaskname): |
49 |
+ print ("unmaskdir '", unmaskname, "' exists and is no directory") |
50 |
+ sys.exit(1) |
51 |
+ elif not os.path.exists(unmaskname): |
52 |
+ os.mkdir(unmaskname, 0o755) |
53 |
+ unmaskname=unmaskname+"/tatt_"+myJob.name |
54 |
+ |
55 |
try: |
56 |
- unmaskfile=open(config['unmaskfile'], 'r+') |
57 |
+ unmaskfile=open(unmaskname, 'r+') |
58 |
except IOError: |
59 |
- print ("Your unmaskfile was not found, I will create it as") |
60 |
- print (config['unmaskfile']) |
61 |
try: |
62 |
- unmaskfile=open(config['unmaskfile'], 'w') |
63 |
+ unmaskfile=open(unmaskname, 'w') |
64 |
unmaskfile.write(" ") |
65 |
unmaskfile.close() |
66 |
except IOError: |
67 |
# If we can't write to the file, then it should be configured differently |
68 |
- print (" ".join(["Can not write to ",config['unmaskfile']])) |
69 |
+ print (" ".join(["Can not write to ",unmaskname])) |
70 |
print ("Maybe you don't have permission or the location is invalid.") |
71 |
- print (" ".join(["Is",os.path.split(config['unmaskfile'])[0],"a writeable directory?"])) |
72 |
+ print (" ".join(["Is",config['unmaskdir'],"a writeable directory?"])) |
73 |
print ("Probably you want to configure a different unmaskfile") |
74 |
print ("in your ~/.tatt. Exiting") |
75 |
sys.exit(1) |
76 |
- unmaskfile=open(config['unmaskfile'], 'r+') |
77 |
+ unmaskfile=open(unmaskname, 'r+') |
78 |
|
79 |
unmaskfileContent = unmaskfile.read() |
80 |
for p in myJob.packageList: |
81 |
# Test if unmaskfile already contains the atom |
82 |
if re.search(re.escape(p.packageString()), unmaskfileContent): |
83 |
- print (p.packageString() + " already in "+config['unmaskfile']) |
84 |
+ print (p.packageString() + " already in "+unmaskname) |
85 |
else: |
86 |
unmaskfile.write(p.packageString()) |
87 |
if myJob.type=="stable": |
88 |
@@ -272,22 +278,22 @@ if myJob.packageList is not None and len(myJob.packageList) > 0: |
89 |
else: |
90 |
print ("Uh Oh, no job.type? Tell tomka@g.o to fix this!") |
91 |
unmaskfile.write(" # Job " + myJob.name + "\n") |
92 |
- print ("Unmasked " + p.packageString()+ " in "+config['unmaskfile']) |
93 |
+ print ("Unmasked " + p.packageString()+ " in "+unmaskname) |
94 |
|
95 |
# now write the remaining packages for keywording |
96 |
for p in kwPackages: |
97 |
# Test if unmaskfile already contains the atom |
98 |
if re.search(re.escape(p.packageString()), unmaskfileContent): |
99 |
- print (p.packageString() + " already in "+config['unmaskfile']) |
100 |
+ print (p.packageString() + " already in "+unmaskname) |
101 |
else: |
102 |
unmaskfile.write(p.packageString() + " # Job " + myJob.name + "\n") |
103 |
- print ("Unmasked " + p.packageString() + " in " + config['unmaskfile']) |
104 |
+ print ("Unmasked " + p.packageString() + " in " + unmaskname) |
105 |
|
106 |
unmaskfile.close() |
107 |
## Write the scripts |
108 |
writeUSE(myJob, config) |
109 |
writeRdeps(myJob, config) |
110 |
- writeCleanup (myJob, config) |
111 |
+ writeCleanup (myJob, config, unmaskname) |
112 |
## Successscript can only be written if we have a bugnumber |
113 |
if myJob.bugnumber: |
114 |
writeSuccess(myJob, config) |
115 |
|
116 |
diff --git a/tatt.5 b/tatt.5 |
117 |
index 59e0273..c40d34c 100644 |
118 |
--- a/tatt.5 |
119 |
+++ b/tatt.5 |
120 |
@@ -31,9 +31,10 @@ which usually resides \fI /usr/lib/${python}/site-packages/tatt \fI |
121 |
#template-dir="/usr/share/tatt/templates/" |
122 |
|
123 |
.br |
124 |
-# Where do you want tatt to put unmasked packages. |
125 |
+# Where do you want tatt to put unmasked packages. Writes one file per |
126 |
+# job in this directory. |
127 |
.br |
128 |
-#unmaskfile="/etc/portage/package.accept_keywords/archtest" |
129 |
+#unmaskdir="/etc/portage/package.accept_keywords" |
130 |
|
131 |
.br |
132 |
# You can customize the maximal number of rdeps to be tested as follows: |
133 |
|
134 |
diff --git a/tatt/dot-tatt-spec b/tatt/dot-tatt-spec |
135 |
index 76a7039..1d9fe9d 100644 |
136 |
--- a/tatt/dot-tatt-spec |
137 |
+++ b/tatt/dot-tatt-spec |
138 |
@@ -1,7 +1,7 @@ |
139 |
successmessage=string(default="Archtested on @@ARCH@@: Everything fine") |
140 |
ignoreprefix=string_list(default=list("elibc_","video_cards_","linguas_","python_targets_","python_single_target_","kdeenablefinal","test","debug")) |
141 |
template-dir=string(default="/usr/share/tatt/templates/") |
142 |
-unmaskfile=string(default="/etc/portage/package.accept_keywords/archtest") |
143 |
+unmaskdir=string(default="/etc/portage/package.accept_keywords") |
144 |
arch=string(default="x86") |
145 |
defaultopts=string(default="") |
146 |
emergeopts=string(default="") |
147 |
|
148 |
diff --git a/tatt/scriptwriter.py b/tatt/scriptwriter.py |
149 |
index b4bee69..c540626 100644 |
150 |
--- a/tatt/scriptwriter.py |
151 |
+++ b/tatt/scriptwriter.py |
152 |
@@ -41,7 +41,6 @@ def scriptTemplate(job, config, filename): |
153 |
snippet = snippet.replace("@@REPODIR@@", config['repodir']) |
154 |
snippet = snippet.replace("@@REPORTFILE@@", reportname) |
155 |
snippet = snippet.replace("@@BUILDLOGDIR@@", config['buildlogdir']) |
156 |
- snippet = snippet.replace("@@KEYWORDFILE@@", config['unmaskfile']) |
157 |
snippet = snippet.replace("@@NEWKEYWORD@@", newkeyword) |
158 |
snippet = snippet.replace("@@TEMPLATEDIR@@", config['template-dir']) |
159 |
return snippet |
160 |
@@ -214,8 +213,9 @@ def writecommitscript (job, config): |
161 |
|
162 |
|
163 |
######## Write clean-up script ############## |
164 |
-def writeCleanUpScript (job, config): |
165 |
+def writeCleanUpScript (job, config, unmaskname): |
166 |
script = scriptTemplate(job, config, "cleanup") |
167 |
+ script = script.replace("@@KEYWORDFILE@@", unmaskname) |
168 |
outfilename = (job.name + "-cleanup.sh") |
169 |
if os.path.isfile(outfilename): |
170 |
print("WARNING: Will overwrite " + outfilename) |
171 |
|
172 |
diff --git a/templates/cleanup b/templates/cleanup |
173 |
index e852684..394077e 100644 |
174 |
--- a/templates/cleanup |
175 |
+++ b/templates/cleanup |
176 |
@@ -1,6 +1,6 @@ |
177 |
#!/bin/bash |
178 |
## Clean-up the keywordfile |
179 |
-sed -i "/# Job @@JOB@@$/d" @@KEYWORDFILE@@ |
180 |
+rm @@KEYWORDFILE@@ |
181 |
|
182 |
# Remove all files associated to the job: |
183 |
rm -f @@JOB@@-* |