Author: adsb
Date: 2008-12-05 14:34:43 +0000 (Fri, 05 Dec 2008)
New Revision: 1752
Modified:
trunk/debian/changelog
trunk/scripts/uscan.pl
Log:
* uscan:
+ Be more intelligent with redirects and relative filenames. This should
help in situations where the watchfile contains http://example.com/foo
which is a redirect to http://example.com/foo/, with the latter
containing relative filenames.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2008-12-03 21:02:13 UTC (rev 1751)
+++ trunk/debian/changelog 2008-12-05 14:34:43 UTC (rev 1752)
@@ -14,9 +14,14 @@
process ID. (Closes: #507482)
+ Use temporary files rather than redirecting gpg's stdin and stdout,
enabling the use of pinentry-gtk2. (Closes: #507479)
- * uscan: Remove the downloads.sourceforge.net example from the manpage.
- It no longer works due to changes in the website structure. Thanks,
- Alexander Block.
+ * uscan:
+ + Remove the downloads.sourceforge.net example from the manpage.
+ It no longer works due to changes in the website structure. Thanks,
+ Alexander Block.
+ + Be more intelligent with redirects and relative filenames. This should
+ help in situations where the watchfile contains http://example.com/foo
+ which is a redirect to http://example.com/foo/, with the latter
+ containing relative filenames.
* uupdate: Use mktemp rather than a temporary directory name based on
the process ID.
Modified: trunk/scripts/uscan.pl
===================================================================
--- trunk/scripts/uscan.pl 2008-12-03 21:02:13 UTC (rev 1751)
+++ trunk/scripts/uscan.pl 2008-12-05 14:34:43 UTC (rev 1752)
@@ -680,7 +680,8 @@
my $origline = $line;
my ($base, $site, $dir, $filepattern, $pattern, $lastversion, $action);
- my (@patterns, @sites, @redirections);
+ my $basedir;
+ my (@patterns, @sites, @redirections, @basedirs);
my %options = ();
my ($request, $response);
@@ -811,7 +812,7 @@
# We're going to make the pattern
# (?:(?:http://site.name)?/dir/path/)?base_pattern
# It's fine even for ftp sites
- my $basedir = $base;
+ $basedir = $base;
$basedir =~ s%^\w+://[^/]+/%/%;
$pattern = "(?:(?:$site)?" . quotemeta($basedir) . ")?$filepattern";
}
@@ -824,6 +825,7 @@
push @patterns, $pattern;
push @sites, $site;
+ push @basedirs, $basedir;
# What is the most recent file, based on the filenames?
# We first have to find the candidates, then we sort them using
@@ -854,6 +856,7 @@
push @patterns, "(?:(?:$base_site)?" . quotemeta($base_dir) .
")?$filepattern";
push @sites, $base_site;
+ push @basedirs, $base_dir;
# remove the filename, if any
my $base_dir_orig = $base_dir;
@@ -861,6 +864,7 @@
if ($base_dir ne $base_dir_orig) {
push @patterns, "(?:(?:$base_site)?" . quotemeta($base_dir)
. ")?$filepattern";
push @sites, $base_site;
+ push @basedirs, $base_dir;
}
}
}
@@ -1097,7 +1101,28 @@
}
# relative filename, we hope
else {
- $upstream_url = "$urlbase$newfile";
+ # Were there any redirections? If so try using those first
+ if ($#patterns > 0) {
+ # replace $site here with the one we were redirected to
+ foreach my $index (0 .. $#patterns) {
+ # skip unless the basedir looks like a directory
+ next unless $basedirs[$index] =~ m%/$%;
+ my $nf = "$basedirs[$index]$newfile";
+ if ("$sites[$index]$nf" =~ m&^$patterns[$index]$&) {
+ $upstream_url = "$sites[$index]$nf";
+ last;
+ }
+ }
+ if (!defined($upstream_url)) {
+ if ($debug) {
+ warn "$progname warning: Unable to determine upstream
url from redirections,\n" .
+ "defaulting to using site specified in watchfile\n";
+ }
+ $upstream_url = "$urlbase$newfile";
+ }
+ } else {
+ $upstream_url = "$urlbase$newfile";
+ }
}
# mangle if necessary
--
To unsubscribe, send mail to [EMAIL PROTECTED]