Package: devscripts
Version: 2.10.57
Severity: wishlist
File: /usr/bin/uscan
Tags: patch

Hello,

upstream ( http://ktorrent.org/downloads/ ) uses directory structure based on
released versions. Therefore, beta/rc releases need mangling (e.g. 3.3rc1 to
3.3~rc1) in order to be not prefered over stable releases (e.g. 3.3).

Therefore, I propose to support dirversionmangle option. The patch attached. I
hope I didn't miss anything, code is kind of duplicated in a couple of places.
Whether to add it to meta 'versionmangle', it is up to you.

-- Package-specific info:

--- /etc/devscripts.conf ---
DEBSIGN_MAINT="Modestas Vainius"
DEBCHANGE_RELEASE_HEURISTIC=changelog
DEBCHANGE_MULTIMAINT_MERGE=yes
DEBCHANGE_MAINTTRAILER=yes

--- ~/.devscripts ---
Not present

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.31-1-amd64 (SMP w/1 CPU core)
Locale: LANG=lt_LT.UTF-8, LC_CTYPE=lt_LT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages devscripts depends on:
ii  dpkg-dev                      1.15.5.2   Debian package development tools
ii  libc6                         2.10.1-7   GNU C Library: Shared libraries
ii  perl                          5.10.1-8   Larry Wall's Practical Extraction 

Versions of packages devscripts recommends:
ii  at                 3.1.11-1              Delayed job execution and batch pr
ii  bsd-mailx [mailx]  8.1.2-0.20090911cvs-2 simple mail user agent
ii  bzr                2.0.2-1               easy to use distributed version co
ii  curl               7.19.7-1              Get a file from an HTTP, HTTPS or 
ii  cvs                1:1.12.13-12          Concurrent Versions System
ii  dctrl-tools        2.13.1                Command-line tools to process Debi
pn  debian-keyring     <none>                (no description available)
pn  debian-maintainers <none>                (no description available)
ii  dput               0.9.5.1               Debian package upload tool
ii  dupload            2.6.6                 utility to upload Debian packages
ii  equivs             2.0.7-0.1             Circumvent Debian package dependen
ii  fakeroot           1.14.4-1              Gives a fake root environment
ii  git-core           1:1.6.5.3-1           fast, scalable, distributed revisi
ii  gnupg              1.4.10-2              GNU privacy guard - a free PGP rep
ii  iceweasel [www-bro 3.5.5-1               lightweight web browser based on M
ii  konqueror [www-bro 4:4.3.3-0r1           KDE 4's advanced file manager, web
pn  libauthen-sasl-per <none>                (no description available)
ii  libcrypt-ssleay-pe 0.57-2                Support for https protocol in LWP
ii  libparse-debcontro 2.005-2               Easy OO parsing of Debian control-
ii  libsoap-lite-perl  0.710.10-1            Perl implementation of a SOAP clie
pn  libterm-size-perl  <none>                (no description available)
ii  libtimedate-perl   1.1900-1              Time and date functions for Perl
ii  liburi-perl        1.37+dfsg-1           Manipulates and accesses URI strin
ii  libwww-perl        5.833-1               Perl HTTP/WWW client/server librar
pn  libyaml-syck-perl  <none>                (no description available)
ii  links [www-browser 2.2-1+b1              Web browser running in text mode
ii  links2 [www-browse 2.2-1+b1              Web browser running in both graphi
ii  lintian            2.2.18                Debian package checker
ii  lsb-release        3.2-23                Linux Standard Base version report
ii  lynx-cur [www-brow 2.8.8dev.1-1          Text-mode WWW Browser with NLS sup
ii  lzma               4.43-14               Compression method of 7z format in
ii  mailx              1:20081101-2          Transitional package for mailx ren
ii  man-db             2.5.6-4               on-line manual pager
ii  openssh-client [ss 1:5.1p1-8             secure shell client, an rlogin/rsh
ii  patch              2.5.9-5               Apply a diff file to an original
ii  patchutils         0.3.1-2               Utilities to work with patches
ii  sensible-utils     0.0.1                 Utilities for sensible alternative
ii  strace             4.5.19-1              A system call tracer
ii  subversion         1.6.6dfsg-1           Advanced version control system
ii  unzip              6.0-1                 De-archiver for .zip files
ii  w3m [www-browser]  0.5.2-2.1             WWW browsable pager with excellent
pn  wdiff              <none>                (no description available)
ii  wget               1.12-1.1              retrieves files from the web

Versions of packages devscripts suggests:
ii  build-essential               11.4       Informational list of build-essent
pn  cvs-buildpackage              <none>     (no description available)
pn  devscripts-el                 <none>     (no description available)
pn  gnuplot                       <none>     (no description available)
pn  libfile-desktopentry-perl     <none>     (no description available)
pn  libnet-smtp-ssl-perl          <none>     (no description available)
ii  mutt                          1.5.20-4   text-based mailreader supporting M
pn  svn-buildpackage              <none>     (no description available)
ii  w3m                           0.5.2-2.1  WWW browsable pager with excellent

-- no debconf information
--- uscan.orig  2009-11-24 01:52:15.000000000 +0200
+++ uscan       2009-11-24 12:01:49.000000000 +0200
@@ -765,6 +765,9 @@
                elsif ($opt =~ /^filenamemangle\s*=\s*(.+)/) {
                    @{$options{'filenamemangle'}} = split /;/, $1;
                }
+               elsif ($opt =~ /^dirversionmangle\s*=\s*(.+)/) {
+                   @{$options{'dirversionmangle'}} = split /;/, $1;
+               }
                elsif ($opt =~ /^downloadurlmangle\s*=\s*(.+)/) {
                    @{$options{'downloadurlmangle'}} = split /;/, $1;
                }
@@ -1553,6 +1556,15 @@
            my $href = $2;
            if ($href =~ m&^$dirpattern/?$&) {
                my $mangled_version = join(".", $href =~ m&^$dirpattern/?$&);
+               foreach my $pat (@{$optref->{'dirversionmangle'}}) {
+                   if (! safe_replace(\$mangled_version, $pat)) {
+                       warn "$progname: In $watchfile, potentially"
+                        . " unsafe or malformed dirversionmangle"
+                         . " pattern:\n  '$pat'"
+                         . " found.\n";
+                       return 1;
+                   }
+               }
                push @hrefs, [$mangled_version, $href];
            }
        }
@@ -1560,7 +1572,7 @@
            @hrefs = Devscripts::Versort::versort(@hrefs);
            if ($debug) {
                print "-- Found the following matching hrefs (newest first):\n";
-               foreach my $href (@hrefs) { print "     $$href[1]\n"; }
+               foreach my $href (@hrefs) { print "     $$href[1] (version 
$$href[0])\n"; }
            }
            my $newdir = $hrefs[0][1];
            # just give the final directory component
@@ -1611,6 +1623,15 @@
                m/(?:<\s*a\s+[^>]*href\s*=\s*\")((?-i)$pattern)\"/gi) {
                my $dir = $1;
                my $mangled_version = join(".", $dir =~ m/^$pattern$/);
+               foreach my $pat (@{$optref->{'dirversionmangle'}}) {
+                   if (! safe_replace(\$mangled_version, $pat)) {
+                       warn "$progname: In $watchfile, potentially"
+                        . " unsafe or malformed dirversionmangle"
+                         . " pattern:\n  '$pat'"
+                         . " found.\n";
+                       return 1;
+                   }
+               }
                push @dirs, [$mangled_version, $dir];
            }
        } else {
@@ -1619,13 +1640,22 @@
            while ($content =~ m/($pattern)(\s+->\s+\S+)?$/mg) {
                my $dir = $1;
                my $mangled_version = join(".", $dir =~ m/^$pattern$/);
+               foreach my $pat (@{$optref->{'dirversionmangle'}}) {
+                   if (! safe_replace(\$mangled_version, $pat)) {
+                       warn "$progname: In $watchfile, potentially"
+                        . " unsafe or malformed dirversionmangle"
+                         . " pattern:\n  '$pat'"
+                         . " found.\n";
+                       return 1;
+                   }
+               }
                push @dirs, [$mangled_version, $dir];
            }
        }           
        if (@dirs) {
            if ($debug) {
                print STDERR "-- Found the following matching dirs:\n";
-               foreach my $dir (@dirs) { print STDERR "     $$dir[1]\n"; }
+               foreach my $dir (@dirs) { print STDERR "     $$dir[1] (version 
$$dir[0])\n"; }
            }
            @dirs = Devscripts::Versort::versort(@dirs);
            my ($newversion, $newdir) = @{$dirs[0]};

Reply via email to