Subject: Re: pkg RSS feed broken for pkgs with '-' in name
To: None <tech-pkg@NetBSD.org>
From: Klaus Heinz <k.heinz.mai.sieben@kh-22.de>
List: tech-pkg
Date: 05/17/2007 17:29:54
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hubert Feyrer wrote:
> The patch below fixes this, and also allows '/' in a few places that (i
> guess?) were forgotten last time. Results look good to me, but I'd
> appreciate feedback before committing.
A variation on your patch is appended.
The patterns for package names and versions are now variables, we only
have to define/change them once.
I chose to define a package name (package versions are essentially the
same) as a sequence of non-whitespace characters enclosed by at least one
leading and trailing whitespace character.
Since we do not really check correctness here (is it really the name of
an existing category or package? does the link we show really exist?)
we can accept this rather broad definition.
ciao
Klaus
--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=".diff"
Index: pkg-changes2rss
===================================================================
RCS file: /cvsroot/htutils/changes/pkg-changes2rss,v
retrieving revision 1.2
diff -u -r1.2 pkg-changes2rss
--- pkg-changes2rss 6 Aug 2006 09:43:46 -0000 1.2
+++ pkg-changes2rss 17 May 2007 15:28:11 -0000
@@ -16,18 +16,20 @@
my($msg) = @_;
my($name, $vers, $link, $found);
my($link, $entry);
+ my $pkgname_pattern=qr,\s+(\S+)\s+,o;
+ my $pkgversion_pattern=qr,\s+(\S+)\s+,o;
$link="http://www.NetBSD.org/Changes/pkg-changes.html";
$found=0;
- if ( $msg =~ /Added\s*([a-zA-Z0-9-.+_]*)\s/ ) {
+ if ( $msg =~ /[Aa]dd(?:e)?(?:d)?${pkgname_pattern}/ ) {
$name=$1;
$link="$pkgsrcbase/$name/README.html";
- } elsif ( $msg =~ /Updated?\s*([a-zA-Z0-9-.+_\/]*)\s*to\s*([a-zA-Z0-9-.+_]*)/
- or $msg =~ /Upgraded?\s*([a-zA-Z0-9-.+_\/]*)\s*to\s*([a-zA-Z0-9-.+_]*)/
- or $msg =~ /Downgraded?\s*([a-zA-Z0-9-.+_\/]*)\s*to\s*([a-zA-Z0-9-.+_]*)/ ) {
+ } elsif ( $msg =~ /[Uu]pdated?${pkgname_pattern}to${pkgversion_pattern}/
+ or $msg =~ /[Uu]pgraded?${pkgname_pattern}to${pkgversion_pattern}/
+ or $msg =~ /[Dd]owngraded?${pkgname_pattern}to${pkgversion_pattern}/ ) {
$name=$1;
$vers=$2;
@@ -35,9 +37,9 @@
$link="$pkgsrcbase/$name/README.html";
- } elsif ( $msg =~ /Replaced?\s*([a-zA-Z0-9-.+_\/]*)\s*with\s*([a-zA-Z0-9-.+_]*)/
- or $msg =~ /Moved?\s*([a-zA-Z0-9-.+_\/]*)\s*to\s*([a-zA-Z0-9-.+_]*)/
- or $msg =~ /Renamed?\s*([a-zA-Z0-9-.+_\/]*)\s*to\s*([a-zA-Z0-9-.+_]*)/ ) {
+ } elsif ( $msg =~ /[Rr]eplaced?${pkgname_pattern}with${pkgname_pattern}/
+ or $msg =~ /[Mm]oved?${pkgname_pattern}to${pkgname_pattern}/
+ or $msg =~ /[Rr]enamed?${pkgname_pattern}to${pkgname_pattern}/ ) {
$old=$1;
$name=$2;
$found++;
@@ -45,8 +47,8 @@
$link="$pkgsrcbase/$name/README.html";
} elsif ( $msg =~ m|^\s*([a-zA-Z0-9-._\/]*):| or
- $msg =~ /Deleted\s*([a-zA-Z0-9-.+_\/]*)\s/ or
- $msg =~ /Removed\s*([a-zA-Z0-9-.+_\/]*)\s/ ) {
+ $msg =~ /[Dd]eleted?${pkgname_pattern}/ or
+ $msg =~ /[Rr]emoved?${pkgname_pattern}/ ) {
# Default link
$word=$1;
--82I3+IH0IqGh5yIs--