[Piuparts-commits] [SCM] piuparts git repository branch, piatti, updated. 0.49-117-g7e3aa5d
Andreas Beckmann
anbe at debian.org
Sun Mar 3 09:33:13 UTC 2013
The following commit has been merged in the piatti branch:
commit 304620d7e0cc8ddc8316bf6655ebb13d5dfff600
Author: Andreas Beckmann <anbe at debian.org>
Date: Sat Mar 2 14:31:10 2013 +0100
p: add --proxy option
retaining the http_proxy variable through sudo is difficult
switch from using HTTP_PROXY to http_proxy
Signed-off-by: Andreas Beckmann <anbe at debian.org>
diff --git a/debian/changelog b/debian/changelog
index b5ba7a8..56cd2f3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,7 @@ piuparts (0.50) UNRELEASED; urgency=low
prepend/append "deb", "file://", and "./" as needed.
- Improve the "dirname part contains a symlink" test and report
overwritten files owned by other packages as failures.
+ - Add --proxy=URL option.
* piuparts.conf:
- New global settings:
+ proxy
@@ -45,7 +46,8 @@ piuparts (0.50) UNRELEASED; urgency=low
(piuparts.conf global setting slave-load-max) is exceeded. Operation
will be resumed after load drops below 'slave-load-max - 1.0'. Disabled
by default.
- - Use piuparts.conf global proxy setting as http_proxy.
+ - Use piuparts.conf global proxy setting as http_proxy and pass it to
+ piuparts via --proxy.
- Use distros.conf to compute URLs.
* piuparts-analyze.py:
- Add support for magic "$DISTRO/None" versions.
diff --git a/piuparts-slave.py b/piuparts-slave.py
index f3353ce..1be4bbf 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -670,6 +670,8 @@ def test_package(config, pname, pvers, packages_files):
base_command = config["piuparts-command"].split()
if config["piuparts-flags"]:
base_command.extend(config["piuparts-flags"].split())
+ if "http_proxy" in os.environ:
+ base_command.extend(["--proxy", os.environ["http_proxy"]])
if config["mirror"]:
base_command.extend(["--mirror", config["mirror"]])
if config["tmpdir"]:
@@ -789,6 +791,8 @@ def create_chroot(config, tarball, distro):
command = config["piuparts-command"].split()
if config["piuparts-flags"]:
command.extend(config["piuparts-flags"].split())
+ if "http_proxy" in os.environ:
+ command.extend(["--proxy", os.environ["http_proxy"]])
if config["mirror"]:
command.extend(["--mirror", config["mirror"]])
if config["tmpdir"]:
diff --git a/piuparts.1.txt b/piuparts.1.txt
index 456b48c..b3d2618 100644
--- a/piuparts.1.txt
+++ b/piuparts.1.txt
@@ -161,6 +161,12 @@ Note that file: addresses works if the directories are made accessible from with
*--pedantic-purge-test*::
Be pedantic when checking if a purged package leaves files behind. If this option is not set, files left in _/tmp_ are ignored.")
+*--proxy='URL'*::
+ Use the proxy at URL to access the Debian mirror(s). Takes precedence over
+ the 'http_proxy' environment variable. Using a local proxy is recommended
+ because piuparts may use large amounts of bandwidth to repeatedly download
+ the same files.
+
*-s* 'filename', *--save*='filename'::
Save the chroot, after it has been set up, as a tarball into _filename_. It can then be used with '-b'.
diff --git a/piuparts.py b/piuparts.py
index 8a57033..fd3a353 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -137,6 +137,7 @@ class Settings:
self.single_changes_list = False
self.args_are_package_files = True
# distro setup
+ self.proxy = None
self.debian_mirrors = []
self.extra_repos = []
self.testdebs_repo = None
@@ -947,8 +948,10 @@ class Chroot:
lines.append('APT::Install-Recommends "%d";\n' % int(settings.install_recommends))
lines.append('APT::Install-Suggests "0";\n')
lines.append('APT::Get::AllowUnauthenticated "%s";\n' % settings.apt_unauthenticated)
- if "HTTP_PROXY" in os.environ:
- proxy = os.environ["HTTP_PROXY"]
+ if settings.proxy:
+ proxy = settings.proxy
+ elif "http_proxy" in os.environ:
+ proxy = os.environ["http_proxy"]
else:
proxy = None;
pat = re.compile(r"^Acquire::http::Proxy\s+\"([^\"]+)\"", re.I);
@@ -2640,6 +2643,9 @@ def parse_command_line():
action="store_true", default=False,
help="Be pedantic when checking if a purged package leaves files behind. If this option is not set, files left in /tmp are ignored.")
+ parser.add_option("--proxy", metavar="URL",
+ help="Use the proxy at URL for accessing the mirrors.")
+
parser.add_option("-s", "--save", metavar="FILENAME",
help="Save the chroot into FILENAME.")
@@ -2721,6 +2727,9 @@ def parse_command_line():
settings.single_changes_list = opts.single_changes_list
settings.args_are_package_files = not opts.apt
# distro setup
+ settings.proxy = opts.proxy
+ if settings.proxy:
+ os.environ["http_proxy"] = settings.proxy
settings.debian_mirrors = [parse_mirror_spec(x, defaults.get_components())
for x in opts.mirror]
settings.extra_repos = opts.extra_repo
--
piuparts git repository
More information about the Piuparts-commits
mailing list