[zorg] r375168 - LLVMBuildFactory code cleaning.

Galina Kistanova via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 13:42:11 PDT 2019


Author: gkistanova
Date: Thu Oct 17 13:42:10 2019
New Revision: 375168

URL: http://llvm.org/viewvc/llvm-project?rev=375168&view=rev
Log:
LLVMBuildFactory code cleaning.

Cleaned dialing with repourl, added protection from potential leakage of is_legacy_mode kwarg, more radable name for src_dir.

Patch by Andrei Lebedev

Differential Revision: https://reviews.llvm.org/D69081

Modified:
    zorg/trunk/zorg/buildbot/process/factory.py

Modified: zorg/trunk/zorg/buildbot/process/factory.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/zorg/buildbot/process/factory.py?rev=375168&r1=375167&r2=375168&view=diff
==============================================================================
--- zorg/trunk/zorg/buildbot/process/factory.py (original)
+++ zorg/trunk/zorg/buildbot/process/factory.py Thu Oct 17 13:42:10 2019
@@ -61,7 +61,7 @@ class LLVMBuildFactory(BuildFactory):
                 "%(monorepo_dir)s/build" % {'monorepo_dir' : self.monorepo_dir}
 
             # Repourl could be specified per builder. Otherwise we use github.
-            self.repourl = kwargs.pop('repourl', 'https://github.com/llvm/llvm-%s.git')
+            self.repourl_prefix = kwargs.pop('repourl', 'https://github.com/llvm/')
 
 
         # Default build directory.
@@ -134,12 +134,9 @@ class LLVMBuildFactory(BuildFactory):
             return
 
         # Checkout the monorepo.
-        _repourl = self.repourl
-        if '%' in _repourl:
-            _repourl = _repourl % 'project'
         self.addStep(
             Git(name='Checkout the source code',
-                repourl=_repourl,
+                repourl=self.repourl_prefix + "llvm-project.git",
                 progress=True,
                 workdir=WithProperties(self.monorepo_dir),
                 **kwargs))
@@ -147,38 +144,42 @@ class LLVMBuildFactory(BuildFactory):
 
     # Checkout a given LLVM project to the given directory.
     # TODO: Handle clean property and self.clean attribute.
-    def addGetSourcecodeForProject(self, project, srcdir=None, **kwargs):
+    def addGetSourcecodeForProject(self, project, src_dir=None, **kwargs):
+        # Remove 'is_legacy_mode' if it leaked in to kwargs.
+        kwargs.pop('is_legacy_mode', None)
+
         # Bail out if we are in the legacy mode and SVN checkout is required.
         if self.is_legacy_mode:
             workdir, baseURL = svn_repos[project]
 
             # Check out to the given directory if any.
             # Otherwise this is a part of the unified source tree.
-            if srcdir is None:
-                srcdir = workdir % {'llvm_srcdir' : self.llvm_srcdir}
+            if src_dir is None:
+                src_dir = workdir % {'llvm_srcdir' : self.llvm_srcdir}
 
             self.addStep(
                 SVN(name='svn-%s' % project,
-                    workdir=workdir % {'llvm_srcdir' : srcdir},
+                    workdir=src_dir,
                     baseURL=WithProperties(baseURL),
                     **kwargs))
         else:
             # project contains a repo name which is not a part of the monorepo.
             #  We do not enforce it here, though.
-            _repourl = kwargs.pop('repourl', self.repourl)
-            if '%' in _repourl:
-                _repourl = _repourl % project
+            _repourl = kwargs.pop('repourl', None)
+            if not _repourl:
+                _repourl = self.repourl_prefix + "llvm-%s.git" % project
 
             # Check out to the given directory if any.
             # Otherwise this is a part of the unified source tree.
-            if srcdir is None:
-                srcdir = 'llvm-%s' % project
+            if src_dir is None:
+                src_dir = 'llvm-%s' % project
 
-            # Ignore workdir if given. We check out to srcdir.
+            # Ignore workdir if given. We check out to src_dir.
             kwargs.pop('workdir', None)
 
             self.addStep(
                 Git(name='Checkout the %s' % project,
+                    repourl=_repourl,
                     progress=True,
-                    workdir=WithProperties(srcdir),
-                    **kwargs))
\ No newline at end of file
+                    workdir=WithProperties(src_dir),
+                    **kwargs))




More information about the llvm-commits mailing list