diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2020-05-02 12:32:37 +0200 |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2020-05-02 12:48:43 +0200 |
commit | a5f83728d12e841c67e9e264baa4d71d26aba0d4 (patch) | |
tree | 4d56bc6eb26f2a3507b27a704c2abd9373da129d /scripts | |
parent | man: fix example config file layout (diff) | |
download | tatt-a5f83728d12e841c67e9e264baa4d71d26aba0d4.tar.gz tatt-a5f83728d12e841c67e9e264baa4d71d26aba0d4.tar.bz2 tatt-a5f83728d12e841c67e9e264baa4d71d26aba0d4.zip |
remove unmaskfile config option, use unmaskdir instead
Write one unmask file per job, so cleanup can simply be rm.
Signed-off-by: Rolf Eike Beer <eike@sf-mail.de>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/tatt | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/scripts/tatt b/scripts/tatt index 3e0d56c..b08adfd 100755 --- a/scripts/tatt +++ b/scripts/tatt @@ -239,30 +239,36 @@ if myJob.packageList is not None and len(myJob.packageList) > 0: myJob.packageList = filteredPackages # Unmasking: + unmaskname=config['unmaskdir'] + if os.path.exists(unmaskname) and not os.path.isdir(unmaskname): + print ("unmaskdir '", unmaskname, "' exists and is no directory") + sys.exit(1) + elif not os.path.exists(unmaskname): + os.mkdir(unmaskname, 0o755) + unmaskname=unmaskname+"/tatt_"+myJob.name + try: - unmaskfile=open(config['unmaskfile'], 'r+') + unmaskfile=open(unmaskname, 'r+') except IOError: - print ("Your unmaskfile was not found, I will create it as") - print (config['unmaskfile']) try: - unmaskfile=open(config['unmaskfile'], 'w') + unmaskfile=open(unmaskname, 'w') unmaskfile.write(" ") unmaskfile.close() except IOError: # If we can't write to the file, then it should be configured differently - print (" ".join(["Can not write to ",config['unmaskfile']])) + print (" ".join(["Can not write to ",unmaskname])) print ("Maybe you don't have permission or the location is invalid.") - print (" ".join(["Is",os.path.split(config['unmaskfile'])[0],"a writeable directory?"])) + print (" ".join(["Is",config['unmaskdir'],"a writeable directory?"])) print ("Probably you want to configure a different unmaskfile") print ("in your ~/.tatt. Exiting") sys.exit(1) - unmaskfile=open(config['unmaskfile'], 'r+') + unmaskfile=open(unmaskname, 'r+') unmaskfileContent = unmaskfile.read() for p in myJob.packageList: # Test if unmaskfile already contains the atom if re.search(re.escape(p.packageString()), unmaskfileContent): - print (p.packageString() + " already in "+config['unmaskfile']) + print (p.packageString() + " already in "+unmaskname) else: unmaskfile.write(p.packageString()) if myJob.type=="stable": @@ -272,22 +278,22 @@ if myJob.packageList is not None and len(myJob.packageList) > 0: else: print ("Uh Oh, no job.type? Tell tomka@gentoo.org to fix this!") unmaskfile.write(" # Job " + myJob.name + "\n") - print ("Unmasked " + p.packageString()+ " in "+config['unmaskfile']) + print ("Unmasked " + p.packageString()+ " in "+unmaskname) # now write the remaining packages for keywording for p in kwPackages: # Test if unmaskfile already contains the atom if re.search(re.escape(p.packageString()), unmaskfileContent): - print (p.packageString() + " already in "+config['unmaskfile']) + print (p.packageString() + " already in "+unmaskname) else: unmaskfile.write(p.packageString() + " # Job " + myJob.name + "\n") - print ("Unmasked " + p.packageString() + " in " + config['unmaskfile']) + print ("Unmasked " + p.packageString() + " in " + unmaskname) unmaskfile.close() ## Write the scripts writeUSE(myJob, config) writeRdeps(myJob, config) - writeCleanup (myJob, config) + writeCleanup (myJob, config, unmaskname) ## Successscript can only be written if we have a bugnumber if myJob.bugnumber: writeSuccess(myJob, config) |