I have created and attached a patch which will allow you to define multiple alternatives for each fetch scheme in apt-file.conf, Before apt-file will try to use an alternative, apt-file searches in $PATH to see if the command exists and is executable, if it is not, it looks in the configuration file for the next alternative.
I changed the defualt apt-file.conf to have curl be prefered but wget to be a fallback, here is a snippet of my apt-file.conf: http = curl -I "<uri>/dists/<dist>/Contents-<arch>.gz" 2>&1 | grep '^HTTP.*404' > /dev/null || (curl -z "<cache>/<dest>" -R -o "<cache>/<dest>" "<uri>/di http2 = wget -N -P "<cache>" -O "<cache>/<dest>" "<uri>/dists/<dist>/Contents-<arch>.gz" || rm -f "<cache>/<dest>"; Hopefully this is an alternative to changing the Depends: line of the package that we can all agree on. -stew
diff -ru apt-file-2.0.6/apt-file apt-file-2.0.6.mine/apt-file
--- apt-file-2.0.6/apt-file 2005-05-05 12:00:12.000000000 -0400
+++ apt-file-2.0.6.mine/apt-file 2006-01-20 00:32:24.000000000 -0500
@@ -72,6 +72,33 @@
return $ret;
}
+# find_command
+# looks through the PATH environment variable for the command named by
+# $conf->{$scheme}, if that command doesn't exist, it will look for
+# $conf->{${scheme}2}, and so on until it runs out of configured
+# commands or an executable is found.
+#
+sub find_command
+{
+ my $conf = shift;
+ my $scheme = shift;
+
+ my $i = 1;
+ while(1)
+ {
+ my $key = $scheme;
+ $key = $key.$i if $i != 1;
+ return unless defined $conf->{$key};
+ my $cmd = $conf->{$key};
+ $cmd =~ s/ .*//;
+ for my $path (split( /:/,$ENV{'PATH'}))
+ {
+ return $conf->{$key} if -x ( $path.'/'.$cmd );
+ }
+ $i = $i+1;
+ }
+}
+
sub parse_sources_list($) {
my $file = shift;
my $uri;
@@ -137,7 +164,9 @@
next;
}
$dist = $_;
- $cmd = $Conf->{"${scheme}"};
+ $cmd = find_command( $Conf, $scheme );
+# $cmd = $Conf->{"${scheme}"};
+ die "Could not find suitable command for $scheme" unless $cmd;
$dest = $Conf->{destination};
my $cache = $Conf->{cache};
my $arch = $Conf->{arch};
diff -ru apt-file-2.0.6/apt-file.conf apt-file-2.0.6.mine/apt-file.conf
--- apt-file-2.0.6/apt-file.conf 2005-05-09 09:04:36.000000000 -0400
+++ apt-file-2.0.6.mine/apt-file.conf 2006-01-20 00:17:57.000000000 -0500
@@ -19,8 +19,8 @@
ftp = curl --ftp-pasv -I "<uri>/dists/<dist>/Contents-<arch>.gz" 2>&1 | grep '^Content-Length:' > /dev/null && (curl --ftp-pasv -z "<cache>/<dest>" -R -o "<cache>/<dest>" "<uri>/dists/<dist>/Contents-<arch>.gz" && chmod 644 "<cache>/<dest>")
# If you prefere wget uncomment following
-#http = wget -N -P "<cache>" -O "<cache>/<dest>" "<uri>/dists/<dist>/Contents-<arch>.gz" || rm -f "<cache>/<dest>";
-#ftp = wget -N --passive-ftp -P "<cache>" -O "<cache>/<dest>" "<uri>/dists/<dist>/Contents-<arch>.gz" || rm -f "<cache>/<dest>"
+http2 = wget -N -P "<cache>" -O "<cache>/<dest>" "<uri>/dists/<dist>/Contents-<arch>.gz" || rm -f "<cache>/<dest>";
+ftp2 = wget -N --passive-ftp -P "<cache>" -O "<cache>/<dest>" "<uri>/dists/<dist>/Contents-<arch>.gz" || rm -f "<cache>/<dest>"
ssh = scp -l <user> -P <port|22> "<host>:/<path>/dists/<dist>/Contents-<arch>.gz" "<cache>/<dest>" && chmod 644 "<cache>/<dest>"
rsh = rcp -l <user> "<host>:/<path>/dists/<dist>/Contents-<arch>.gz" "<cache>/<dest>" && chmod 644 "<cache>/<dest>"
signature.asc
Description: This is a digitally signed message part

