Bug#775735: [PATCH] Parse sourceforge rss feeds, without sf.net redirector.
Dimitri John Ledkov
dimitri.j.ledkov at linux.intel.com
Mon Jan 19 11:48:48 UTC 2015
Package: devscripts
Version: 2.15.1
Tags: patch
Example watchfile:
version=3
http://sourceforge.net/projects/pcre/rss?limit=500 .*/pcre-(.*).tar.gz
uscan --report --watchfile watch --package pcre --upstream-version 8.36
Idea taken from "anitya" project.
Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov at linux.intel.com>
---
scripts/uscan.pl | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index bd1a851..c22719a 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -985,12 +985,21 @@ sub process_watchline ($$$$$$)
print STDERR "$progname debug: received content:\n$content\[End of received content]\n"
if $debug;
- if ($content =~ m%^<[?]xml%i &&
- $content =~ m%xmlns="http://s3.amazonaws.com/doc/2006-03-01/"%) {
- # this is an S3 bucket listing. Insert an 'a href' tag
- # into the content for each 'Key', so that it looks like html (LP: #798293)
- print STDERR "$progname debug: fixing s3 listing\n" if $debug;
- $content =~ s%<Key>([^<]*)</Key>%<Key><a href="$1">$1</a></Key>%g
+ if ($content =~ m%^<[?]xml%i) {
+
+ if ($content =~ m%xmlns="http://s3.amazonaws.com/doc/2006-03-01/"%) {
+ # this is an S3 bucket listing. Insert an 'a href' tag
+ # into the content for each 'Key', so that it looks like html (LP: #798293)
+ print STDERR "$progname debug: fixing s3 listing\n" if $debug;
+ $content =~ s%<Key>([^<]*)</Key>%<Key><a href="$1">$1</a></Key>%g
+ }
+
+ if ($content =~ m%xmlns:sf="https://sourceforge.net/api/sfelements.rdf#"%) {
+ # this is sourceforge.net xml listing. Insert an 'a href' tag
+ # into the content for each 'link', so that is looks like html
+ print STDERR "$progname debug: fixing sf listing\n" if $debug;
+ $content =~ s%<link>([^<]*)/download</link>%<link><a href="$1">$1</a></link>%g
+ }
}
# We need this horrid stuff to handle href=foo type
--
2.1.0
More information about the devscripts-devel
mailing list