[PATCH] D69081: LLVMBuildFactory code cleaning.

Andrei Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 16 22:56:59 PDT 2019


andreil99 created this revision.
andreil99 added reviewers: gkistanova, vvereschaka, aorlov.
andreil99 added projects: LLVM, Zorg.
Herald added a subscriber: llvm-commits.

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


Repository:
  rL LLVM

https://reviews.llvm.org/D69081

Files:
  ../../../zorg/buildbot/process/factory.py


Index: ../../../zorg/buildbot/process/factory.py
===================================================================
--- ../../../zorg/buildbot/process/factory.py
+++ ../../../zorg/buildbot/process/factory.py
@@ -61,7 +61,7 @@
                 "%(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 @@
             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,7 +144,10 @@
 
     # 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]
@@ -154,31 +154,32 @@
 
             # 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))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69081.225352.patch
Type: text/x-patch
Size: 3527 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191017/619dc404/attachment.bin>


More information about the llvm-commits mailing list