[buildbot] phase1: refactor populateTargets()

LEDE Commits lede-commits at lists.infradead.org
Mon May 15 08:39:12 PDT 2023


ynezz pushed a commit to buildbot.git, branch master:
https://git.openwrt.org/0b632e34bc1865637b21a2b8d059dbf4c8724e99

commit 0b632e34bc1865637b21a2b8d059dbf4c8724e99
Author: Thibaut VARÈNE <hacks at slashdirt.org>
AuthorDate: Fri Oct 21 11:16:42 2022 +0200

    phase1: refactor populateTargets()
    
    Signed-off-by: Thibaut VARÈNE <hacks at slashdirt.org>
---
 phase1/master.cfg | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/phase1/master.cfg b/phase1/master.cfg
index be53f60..1d31b78 100644
--- a/phase1/master.cfg
+++ b/phase1/master.cfg
@@ -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




More information about the lede-commits mailing list