r20259 - /scripts/qa/DebianQA/Svn.pm

tincho at users.alioth.debian.org tincho at users.alioth.debian.org
Wed May 21 21:28:44 UTC 2008


Author: tincho
Date: Wed May 21 21:28:44 2008
New Revision: 20259

URL: http://svn.debian.org/wsvn/?sc=1&rev=20259
Log:
Add support for scanning patches/ directories

Modified:
    scripts/qa/DebianQA/Svn.pm

Modified: scripts/qa/DebianQA/Svn.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/Svn.pm?rev=20259&op=diff
==============================================================================
--- scripts/qa/DebianQA/Svn.pm (original)
+++ scripts/qa/DebianQA/Svn.pm Wed May 21 21:28:44 2008
@@ -225,7 +225,7 @@
                 "HEAD", 1, 1, sub {
                     foreach (keys %{$_[0]}) {
                         debug("Changed path: $_");
-                        $changed{$1} = 1 if(m{^\Q$prepath\E/(.*?)\Q$postpath\E/debian/(changelog|control|watch)$});
+                        $changed{$1} = 1 if(m{^\Q$prepath\E/(.*?)\Q$postpath\E/debian/(?:(?:changelog|control|watch)$|patches/[^/]+$)});
                     }
                 });
             unless($ret) {
@@ -390,6 +390,64 @@
                 grep(defined, map({ $_->{mangled_ver} } @$watch)));
             $svn{$dir}{mangled_un_ver} = $versions[-1];
         }
+
+        info("Retrieving patches for $dir");
+        my $patches = safe_svn_op($svn, ls => "$debdir/patches", 'HEAD', 0);
+        if(ref $patches) {
+            my @patches = grep({ $patches->{$_}->kind() == $SVN::Node::file }
+                keys(%$patches));
+            info(scalar @patches, " files in patches/ dir");
+            my $ptype;
+            my $series = "";
+            foreach(@patches) {
+                if($_ eq "series") {
+                    $ptype = "quilt";
+                    debug("Reading quilt series file");
+                    $series = get_svn_file($svn, "$debdir/patches/series");
+                    $series =~ s/(^|\s+)#.*$//mg;
+                    last;
+                } elsif(/^00list/) {
+                    $ptype = "dpatch";
+                    debug("Reading dpatch series file");
+                    my $s = get_svn_file($svn, "$debdir/patches/$_");
+                    # NOTE that this doesn't support CPP-processed lists
+                    $s =~ s/^#.*$//mg;
+                    $series .= $s;
+                }
+            }
+            if($ptype) {
+                $svn{$dir}{patchsys} = $ptype;
+                $svn{$dir}{patches} = [];
+            } else {
+                warn("Cannot detect patch system for $dir -- ",
+                    "asuming simple-patchsys");
+                $svn{$dir}{patchsys} = "simple-patchsys";
+                $svn{$dir}{patches} = [ map({ "debian/patches/$_" } @patches) ];
+                $series = ""; # make next foreach pass-by
+            }
+            foreach(split(/\n+/, $series)) {
+                next unless $_;
+                my $p;
+                if($ptype eq "quilt") {
+                    $p = "patches/$_";
+                } elsif($ptype eq "dpatch") {
+                    $p = "patches/$_";
+                    unless(safe_svn_op($svn, "ls", "$debdir/$p", 'HEAD', 0)) {
+                        $p .= ".dpatch";
+                    }
+                } else {
+                    next;
+                }
+                # FIXME: do something useful with this
+                if(safe_svn_op($svn, "ls", "$debdir/$p", 'HEAD', 0)) {
+                    push @{$svn{$dir}{patches}}, "debian/$p";
+                } else {
+                    $svn{$dir}{patcherr} = "missing_file";
+                    warn("Patchfile $p cannot be found in $dir");
+                }
+            }
+            info(scalar @{$svn{$dir}{patches} || []}, " patches found");
+        }
     }
     return(\%svn, @changed);
 }




More information about the Pkg-perl-cvs-commits mailing list