phase1: build local tar before running downloads
[buildbot.git] / phase1 / master.cfg
index ea6d47164885e75619878c34533385ed3ea837b9..7e74bd39f7a0c438ff1d8b5bed547e67a1d99065 100644 (file)
@@ -48,6 +48,10 @@ c['mergeRequests'] = True
 ####### CHANGESOURCES
 
 home_dir = os.path.abspath(ini.get("general", "homedir"))
+tree_expire = 0
+
+if ini.has_option("general", "expire"):
+       tree_expire = ini.getint("general", "expire")
 
 repo_url = ini.get("repo", "url")
 
@@ -78,6 +82,9 @@ if ini.has_option("gpg", "passfile"):
 # 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')
 
@@ -134,67 +141,23 @@ from buildbot.steps.master import MasterShellCommand
 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'] = []
@@ -271,6 +234,30 @@ for target in targets:
                description = "Finding number of CPUs",
                command = ["nproc"]))
 
+       # expire tree if needed
+       if tree_expire > 0:
+               factory.addStep(FileDownload(
+                       mastersrc = "expire.sh",
+                       slavedest = "../expire.sh",
+                       mode = 0755))
+
+               factory.addStep(ShellCommand(
+                       name = "expire",
+                       description = "Checking for build tree expiry",
+                       command = ["./expire.sh", str(tree_expire)],
+                       workdir = ".",
+                       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'))
 
@@ -285,6 +272,12 @@ for target in targets:
 #              description = "Copy the feeds.conf",
 #              command='''cp ~/feeds.conf ./feeds.conf''' ))
 
+       # feed
+       factory.addStep(ShellCommand(
+               name = "rmfeedlinks",
+               description = "Remove feed symlinks",
+               command=["rm", "-rf", "package/feeds/"]))
+
        # feed
        factory.addStep(ShellCommand(
                name = "updatefeeds",
@@ -314,6 +307,9 @@ CONFIG_SIGNED_PACKAGES=y
 # CONFIG_PER_FEED_REPO_ADD_COMMENTED is not set
 CONFIG_KERNEL_KALLSYMS=y
 CONFIG_COLLECT_KERNEL_DEBUG=y
+CONFIG_TARGET_ALL_PROFILES=y
+CONFIG_TARGET_MULTI_PROFILE=y
+CONFIG_TARGET_PER_DEVICE_ROOTFS=y
 EOT''' %(ts[0], ts[0], ts[1]) ))
 
        factory.addStep(ShellCommand(
@@ -359,6 +355,14 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                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",
@@ -374,14 +378,6 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                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",
@@ -418,7 +414,6 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                name = "pkginstall",
                description = "Installing packages",
                command=["make", WithProperties("-j%(nproc:~4)s"), "package/install", "V=s"],
-               doStepIf = isChangeBuiltin,
                haltOnFailure = True
        ))
 
@@ -433,8 +428,14 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
        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
+       ))
+
+       factory.addStep(ShellCommand(
+               name = "checksums",
+               description = "Calculating checksums",
+               command=["make", "-j1", "checksum", "V=s"],
                haltOnFailure = True
        ))
 
@@ -450,7 +451,7 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                factory.addStep(ShellCommand(
                        name = "signpack",
                        description = "Packing files to sign",
-                       command = ["sh", "-c", WithProperties("find bin/targets/%s/%s%%(libc)s/ -mindepth 1 -maxdepth 2 -type f -name sha256sums -or -name Packages -print0 | xargs -0 tar -czf sign.tar.gz" %(ts[0], ts[1]))],
+                       command = WithProperties("find bin/targets/%s/%s%%(libc)s/ -mindepth 1 -maxdepth 2 -type f -name sha256sums -print0 -or -name Packages -print0 | xargs -0 tar -czf sign.tar.gz" %(ts[0], ts[1])),
                        haltOnFailure = True
                ))
 
@@ -493,7 +494,7 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
        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
@@ -503,7 +504,7 @@ EOT''' %(ts[0], ts[0], ts[1]) ))
                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