[releng/abderrahim/junctionrefs] convert-to-tarballs: delete junction.refs once we're done



commit 768c6c3438eee1554d532c2a0a7002a286cb0546
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Wed Apr 1 07:09:09 2020 +0100

    convert-to-tarballs: delete junction.refs once we're done
    
    forgotten in b88f8fcedd40e89fd106928e01d2f9487fbf6dc1
    
    Fixes #14

 tools/smoketesting/convert-to-tarballs.py | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/tools/smoketesting/convert-to-tarballs.py b/tools/smoketesting/convert-to-tarballs.py
index 0f67484..951c3cc 100755
--- a/tools/smoketesting/convert-to-tarballs.py
+++ b/tools/smoketesting/convert-to-tarballs.py
@@ -886,22 +886,25 @@ def main(args):
 
             # move junction refs to the respective files
             junctionrefs = os.path.join(options.directory, 'junction.refs')
-            with open(junctionrefs) as f:
-                refs = yaml.safe_load(f)['projects']['gnome']
+            if os.path.exists(junctionrefs):
+                with open(junctionrefs) as f:
+                    refs = yaml.safe_load(f)['projects']['gnome']
 
-            for element in refs.keys():
-                elfile = os.path.join(options.directory, conf['element-path'], element)
-                with open(elfile) as f:
-                    eldata = yaml.round_trip_load(f, preserve_quotes=True)
+                for element in refs.keys():
+                    elfile = os.path.join(options.directory, conf['element-path'], element)
+                    with open(elfile) as f:
+                        eldata = yaml.round_trip_load(f, preserve_quotes=True)
 
-                for i in range(len(refs[element])):
-                    if not refs[element][i]: # source has no ref
-                        continue
+                    for i in range(len(refs[element])):
+                        if not refs[element][i]: # source has no ref
+                            continue
+
+                        eldata['sources'][i]['ref'] = refs[element][i]['ref']
 
-                    eldata['sources'][i]['ref'] = refs[element][i]['ref']
+                    with open(elfile, 'w') as f:
+                        yaml.round_trip_dump(eldata, f)
 
-                with open(elfile, 'w') as f:
-                    yaml.round_trip_dump(eldata, f)
+                os.unlink(junctionrefs)
 
     if convert.ignored_tarballs:
         print("Could not find a download site for the following modules:")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]