[releng] convert-to-tarballs: don't crash for releases without flatpak branch



commit ee7c37d4cae220d85792347fc87f0784ca68d0a0
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sun Nov 24 13:08:09 2019 -0600

    convert-to-tarballs: don't crash for releases without flatpak branch
    
    We don't publish flatpaks for unstable releases before .90

 tools/smoketesting/convert-to-tarballs.py | 35 ++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 15 deletions(-)
---
diff --git a/tools/smoketesting/convert-to-tarballs.py b/tools/smoketesting/convert-to-tarballs.py
index eb9f3fa..8e676a3 100755
--- a/tools/smoketesting/convert-to-tarballs.py
+++ b/tools/smoketesting/convert-to-tarballs.py
@@ -856,30 +856,35 @@ def main(args):
         # update variables in the .gitlab-ci.yml
         if int(splitted_version[1]) % 2 == 0:
                flatpak_branch = '{}.{}'.format(splitted_version[0], splitted_version[1])
+               update_flatpak_branch = True
         elif int(splitted_version[2]) >= 90:
                flatpak_branch = '{}.{}beta'.format(splitted_version[0], int(splitted_version[1]) + 1)
+               update_flatpak_branch = True
+        else:
+               update_flatpak_branch = False
 
-        cifile = os.path.join(options.directory, '.gitlab-ci.yml')
-        with open(cifile) as f:
-            ci = yaml.round_trip_load(f, preserve_quotes=True)
+        if update_flatpak_branch:
+            cifile = os.path.join(options.directory, '.gitlab-ci.yml')
+            with open(cifile) as f:
+                ci = yaml.round_trip_load(f, preserve_quotes=True)
 
-        ci['variables']['FLATPAK_BRANCH'] = flatpak_branch
+            ci['variables']['FLATPAK_BRANCH'] = flatpak_branch
 
-        if 'BST_STRICT' in ci['variables']:
-            ci['variables']['BST_STRICT'] = '--strict'
+            if 'BST_STRICT' in ci['variables']:
+                ci['variables']['BST_STRICT'] = '--strict'
 
-        with open(cifile, 'w') as f:
-            yaml.round_trip_dump(ci, f)
+            with open(cifile, 'w') as f:
+                yaml.round_trip_dump(ci, f)
 
-        # update project.conf
-        projectconf = os.path.join(options.directory, 'project.conf')
-        with open(projectconf) as f:
-            conf = yaml.round_trip_load(f, preserve_quotes=True)
+            # update project.conf
+            projectconf = os.path.join(options.directory, 'project.conf')
+            with open(projectconf) as f:
+                conf = yaml.round_trip_load(f, preserve_quotes=True)
 
-        conf['variables']['branch'] = flatpak_branch
+            conf['variables']['branch'] = flatpak_branch
 
-        with open(projectconf, 'w') as f:
-            yaml.round_trip_dump(conf, f)
+            with open(projectconf, 'w') as f:
+                yaml.round_trip_dump(conf, f)
 
     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]