From patchwork Mon Jul 17 21:28:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 789736 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xBGdr2vrPz9sRV for ; Tue, 18 Jul 2017 07:29:35 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 7162230155; Mon, 17 Jul 2017 21:29:33 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y8i4jb88Gn6k; Mon, 17 Jul 2017 21:29:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 6ABAD25504; Mon, 17 Jul 2017 21:29:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id E51171C1190 for ; Mon, 17 Jul 2017 21:29:30 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id DFB6825504 for ; Mon, 17 Jul 2017 21:29:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id r9xIV9mN-ozD for ; Mon, 17 Jul 2017 21:29:29 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exchange.essensium.com (220.77.144.195.ipv4.evonet.be [195.144.77.220]) by silver.osuosl.org (Postfix) with ESMTPS id 02C8025406 for ; Mon, 17 Jul 2017 21:29:28 +0000 (UTC) Received: from localhost.localdomain (10.3.7.11) by beleexch01.local.ess-mail.com (10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32; Mon, 17 Jul 2017 23:29:02 +0200 From: "Arnout Vandecappelle (Essensium/Mind)" To: Date: Mon, 17 Jul 2017 23:28:59 +0200 Message-ID: <20170717212859.12581-1-arnout@mind.be> X-Mailer: git-send-email 2.13.2 MIME-Version: 1.0 X-Originating-IP: [10.3.7.11] X-ClientProxiedBy: beleexch01.local.ess-mail.com (10.3.7.8) To beleexch01.local.ess-mail.com (10.3.7.8) Subject: [Buildroot] [PATCH] autobuild-run: add --repo option 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: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" This option allows to specify which Buildroot git repository to clone. This can be useful in several situations: - to use a different mirror in case you don't have a good connection to github; - for debugging this script; - to point to a local, patched repository you want to test. Note that the clone/pull will use the currently checked out branch of the repository if it is non-bare, which is ideal for testing. Since switching repositories may also switch branches, we use a git fetch/checkout sequence instead of doing a git pull. With git pull, the branches would be merged instead of switched. To avoid polluting the log with the long git message about a detached head, while still getting some useful output from git, pass the --detach option to git checkout. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) Reviewed-by: Matt Weber --- Ideally the contents of this commit message would be put somewhere as documentation, but I couldn't find a good spot for it. --- scripts/autobuild-run | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/autobuild-run b/scripts/autobuild-run index a7d7d4f..523e382 100755 --- a/scripts/autobuild-run +++ b/scripts/autobuild-run @@ -68,6 +68,7 @@ defaults = { '--pid-file': '/tmp/buildroot-autobuild.pid', '--http-url': 'http://autobuild.buildroot.org/submit/', '--toolchains-url': 'http://autobuild.buildroot.org/toolchains/configs/toolchain-configs.csv', + '--repo': 'https://github.com/buildroot/buildroot.git', } doc = """autobuild-run - run Buildroot autobuilder @@ -103,6 +104,8 @@ Options: Not set by default. -d, --debug Send log output to stdout instead of log file --toolchains-url URL URL of toolchain configuration file + -r, --repo URL URL of Buildroot repository to clone + Defaults to %(--repo)s Format of the configuration file: @@ -329,7 +332,7 @@ def prepare_build(**kwargs): # didn't exist already. srcdir = os.path.join(idir, "buildroot") if not os.path.exists(srcdir): - ret = subprocess.call(["git", "clone", "https://github.com/buildroot/buildroot.git", srcdir], + ret = subprocess.call(["git", "clone", kwargs['repo'], srcdir], stdout=log, stderr=log) if ret != 0: log_write(log, "ERROR: could not clone Buildroot sources") @@ -337,9 +340,14 @@ def prepare_build(**kwargs): # Update the Buildroot sources. abssrcdir = os.path.abspath(srcdir) - ret = subprocess.call(["git", "pull"], cwd=abssrcdir, stdout=log, stderr=log) + ret = subprocess.call(["git", "fetch", kwargs['repo']], cwd=abssrcdir, stdout=log, stderr=log) if ret != 0: - log_write(log, "ERROR: could not pull Buildroot sources") + log_write(log, "ERROR: could not fetch Buildroot sources") + return -1 + + ret = subprocess.call(["git", "checkout", "--detach", "FETCH_HEAD"], cwd=abssrcdir, stdout=log, stderr=log) + if ret != 0: + log_write(log, "ERROR: could not check out Buildroot sources") return -1 # Create an empty output directory. We remove it first, in case a previous build was aborted. @@ -948,6 +956,7 @@ def main(): make_opts = (args['--make-opts'] or ''), nice = (args['--nice'] or 0), toolchains_url = args['--toolchains-url'], + repo = args['--repo'], upload = upload, buildpid = buildpid, debug = args['--debug']