phase1: make populateTargets() branch aware
authorThibaut VARÈNE <hacks@slashdirt.org>
Mon, 24 Oct 2022 14:17:03 +0000 (16:17 +0200)
committerPetr Štetiar <ynezz@true.cz>
Mon, 15 May 2023 15:36:01 +0000 (17:36 +0200)
Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
phase1/master.cfg

index 1064efc2a119e96c616a1a424fc7e4f7b68351f3..9453958d276d61ae351ec9fd26ea3baecda44a1a 100644 (file)
@@ -247,27 +247,29 @@ c['prioritizeBuilders'] = prioritizeBuilders
 branchNames = [branches[b]["name"] for b in branches]
 
 # find targets
-targets = [ ]
+targets = set()
 
 def populateTargets():
+       log.msg("Populating targets, this will take time")
        sourcegit = work_dir + '/source.git'
-       if os.path.isdir(sourcegit):
-               subprocess.call(["rm", "-rf", sourcegit])
+       for branch in branchNames:
+               if os.path.isdir(sourcegit):
+                       subprocess.call(["rm", "-rf", sourcegit])
 
-       subprocess.call(["git", "clone", "--depth=1", "--branch="+repo_branch, repo_url, sourcegit])
+               subprocess.call(["git", "clone", "--depth=1", "--branch="+branch, repo_url, sourcegit])
 
-       os.makedirs(sourcegit + '/tmp', exist_ok=True)
-       findtargets = subprocess.Popen(['./scripts/dump-target-info.pl', 'targets'],
-               stdout = subprocess.PIPE, stderr = subprocess.DEVNULL, cwd = sourcegit)
+               os.makedirs(sourcegit + '/tmp', exist_ok=True)
+               findtargets = subprocess.Popen(['./scripts/dump-target-info.pl', 'targets'],
+                       stdout = subprocess.PIPE, stderr = subprocess.DEVNULL, cwd = sourcegit)
 
-       while True:
-               line = findtargets.stdout.readline()
-               if not line:
-                       break
-               ta = line.decode().strip().split(' ')
-               targets.append(ta[0])
+               while True:
+                       line = findtargets.stdout.readline()
+                       if not line:
+                               break
+                       ta = line.decode().strip().split(' ')
+                       targets.add(ta[0])
 
-       subprocess.call(["rm", "-rf", sourcegit])
+               subprocess.call(["rm", "-rf", sourcegit])
 
 populateTargets()
 
@@ -332,7 +334,7 @@ c['schedulers'].append(SingleBranchScheduler(
        name            = "all",
        change_filter   = filter.ChangeFilter(branch=repo_branch),
        treeStableTimer = 60,
-       builderNames    = targets))
+       builderNames    = list(targets)))
 
 c['schedulers'].append(ForceScheduler(
        name         = "force",
@@ -369,7 +371,7 @@ c['schedulers'].append(ForceScheduler(
                                        name    = "target",
                                        label   = "Build target",
                                        default = "all",
-                                       choices = [ "all" ] + targets
+                                       choices = set( "all" ) | targets
                                ),
                                TagChoiceParameter(
                                        name    = "tag",