From: "André Erdmann" <dywi@mailerd.de>
To: buildroot@busybox.net
Subject: [Buildroot] [autobuild v2 3/3] autobuild-run: allow to change default git uri and branch on the command line
Date: Thu, 30 Apr 2015 00:25:11 +0200 [thread overview]
Message-ID: <55415A47.4080108@mailerd.de> (raw)
In-Reply-To: <1430338217-25518-3-git-send-email-s.martin49@gmail.com>
2015/4/29 Samuel Martin <s.martin49@gmail.com>:
> 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 <Matthew.Weber@rockwellcollins.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Signed-off-by: Samuel Martin <s.martin49@gmail.com>
>
> ---
> 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]
Don't add "[default: <sth>]" here - <sth> will end up in the config ("args" variable),
and has higher priority than any other configuration method (config file, defaults).
The result is that if you run autobuild-run without "--br-git-uri ...", it will try
to fetch from "the official Buildroot repository" and not "git://..." (BUILDROOT_GIT_REPO_URI).
> + --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]
The same applies here.
> -c, --config CONFIG path to configuration file
>
> Format of the configuration file:
> @@ -98,6 +111,8 @@ Format of the configuration file:
> http-login = <value>
> http-password = <value>
> submitter = <value>
> + br-git-uri = <value>
> + br-git-branch = <value>
>
> 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)
--br-git-{uri,branch} are ignored if srcdir already exists,
which should be documented or changed code-wise.
I'd add a note to the help message for now
("applies to new instance directories" or so).
> 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)
>
--
Andr?
next prev parent reply other threads:[~2015-04-29 22:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 20:10 [Buildroot] [autobuild v2 1/3] autobuild-run: prevent send_result from failing when gathering config files Samuel Martin
2015-04-29 20:10 ` [Buildroot] [autobuild v2 2/3] autobuild-run: also save CMake config log files on package failure Samuel Martin
2015-04-29 22:54 ` André Erdmann
2015-05-04 20:12 ` Thomas Petazzoni
2015-05-04 20:12 ` Thomas Petazzoni
2015-04-29 20:10 ` [Buildroot] [autobuild v2 3/3] autobuild-run: allow to change default git uri and branch on the command line Samuel Martin
2015-04-29 22:25 ` André Erdmann [this message]
2015-04-30 5:20 ` Samuel Martin
2015-04-30 18:20 ` André Erdmann
2015-05-04 20:11 ` Thomas Petazzoni
2015-05-04 20:12 ` [Buildroot] [autobuild v2 1/3] autobuild-run: prevent send_result from failing when gathering config files Thomas Petazzoni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55415A47.4080108@mailerd.de \
--to=dywi@mailerd.de \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox