phase1: refactor populateTargets()
authorThibaut VARÈNE <hacks@slashdirt.org>
Fri, 21 Oct 2022 09:16:42 +0000 (11:16 +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 be53f60078ad8d0f324c87e262e8b4739ae18b91..1d31b780be3b704f6c4eb60b5b2b2016588abb7b 100644 (file)
@@ -235,14 +235,15 @@ c['prioritizeBuilders'] = prioritizeBuilders
 targets = [ ]
 
 def populateTargets():
-       if not os.path.isdir(work_dir+'/source.git'):
-               subprocess.call(["git", "clone", "--depth=1", "--branch="+repo_branch, repo_url, work_dir+'/source.git'])
-       else:
-               subprocess.call(["git", "pull"], cwd = work_dir+'/source.git')
+       sourcegit = work_dir + '/source.git'
+       if os.path.isdir(sourcegit):
+               subprocess.call(["rm", "-rf", sourcegit])
+
+       subprocess.call(["git", "clone", "--depth=1", "--branch="+repo_branch, repo_url, sourcegit])
 
-       os.makedirs(work_dir+'/source.git/tmp', exist_ok=True)
+       os.makedirs(sourcegit + '/tmp', exist_ok=True)
        findtargets = subprocess.Popen(['./scripts/dump-target-info.pl', 'targets'],
-               stdout = subprocess.PIPE, stderr = subprocess.DEVNULL, cwd = work_dir+'/source.git')
+               stdout = subprocess.PIPE, stderr = subprocess.DEVNULL, cwd = sourcegit)
 
        while True:
                line = findtargets.stdout.readline()
@@ -251,6 +252,8 @@ def populateTargets():
                ta = line.decode().strip().split(' ')
                targets.append(ta[0])
 
+       subprocess.call(["rm", "-rf", sourcegit])
+
 populateTargets()
 
 # the 'change_source' setting tells the buildmaster how it should find out