|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [OSSTEST PATCH 1/4] proxy config: Factor out http_proxy_envsettings
No overall functional change, other than slight syntax changes to
generated shell runes.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
Osstest/TestSupport.pm | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 6ca8076..1cc09be 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -60,6 +60,7 @@ BEGIN {
target_putfilecontents_root_stash
target_put_guest_image target_editfile
target_editfile_cancel target_fetchurl
+ http_proxy_envsettings
target_editfile_root target_file_exists
target_editfile_kvp_replace
target_run_apt
@@ -625,15 +626,13 @@ sub target_cmd_build ($$$$) {
export CCACHE_PREFIX DISTCC_FALLBACK DISTCC_HOSTS
END
- my $httpproxy = defined($c{HttpProxy}) ? <<END : "";
- http_proxy=$c{HttpProxy}
- export http_proxy
-END
+ my $httpproxy = http_proxy_envsetting($ho);
- target_cmd($ho, <<END.$distcc.$httpproxy.<<END.$script, $timeout);
+ target_cmd($ho, <<END.$distcc.<<END.$script, $timeout);
set -xe
LC_ALL=C; export LC_ALL
PATH=/usr/lib/ccache:\$PATH:/usr/lib/git-core
+ $httpproxy
END
exec </dev/null
cd $builddir
@@ -1880,12 +1879,23 @@ END
sub target_fetchurl($$$;$) {
my ($ho, $url, $path, $timeo) = @_;
$timeo ||= 2000;
- my $useproxy = $c{HttpProxy} ? "export http_proxy=$c{HttpProxy};" : "";
+ my $useproxy = http_proxy_envsettings($ho);
target_cmd_root($ho, <<END, $timeo);
$useproxy wget --progress=dot:mega -O \Q$path\E \Q$url\E
END
}
+sub http_proxy_envsettings ($) {
+ # returns sh script fragment ending in ;
+ my ($ho) = @_;
+ my $proxy = $c{HttpProxy};
+ return unless $proxy;
+ my @script;
+ foreach my $var (qw(http_proxy)) {
+ push @script, "http_proxy=$proxy", "export http_proxy";
+ }
+ return (join '; ', @script).';';
+}
sub target_put_guest_image ($$;$) {
my ($ho, $gho, $default) = @_;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |