[devscripts] 01/01: hrefdecode
Osamu Aoki
osamu at moszumanska.debian.org
Fri Jan 12 16:45:56 UTC 2018
This is an automated email from the git hooks/post-receive script.
osamu pushed a commit to branch master
in repository devscripts.
commit 646d7a8aa0c96300932876d7b27d566e43fba3d9
Author: Osamu Aoki <osamu at debian.org>
Date: Sat Jan 13 00:06:46 2018 +0900
hrefdecode
This option enables decoding of percent-encoding on the href string
Bug#884604: devscripts: [uscan] please support hexadecimal encoded URLs
Tested with watch file:
---
version=4
opts="hrefdecode=percent-encoding, \
filenamemangle=s/.*dl_class_([\d.]+)\.tar\.gz/dl-poly-classic-$1\.tar\.gz/" \
https://ccpforge.cse.rl.ac.uk/gf/project/dl_poly_classic/frs/ \
/gf/download/frsrelease/\d+/\d+/dl_class_([\d.]+)\.tar\.gz
---
Signed-off-by: Osamu Aoki <osamu at debian.org>
Signed-off-by: Osamu Aoki <osamu at debian.org>
---
debian/changelog | 1 +
scripts/uscan.pl | 22 +++++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 60454c1..47b1734 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,7 @@ devscripts (2.18.1) UNRELEASED; urgency=medium
[ Osamu Aoki ]
* uupdate: bash completion fix by Julian Gilbey. Closes: #834006
* uscan: clarify importance of version=4. Closes: #884880
+ * uscan: add hrefdecode option. Closes: #884604
-- Mattia Rizzolo <mattia at debian.org> Wed, 03 Jan 2018 14:31:54 +0100
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 1377b85..ddf2c76 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -475,10 +475,17 @@ Substitution such as B<s/PRE/~pre/; s/RC/~rc/> may help.
Syntactic shorthand for B<uversionmangle=>I<rules>B<, dversionmangle=>I<rules>
+=item B<hrefdecode=percent-encoding>
+
+Convert the selected upstream tarball href string from the percent-encoded
+hexadecimal string to the decoded normal URL string for obfuscated web sites.
+Only B<percent-encoding> is available and it is decoded with
+B<s/%([A-Fa-f\d]{2})/chr hex $1/eg>.
+
=item B<downloadurlmangle=>I<rules>
Convert the selected upstream tarball href string into the accessible URL for
-obfuscated web sites.
+obfuscated web sites. This is run after B<hrefdecode>.
=item B<filenamemangle=>I<rules>
@@ -2575,6 +2582,8 @@ sub process_watchline ($$$$$$)
} elsif ($opt =~ /^\s*versionmangle\s*=\s*(.+?)\s*$/) {
@{$options{'uversionmangle'}} = split /;/, $1;
@{$options{'dversionmangle'}} = split /;/, $1;
+ } elsif ($opt =~ /^\s*hrefdecode\s*=\s*(.+?)\s*$/) {
+ $options{'hrefdecode'} = $1;
} elsif ($opt =~ /^\s*downloadurlmangle\s*=\s*(.+?)\s*$/) {
@{$options{'downloadurlmangle'}} = split /;/, $1;
} elsif ($opt =~ /^\s*filenamemangle\s*=\s*(.+?)\s*$/) {
@@ -2845,6 +2854,7 @@ sub process_watchline ($$$$$$)
my $match = '';
# Start Checking $site and look for $filepattern which is newer than $lastversion
+ uscan_debug "Start Checking $site and look for $filepattern which is newer than $lastversion.\n";
# What is the most recent file, based on the filenames?
# We first have to find the candidates, then we sort them using
# Devscripts::Versort::upstream_versort (if it is real upstream version string) or
@@ -3001,6 +3011,16 @@ sub process_watchline ($$$$$$)
my $mangled_version;
$href =~ s/\n//g;
$href = fix_href($href);
+ if (exists $options{'hrefdecode'}) {
+ if ($options{'hrefdecode'} eq 'percent-encoding') {
+ uscan_debug "... Decoding from href: $href\n";
+ $href =~ s/%([A-Fa-f\d]{2})/chr hex $1/eg ;
+ } else {
+ uscan_warn "Illegal value for hrefdecode: "
+ . "$options{'hrefdecode'}\n";
+ return 1;
+ }
+ }
uscan_debug "Checking href $href\n";
foreach my $_pattern (@patterns) {
if ($href =~ m&^$_pattern$&) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list