From patchwork Wed Apr 29 20:10:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Martin X-Patchwork-Id: 466268 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 8497914030C for ; Thu, 30 Apr 2015 06:10:38 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=vmlEfWX7; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CAF8D95D51; Wed, 29 Apr 2015 20:10:37 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iriuRC545CiT; Wed, 29 Apr 2015 20:10:35 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 4DF5E95D66; Wed, 29 Apr 2015 20:10:35 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 949E21C2297 for ; Wed, 29 Apr 2015 20:10:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 91F0B91697 for ; Wed, 29 Apr 2015 20:10:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wuD+1KCHRs77 for ; Wed, 29 Apr 2015 20:10:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by whitealder.osuosl.org (Postfix) with ESMTPS id B747D91691 for ; Wed, 29 Apr 2015 20:10:30 +0000 (UTC) Received: by wiun10 with SMTP id n10so78874225wiu.1 for ; Wed, 29 Apr 2015 13:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eP+5iARtE+cuA0wWLYvjaxeWPStENI/YhYhwWeFStW8=; b=vmlEfWX7a1U2CgSRLyj9MI0eGRX4jx+8WgWTjMzWzulQBQQTV0TpiQyXrqRuYQjNRC I/Z08WJw8VRxszJz7zURyzQdt+bAn281q5htE9puLuzAolHUjrqsJkg4BMfOeFExXPum VuzF/TEcXqs78xs1PIQg2Blnjl7Hogt11lA/sQ/egcT/+2z0MTHQ0rXC00pE6IHC5FD2 zGxyU3bDUu/liKHqRBlTqykLazqZUS+PLf2a28kjvDvJuMkGyFurn6fDcjzI/Pab+RaW J8opTriWSsk5mFADPQfBrFdZ6WWkL3tav5KVqK+/np3ByEcUFy+pSJ6UOTaQhnVqw6mU AUXQ== X-Received: by 10.180.107.70 with SMTP id ha6mr8963199wib.20.1430338229209; Wed, 29 Apr 2015 13:10:29 -0700 (PDT) Received: from bobook.localdomain (ivr94-4-82-229-165-48.fbx.proxad.net. [82.229.165.48]) by mx.google.com with ESMTPSA id hj10sm69099wjc.48.2015.04.29.13.10.27 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 29 Apr 2015 13:10:28 -0700 (PDT) From: Samuel Martin To: buildroot@buildroot.org Date: Wed, 29 Apr 2015 22:10:17 +0200 Message-Id: <1430338217-25518-3-git-send-email-s.martin49@gmail.com> X-Mailer: git-send-email 2.3.7 In-Reply-To: <1430338217-25518-1-git-send-email-s.martin49@gmail.com> References: <1430338217-25518-1-git-send-email-s.martin49@gmail.com> Cc: Thomas Petazzoni Subject: [Buildroot] [autobuild v2 3/3] autobuild-run: allow to change default git uri and branch on the command line X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This is useful when hacking the autobuild-run script on some specific Buildroot tree, or to run the script with custom tree. Result upload is automatically disable when one of these setting are not the default ones. Cc: Matt Weber Cc: Thomas Petazzoni Signed-off-by: Samuel Martin --- changes v1->v2: - use cmdline options instead of env. vars. --- scripts/autobuild-run | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/scripts/autobuild-run b/scripts/autobuild-run index 01e3265..427d333 100755 --- a/scripts/autobuild-run +++ b/scripts/autobuild-run @@ -57,6 +57,9 @@ from __future__ import print_function +BUILDROOT_GIT_REPO_URI = "git://git.busybox.net/buildroot" +BUILDROOT_GIT_BRANCH = "master" + # Don't tell docopt about the defaults, as it would not allow the following # priority hierarchy for arguments: command-line > config file > defaults defaults = { @@ -64,6 +67,8 @@ defaults = { '--njobs': '1', '--submitter': 'N/A', '--make-opts': '', + '--br-git-uri': BUILDROOT_GIT_REPO_URI, + '--br-git-branch': BUILDROOT_GIT_BRANCH, } doc = """autobuild-run - run Buildroot autobuilder @@ -84,6 +89,14 @@ Options: --make-opts OPTSTRING string of extra options to pass to Buildroot make, such as specific command wrappers [default: ] + --br-git-uri GIT_REPO_URI Buildroot git repository uri used from the instances. + When an alternative git repo uri is set, result uplaod + is disabled. + [default: the official Buildroot repository] + --br-git-branch GIT_BRANCH Buildroot git branch used for the instance + When an alternative git branch is set, result uplaod + is disabled. + [default: master] -c, --config CONFIG path to configuration file Format of the configuration file: @@ -98,6 +111,8 @@ Format of the configuration file: http-login = http-password = submitter = + br-git-uri = + br-git-branch = Default values for the arguments are: @@ -296,17 +311,17 @@ def prepare_build(**kwargs): # Clone Buildroot. This only happens if the source directory # didn't exist already. - srcdir = os.path.join(idir, "buildroot") + srcdir = os.path.abspath(os.path.join(idir, "buildroot")) if not os.path.exists(srcdir): - ret = subprocess.call(["git", "clone", "git://git.busybox.net/buildroot", srcdir], + ret = subprocess.call(["git", "clone", "-b", kwargs['br_git_branch'], + kwargs['br_git_repo_uri'], srcdir], stdout=log, stderr=log) if ret != 0: log_write(log, "ERROR: could not clone Buildroot sources") return -1 # Update the Buildroot sources. - abssrcdir = os.path.abspath(srcdir) - ret = subprocess.call(["git", "pull"], cwd=abssrcdir, stdout=log, stderr=log) + ret = subprocess.call(["git", "pull"], cwd=srcdir, stdout=log, stderr=log) if ret != 0: log_write(log, "ERROR: could not pull Buildroot sources") return -1 @@ -794,14 +809,22 @@ def main(): # http_login/password could theoretically be allowed as empty, so check # explicitly on None. - upload = (args['--http-login'] is not None) \ - and (args['--http-password'] is not None) + upload = True + if args['--http-login'] is None or args['--http-password'] is None: + print("WARN: due to the lack of http login/password details, results will not be submitted") + upload = False + # disable result upload when using alternative git repository and/or branch + if args['--br-git-uri'] != BUILDROOT_GIT_REPO_URI \ + or args['--br-git-branch'] != BUILDROOT_GIT_BRANCH: + print("WARN: using alternative git repository and/or branch, results will not be submitted") + upload = False + if upload: sysinfo.needed_progs.append("curl") else: - print("WARN: due to the lack of http login/password details, results will not be submitted") print("WARN: tarballs of results will be kept locally only") + if not sysinfo.check_requirements(): sys.exit(1) @@ -844,7 +867,9 @@ def main(): submitter = args['--submitter'], make_opts = args['--make-opts'], upload = upload, - buildpid = buildpid + buildpid = buildpid, + br_git_repo_uri = args['--br-git-uri'], + br_git_branch = args['--br-git-branch'] )) p.start() processes.append(p)