[releng/abderrahim/update-stable] convert-to-tarballs: use aliases defined in project.conf



commit a369f0201a6e5615afbb2f337e5a752c8b1200ea
Author: Abderrahim Kitouni <akitouni gnome org>
Date:   Mon Mar 25 16:35:25 2019 +0100

    convert-to-tarballs: use aliases defined in project.conf

 tools/smoketesting/convert-to-tarballs.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/tools/smoketesting/convert-to-tarballs.py b/tools/smoketesting/convert-to-tarballs.py
index 5af2c76..20c9fd4 100755
--- a/tools/smoketesting/convert-to-tarballs.py
+++ b/tools/smoketesting/convert-to-tarballs.py
@@ -631,7 +631,7 @@ class TarballLocator:
 
 
 class ConvertToTarballs:
-    def __init__(self, options, locator, convert=True):
+    def __init__(self, options, locator, directory, convert=True):
         self.options = options
         self.locator = locator
         self.convert = convert
@@ -641,6 +641,10 @@ class ConvertToTarballs:
 
         self.ignored_tarballs = []
 
+        with open(os.path.join(directory, 'project.conf')) as f:
+            projectconf = yaml.load(f)
+            self.aliases = projectconf['aliases']
+
     def find_tarball_by_name(self, name):
         translated_name = self.options.translate_name(name)
 
@@ -711,6 +715,10 @@ class ConvertToTarballs:
             print("REWRITE {}".format(basename))
             location, version, hash, size = self.find_tarball_by_name(module_name)
 
+            for alias, url in self.aliases.items():
+                if location.startswith(url):
+                    location = alias + ':' + location[len(url):]
+
             self.write_bst_file(fullpath, element, location)
 
         except IOError:
@@ -837,7 +845,7 @@ def main(args):
         sys.exit(1)
 
     locator = TarballLocator(options.tarballdir, config.mirrors, options.local_only)
-    convert = ConvertToTarballs(config, locator, options.convert)
+    convert = ConvertToTarballs(config, locator, options.directory, options.convert)
     convert.process_bst_files(os.path.join(options.directory, 'elements', 'core-deps'))
     convert.process_bst_files(os.path.join(options.directory, 'elements', 'core'))
     convert.process_bst_files(os.path.join(options.directory, 'elements', 'sdk'))


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