diff mbox

[buildroot-test,8/8] autobuild-run: add support for custom git wrapper

Message ID 1413486964-5183-8-git-send-email-patrickdepinguin@gmail.com
State Superseded
Headers show

Commit Message

Thomas De Schampheleire Oct. 16, 2014, 7:16 p.m. UTC
From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

In corporate environments, there may be no direct git access, and a
wrapper program that sets a proxy may be needed. See [1] for an example
solution.

This patch to autobuild-run provides a --git argument that can be used
to set the path to such a git wrapper. By default, the argument is plain
'git'.

[1] http://gitolite.com/git-over-proxy.html

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
 scripts/autobuild-run | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Comments

Yann E. MORIN Oct. 17, 2014, 10:30 p.m. UTC | #1
Thomas, All,

On 2014-10-16 21:16 +0200, Thomas De Schampheleire spake thusly:
> From: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> In corporate environments, there may be no direct git access, and a
> wrapper program that sets a proxy may be needed. See [1] for an example
> solution.
> 
> This patch to autobuild-run provides a --git argument that can be used
> to set the path to such a git wrapper. By default, the argument is plain
> 'git'.
> 
> [1] http://gitolite.com/git-over-proxy.html

You know you can make this stick, right?

    git config --global --add core.gitproxy /path/to/git-proxy-command

And then you're done once and for all. ;-)

Regards,
Yann E. MORIN.

> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> ---
>  scripts/autobuild-run | 13 ++++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/autobuild-run b/scripts/autobuild-run
> index ceed0ae..42441d0 100755
> --- a/scripts/autobuild-run
> +++ b/scripts/autobuild-run
> @@ -74,6 +74,9 @@ Options:
>                                   only)
>    --make-opts OPTSTRING          string of extra options to pass to Buildroot
>                                   make, such as specific command wrappers
> +  --git GITCMD                   path to git program (possibly a wrapper) used
> +                                 to clone the Buildroot repository
> +                                 [default: git]
>    -c, --config CONFIG            path to configuration file
>  
>  Format of the configuration file:
> @@ -224,7 +227,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", "git://git.busybox.net/buildroot", srcdir],
> +        ret = subprocess.call([kwargs['git'], "clone", "git://git.busybox.net/buildroot", srcdir],
>                                stdout=log, stderr=log)
>          if ret != 0:
>              log_write(log, "ERROR: could not clone Buildroot sources")
> @@ -232,7 +235,7 @@ def prepare_build(**kwargs):
>  
>      # Update the Buildroot sources.
>      abssrcdir = os.path.abspath(srcdir)
> -    ret = subprocess.call(["git", "pull"], cwd=srcdir, stdout=log, stderr=log)
> +    ret = subprocess.call([kwargs['git'], "pull"], cwd=srcdir, stdout=log, stderr=log)
>      if ret != 0:
>          log_write(log, "ERROR: could not pull Buildroot sources")
>          return -1
> @@ -475,8 +478,8 @@ def send_results(result, **kwargs):
>          shutil.copyfile(os.path.join(outputdir, "legal-info", "manifest.csv"),
>                          os.path.join(resultdir, "licenses-manifest.csv"))
>  
> -    subprocess.call(["git log master -n 1 --pretty=format:%%H > %s" % \
> -                     os.path.join(resultdir, "gitid")],
> +    subprocess.call(["%s log master -n 1 --pretty=format:%%H > %s" % \
> +                     (kwargs['git'], os.path.join(resultdir, "gitid"))],
>                      shell=True, cwd=srcdir)
>      subprocess.call(["tail -500 %s > %s" % \
>                       (os.path.join(outputdir, "logfile"), os.path.join(resultdir, "build-end.log"))],
> @@ -610,7 +613,7 @@ def main():
>          p = Process(target=run_instance, kwargs={
>              'instance': i, 'njobs': args['--njobs'], 'sysinfo': sysinfo,
>              'http_login': args['--http-login'],
> -            'http_password': args['--http-password'],
> +            'http_password': args['--http-password'], 'git': args['--git'],
>              'submitter': args['--submitter'], 'make_opts': args['--make-opts']})
>          p.start()
>          processes.append(p)
> -- 
> 1.8.5.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Thomas Petazzoni Oct. 18, 2014, 1 p.m. UTC | #2
Dear Yann E. MORIN,

On Sat, 18 Oct 2014 00:30:23 +0200, Yann E. MORIN wrote:

> You know you can make this stick, right?
> 
>     git config --global --add core.gitproxy /path/to/git-proxy-command
> 
> And then you're done once and for all. ;-)

Yes, I was also wondering why a change to each and every git invocation
was needed: surely like wget there should be a way to configure git to
use a proxy.

With what Yann has given, Thomas, do you still need this patch?

Thanks,

Thomas
Thomas De Schampheleire Oct. 18, 2014, 7:08 p.m. UTC | #3
Hi,

On Sat, Oct 18, 2014 at 3:00 PM, Thomas Petazzoni
<thomas.petazzoni@free-electrons.com> wrote:
> Dear Yann E. MORIN,
>
> On Sat, 18 Oct 2014 00:30:23 +0200, Yann E. MORIN wrote:
>
>> You know you can make this stick, right?
>>
>>     git config --global --add core.gitproxy /path/to/git-proxy-command
>>
>> And then you're done once and for all. ;-)
>
> Yes, I was also wondering why a change to each and every git invocation
> was needed: surely like wget there should be a way to configure git to
> use a proxy.
>
> With what Yann has given, Thomas, do you still need this patch?
>


Hmm, yes indeed.
On my laptop, I don't want to do that as I need/don't need the proxy
depending on if I'm connected to the company network or not. But in
case of an autobuilder it's not the case.
So yes, I will drop this patch.

Thanks,
Thomas
diff mbox

Patch

diff --git a/scripts/autobuild-run b/scripts/autobuild-run
index ceed0ae..42441d0 100755
--- a/scripts/autobuild-run
+++ b/scripts/autobuild-run
@@ -74,6 +74,9 @@  Options:
                                  only)
   --make-opts OPTSTRING          string of extra options to pass to Buildroot
                                  make, such as specific command wrappers
+  --git GITCMD                   path to git program (possibly a wrapper) used
+                                 to clone the Buildroot repository
+                                 [default: git]
   -c, --config CONFIG            path to configuration file
 
 Format of the configuration file:
@@ -224,7 +227,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", "git://git.busybox.net/buildroot", srcdir],
+        ret = subprocess.call([kwargs['git'], "clone", "git://git.busybox.net/buildroot", srcdir],
                               stdout=log, stderr=log)
         if ret != 0:
             log_write(log, "ERROR: could not clone Buildroot sources")
@@ -232,7 +235,7 @@  def prepare_build(**kwargs):
 
     # Update the Buildroot sources.
     abssrcdir = os.path.abspath(srcdir)
-    ret = subprocess.call(["git", "pull"], cwd=srcdir, stdout=log, stderr=log)
+    ret = subprocess.call([kwargs['git'], "pull"], cwd=srcdir, stdout=log, stderr=log)
     if ret != 0:
         log_write(log, "ERROR: could not pull Buildroot sources")
         return -1
@@ -475,8 +478,8 @@  def send_results(result, **kwargs):
         shutil.copyfile(os.path.join(outputdir, "legal-info", "manifest.csv"),
                         os.path.join(resultdir, "licenses-manifest.csv"))
 
-    subprocess.call(["git log master -n 1 --pretty=format:%%H > %s" % \
-                     os.path.join(resultdir, "gitid")],
+    subprocess.call(["%s log master -n 1 --pretty=format:%%H > %s" % \
+                     (kwargs['git'], os.path.join(resultdir, "gitid"))],
                     shell=True, cwd=srcdir)
     subprocess.call(["tail -500 %s > %s" % \
                      (os.path.join(outputdir, "logfile"), os.path.join(resultdir, "build-end.log"))],
@@ -610,7 +613,7 @@  def main():
         p = Process(target=run_instance, kwargs={
             'instance': i, 'njobs': args['--njobs'], 'sysinfo': sysinfo,
             'http_login': args['--http-login'],
-            'http_password': args['--http-password'],
+            'http_password': args['--http-password'], 'git': args['--git'],
             'submitter': args['--submitter'], 'make_opts': args['--make-opts']})
         p.start()
         processes.append(p)