# slave name and password must be configured on the slave.
from buildbot.buildslave import BuildSlave
+slave_port = 9989
+
+if ini.has_option("general", "port"):
+ slave_port = ini.getint("general", "port")
+
c['slaves'] = []
for section in ini.sections():
# 'slavePortnum' defines the TCP port to listen on for connections from slaves.
# This must match the value configured into the buildslaves (with their
# --master option)
-c['slavePortnum'] = 9989
+c['slavePortnum'] = slave_port
# coalesce builds
c['mergeRequests'] = True
# find targets
targets = [ ]
+if not os.path.isdir(home_dir+'/source.git'):
+ subprocess.call(["git", "clone", "--depth=1", repo_url, home_dir+'/source.git'])
+
findtargets = subprocess.Popen([home_dir+'/dumpinfo.pl', 'targets'],
stdout = subprocess.PIPE, cwd = home_dir+'/source.git')
from buildbot.process.properties import WithProperties
-MakeTargetMap = {
- "^tools/": "tools/clean",
- "^toolchain/": "toolchain/clean",
- "^target/linux/": "target/linux/clean",
- "^(config|include)/": "dirclean"
-}
+CleanTargetMap = [
+ [ "tools", "tools/clean" ],
+ [ "chain", "toolchain/clean" ],
+ [ "linux", "target/linux/clean" ],
+ [ "dir", "dirclean" ],
+ [ "dist", "distclean" ]
+]
-def IsAffected(pattern):
- def CheckAffected(change):
- for request in change.build.requests:
- for source in request.sources:
- for change in source.changes:
- for file in change.files:
- if re.match(pattern, file):
- return True
- return False
- return CheckAffected
-
-def isPathBuiltin(path):
- incl = {}
- pkgs = {}
- conf = open(".config", "r")
-
- while True:
- line = conf.readline()
- if line == '':
- break
- m = re.match("^(CONFIG_PACKAGE_.+?)=y", line)
- if m:
- incl[m.group(1)] = True
-
- conf.close()
-
- deps = open("tmp/.packagedeps", "r")
-
- while True:
- line = deps.readline()
- if line == '':
- break
- m = re.match("^package-\$\((CONFIG_PACKAGE_.+?)\) \+= (\S+)", line)
- if m and incl.get(m.group(1)) == True:
- pkgs["package/%s" % m.group(2)] = True
-
- deps.close()
-
- while path != '':
- if pkgs.get(path) == True:
+def IsCleanRequested(pattern):
+ def CheckCleanProperty(step):
+ val = step.getProperty("clean")
+ if val and re.match(pattern, val):
return True
- path = os.path.dirname(path)
+ else:
+ return False
- return False
-
-def isChangeBuiltin(change):
- return True
-# for request in change.build.requests:
-# for source in request.sources:
-# for change in source.changes:
-# for file in change.files:
-# if isPathBuiltin(file):
-# return True
-# return False
+ return CheckCleanProperty
c['builders'] = []
haltOnFailure = True,
timeout = 2400))
+ # user-requested clean targets
+ for tuple in CleanTargetMap:
+ factory.addStep(ShellCommand(
+ name = tuple[1],
+ description = 'User-requested "make %s"' % tuple[1],
+ command = ["make", tuple[1], "V=s"],
+ doStepIf = IsCleanRequested(tuple[0])
+ ))
+
# check out the source
factory.addStep(Git(repourl=repo_url, mode='update'))
want_stdout = False
))
+ # prepare tar
+ factory.addStep(ShellCommand(
+ name = "dltar",
+ description = "Building GNU tar",
+ command = ["make", WithProperties("-j%(nproc:~4)s"), "tools/tar/install", "V=s"],
+ haltOnFailure = True
+ ))
+
# populate dl
factory.addStep(ShellCommand(
name = "dlrun",
command=["make", "package/base-files/clean", "V=s"]
))
- # optional clean steps
- for pattern, maketarget in MakeTargetMap.items():
- factory.addStep(ShellCommand(
- name = maketarget,
- description = maketarget,
- command=["make", maketarget, "V=s"], doStepIf=IsAffected(pattern)
- ))
-
# build
factory.addStep(ShellCommand(
name = "tools",
name = "pkginstall",
description = "Installing packages",
command=["make", WithProperties("-j%(nproc:~4)s"), "package/install", "V=s"],
- doStepIf = isChangeBuiltin,
haltOnFailure = True
))
factory.addStep(ShellCommand(
name = "images",
description = "Building images",
- command=["make", "-j1", "target/install", "V=s"],
- doStepIf = isChangeBuiltin,
+ command=["make", WithProperties("-j%(nproc:~4)s"), "target/install", "V=s"],
haltOnFailure = True
))
name = "checksums",
description = "Calculating checksums",
command=["make", "-j1", "checksum", "V=s"],
- doStepIf = isChangeBuiltin,
haltOnFailure = True
))
factory.addStep(ShellCommand(
name = "targetupload",
description = "Uploading target files",
- command=["rsync", "--delete", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), "-avz", WithProperties("bin/targets/%s/%s%%(libc)s/" %(ts[0], ts[1])), "%s/targets/%s/%s/" %(rsync_bin_url, ts[0], ts[1])],
+ command=["rsync", "--delete", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), "-avz", WithProperties("bin/targets/%s/%s%%(libc)s/" %(ts[0], ts[1])), "%s/targets/%s/%s/" %(rsync_bin_url, ts[0], ts[1])],
env={'RSYNC_PASSWORD': rsync_bin_key},
haltOnFailure = True,
logEnviron = False
factory.addStep(ShellCommand(
name = "sourceupload",
description = "Uploading source archives",
- command=["rsync", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), "-avz", "dl/", "%s/" %(rsync_src_url)],
+ command=["rsync", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s~%s" %(ts[0], ts[1]), "-avz", "dl/", "%s/" %(rsync_src_url)],
env={'RSYNC_PASSWORD': rsync_src_key},
haltOnFailure = True,
logEnviron = False