* [PATCH] git-tracker: read INPUT_HTTP[S]_PROXY environment variable
@ 2015-08-19 9:26 Johannes Berg
2015-08-19 9:40 ` Johannes Berg
2015-08-19 9:44 ` [PATCH v2] " Johannes Berg
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Berg @ 2015-08-19 9:26 UTC (permalink / raw)
To: backports
From: Johannes Berg <johannes.berg@intel.com>
This allows using a different HTTP[S] proxy for input and output
trees, if necessary.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
devel/git-tracker.py | 16 +++++++++++-----
lib/bpgit.py | 10 ++++++----
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/devel/git-tracker.py b/devel/git-tracker.py
index 9ce6ce455f95..13e694daeba8 100755
--- a/devel/git-tracker.py
+++ b/devel/git-tracker.py
@@ -38,12 +38,18 @@ SCRIPT_GIT_NAME = 'backports git tracker'
SCRIPT_GIT_EMAIL = ''
-def update_cache_objects(gittree, objdir):
+def update_cache_objects(gittree, objdir, input):
+ env = os.environ.copy()
+ if input:
+ if 'INPUT_HTTP_PROXY' in env:
+ env['http_proxy'] = env['INPUT_HTTP_PROXY']
+ if 'INPUT_HTTPS_PROXY' in env:
+ env['https_proxy'] = env['INPUT_HTTPS_PROXY']
if not os.path.isdir(objdir):
- git.clone(gittree, objdir, options=['--bare'])
+ git.clone(gittree, objdir, options=['--bare'], env=env)
else:
git.set_origin(gittree, objdir)
- git.remote_update(objdir)
+ git.remote_update(objdir, env=env)
def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, backport_rev, kernel_rev,
prev_kernel_rev=None, defconfig=None, env={}, commit_failure=True,
@@ -175,11 +181,11 @@ if __name__ == '__main__':
defconfig = config.get(tree, 'defconfig')
branches = [r.strip() for r in config.get(tree, 'branches').split(',')]
- update_cache_objects(input, kernelobjdir)
+ update_cache_objects(input, kernelobjdir, input=True)
wgitref = os.path.join(cachedir, 'backport-' + tree)
- update_cache_objects(output, wgitref)
+ update_cache_objects(output, wgitref, input=False)
for branch in branches:
with tempdir.tempdir() as branch_tmpdir:
diff --git a/lib/bpgit.py b/lib/bpgit.py
index dc7d689550b1..f1e36014e734 100644
--- a/lib/bpgit.py
+++ b/lib/bpgit.py
@@ -165,8 +165,9 @@ def get_blob(blob, outf, tree=None):
process.wait()
_check(process)
-def clone(gittree, outputdir, options=[]):
- process = subprocess.Popen(['git', 'clone'] + options + [gittree, outputdir])
+def clone(gittree, outputdir, options=[], env=None):
+ process = subprocess.Popen(['git', 'clone'] + options + [gittree, outputdir],
+ env=env)
process.wait()
_check(process)
@@ -180,9 +181,10 @@ def set_origin(giturl, gitdir):
process.wait()
_check(process)
-def remote_update(gitdir):
+def remote_update(gitdir, env=None):
process = subprocess.Popen(['git', 'remote', 'update'],
- close_fds=True, universal_newlines=True, cwd=gitdir)
+ close_fds=True, universal_newlines=True, cwd=gitdir,
+ env=env)
process.wait()
_check(process)
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] git-tracker: read INPUT_HTTP[S]_PROXY environment variable
2015-08-19 9:26 [PATCH] git-tracker: read INPUT_HTTP[S]_PROXY environment variable Johannes Berg
@ 2015-08-19 9:40 ` Johannes Berg
2015-08-19 9:44 ` [PATCH v2] " Johannes Berg
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2015-08-19 9:40 UTC (permalink / raw)
To: backports
On Wed, 2015-08-19 at 11:26 +0200, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> This allows using a different HTTP[S] proxy for input and output
> trees, if necessary.
>
Oops, this was incomplete - will send v2.
johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] git-tracker: read INPUT_HTTP[S]_PROXY environment variable
2015-08-19 9:26 [PATCH] git-tracker: read INPUT_HTTP[S]_PROXY environment variable Johannes Berg
2015-08-19 9:40 ` Johannes Berg
@ 2015-08-19 9:44 ` Johannes Berg
2015-09-14 21:25 ` Hauke Mehrtens
1 sibling, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2015-08-19 9:44 UTC (permalink / raw)
To: backports
From: Johannes Berg <johannes.berg@intel.com>
This allows using a different HTTP[S] proxy for input and output
trees, if necessary.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
devel/git-tracker.py | 22 ++++++++++++++++------
lib/bpgit.py | 14 ++++++++------
2 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/devel/git-tracker.py b/devel/git-tracker.py
index 9ce6ce455f95..7962cf03ce88 100755
--- a/devel/git-tracker.py
+++ b/devel/git-tracker.py
@@ -37,13 +37,22 @@ FAIL = 'failed'
SCRIPT_GIT_NAME = 'backports git tracker'
SCRIPT_GIT_EMAIL = ''
+def make_proxy_env(input):
+ env = os.environ.copy()
+ if input:
+ if 'INPUT_HTTP_PROXY' in env:
+ env['http_proxy'] = env['INPUT_HTTP_PROXY']
+ if 'INPUT_HTTPS_PROXY' in env:
+ env['https_proxy'] = env['INPUT_HTTPS_PROXY']
+ return env
-def update_cache_objects(gittree, objdir):
+def update_cache_objects(gittree, objdir, input):
+ env = make_proxy_env(input)
if not os.path.isdir(objdir):
- git.clone(gittree, objdir, options=['--bare'])
+ git.clone(gittree, objdir, options=['--bare'], env=env)
else:
git.set_origin(gittree, objdir)
- git.remote_update(objdir)
+ git.remote_update(objdir, env=env)
def handle_commit(args, msg, branch, treename, kernelobjdir, tmpdir, wgitdir, backport_rev, kernel_rev,
prev_kernel_rev=None, defconfig=None, env={}, commit_failure=True,
@@ -175,11 +184,11 @@ if __name__ == '__main__':
defconfig = config.get(tree, 'defconfig')
branches = [r.strip() for r in config.get(tree, 'branches').split(',')]
- update_cache_objects(input, kernelobjdir)
+ update_cache_objects(input, kernelobjdir, input=True)
wgitref = os.path.join(cachedir, 'backport-' + tree)
- update_cache_objects(output, wgitref)
+ update_cache_objects(output, wgitref, input=False)
for branch in branches:
with tempdir.tempdir() as branch_tmpdir:
@@ -189,7 +198,8 @@ if __name__ == '__main__':
git.remove_config('core.bare', tree=wgitdir)
git.set_origin(output, wgitdir)
- kernel_head = git.ls_remote(branch, tree=kernelobjdir)
+ env = make_proxy_env(True)
+ kernel_head = git.ls_remote(branch, tree=kernelobjdir, env=env)
backport_author_env = {
'GIT_AUTHOR_NAME': SCRIPT_GIT_NAME,
diff --git a/lib/bpgit.py b/lib/bpgit.py
index dc7d689550b1..35bb80702fbe 100644
--- a/lib/bpgit.py
+++ b/lib/bpgit.py
@@ -165,8 +165,9 @@ def get_blob(blob, outf, tree=None):
process.wait()
_check(process)
-def clone(gittree, outputdir, options=[]):
- process = subprocess.Popen(['git', 'clone'] + options + [gittree, outputdir])
+def clone(gittree, outputdir, options=[], env=None):
+ process = subprocess.Popen(['git', 'clone'] + options + [gittree, outputdir],
+ env=env)
process.wait()
_check(process)
@@ -180,9 +181,10 @@ def set_origin(giturl, gitdir):
process.wait()
_check(process)
-def remote_update(gitdir):
+def remote_update(gitdir, env=None):
process = subprocess.Popen(['git', 'remote', 'update'],
- close_fds=True, universal_newlines=True, cwd=gitdir)
+ close_fds=True, universal_newlines=True, cwd=gitdir,
+ env=env)
process.wait()
_check(process)
@@ -234,9 +236,9 @@ def remove_config(cfg, tree=None):
process.wait()
_check(process)
-def ls_remote(branch, tree=None, remote='origin'):
+def ls_remote(branch, tree=None, remote='origin', env=None):
process = subprocess.Popen(['git', 'ls-remote', remote, 'refs/heads/' + branch],
- stdout=subprocess.PIPE,
+ stdout=subprocess.PIPE, env=env,
close_fds=True, universal_newlines=True, cwd=tree)
stdout = process.communicate()[0]
process.wait()
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] git-tracker: read INPUT_HTTP[S]_PROXY environment variable
2015-08-19 9:44 ` [PATCH v2] " Johannes Berg
@ 2015-09-14 21:25 ` Hauke Mehrtens
0 siblings, 0 replies; 4+ messages in thread
From: Hauke Mehrtens @ 2015-09-14 21:25 UTC (permalink / raw)
To: Johannes Berg, backports
On 08/19/2015 11:44 AM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> This allows using a different HTTP[S] proxy for input and output
> trees, if necessary.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
> devel/git-tracker.py | 22 ++++++++++++++++------
> lib/bpgit.py | 14 ++++++++------
> 2 files changed, 24 insertions(+), 12 deletions(-)
>
Thank you for the patch, it was applied and pushed out.
Hauke
--
To unsubscribe from this list: send the line "unsubscribe backports" in
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-09-14 21:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-19 9:26 [PATCH] git-tracker: read INPUT_HTTP[S]_PROXY environment variable Johannes Berg
2015-08-19 9:40 ` Johannes Berg
2015-08-19 9:44 ` [PATCH v2] " Johannes Berg
2015-09-14 21:25 ` Hauke Mehrtens
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.