Sunday, January 14, 2007

apt-cacher

Damn! Write a patch to a debian package apt-cacher only to find out that latest version from Etch already support the functionality I need. (g)

though publish the patch here (only to base app, not to the package itself), in case I (or anybody) will need it in Woody.



diff -u apt-cacher.orig/apt-cacher.pl apt-cacher/apt-cacher.pl
--- apt-cacher.orig/apt-cacher.pl 2005-07-30 17:03:00.000000000 +0400
+++ apt-cacher/apt-cacher.pl 2007-01-14 17:00:49.000000000 +0300
@@ -683,7 +683,8 @@

sub usage_error {
print STDERR "--- apt-cacher.pl:Usage error\n";
-
+ my $is_proxy_user = "no";
+ $is_proxy_user = "yes" if ($config{proxy_user});
print <<EOF;
Content-Type: text/html
Expires: 0
@@ -723,6 +724,7 @@
<tr bgcolor="cccccc"><td bgcolor="ccccff"> errorfile </td><td> $config{errorfile} </td></tr>
<tr bgcolor="cccccc"><td bgcolor="ccccff"> expire_hours </td><td> $config{expire_hours} </td></tr>
<tr bgcolor="cccccc"><td bgcolor="ccccff"> http_proxy </td><td> $config{http_proxy} </td></tr>
+<tr bgcolor="cccccc"><td bgcolor="ccccff"> proxy_user </td><td> $is_proxy_user </td></tr>
<tr bgcolor="cccccc"><td bgcolor="ccccff"> use_proxy </td><td> $config{use_proxy} </td></tr>
<tr bgcolor="cccccc"><td bgcolor="ccccff"> debug </td><td> $config{debug} </td></tr>
</table>
@@ -781,6 +783,9 @@
# Check whether a proxy is to be used, and set the appropriate environment variable
if ( $config{use_proxy} eq 1 && $config{http_proxy}) {
push(@elist, "-x", "http://$config{http_proxy}");
+ if ($config{proxy_user}) {
+ push(@elist, "-U", "$config{proxy_user}");
+ }
}
# Check if we need to set a rate limiting value: otherwise make it null
push(@elist,"--limit-rate", $config{limit}) if ($config{limit} > 0);



apt-cacher is a proxy for apt, that allows upgrading many debian boxes through one caching 'proxy'.

No comments:

Denis Dzyubenko shadone