r8853 - /scripts/qa/QA/Svn.pm

tincho-guest at users.alioth.debian.org tincho-guest at users.alioth.debian.org
Sun Nov 4 18:47:27 UTC 2007


Author: tincho-guest
Date: Sun Nov  4 18:47:27 2007
New Revision: 8853

URL: http://svn.debian.org/wsvn/?sc=1&rev=8853
Log:
A couple of helper routines added

Modified:
    scripts/qa/QA/Svn.pm

Modified: scripts/qa/QA/Svn.pm
URL: http://svn.debian.org/wsvn/scripts/qa/QA/Svn.pm?rev=8853&op=diff
==============================================================================
--- scripts/qa/QA/Svn.pm (original)
+++ scripts/qa/QA/Svn.pm Sun Nov  4 18:47:27 2007
@@ -15,7 +15,9 @@
 use warnings;
 
 our @ISA = "Exporter";
-our @EXPORT = qw(svn_download svn_get svn_get_consolidated);
+our @EXPORT = (qw(
+    svn_download svn_get svn_get_consolidated svndir2pkgname pkgname2svndir
+    ));
 
 use IO::Scalar;
 use Digest::MD5 "md5_hex";
@@ -161,11 +163,29 @@
     return $cdata;
 }
 # Returns the consolidated hash of svn info. Doesn't download anything.
-sub svn_get_consolidated {
+sub svn_get_consolidated() {
     return read_cache("consolidated", "svn", 0);
 }
-sub svn_get {
+# Returns the hash of svn info. Doesn't download anything.
+sub svn_get() {
     return read_cache("svn", "", 0);
+}
+# Searches the source package name given a svn directory name
+# Returns undef if not found
+sub svndir2pkgname($) {
+    my $dir = shift;
+    my $data = read_cache("svn", $dir, 0);
+    return $data->{pkgname};
+}
+# Searches the svn directory name given a source package name
+# Returns undef if not found
+sub pkgname2svndir($) {
+    my $pkg = shift;
+    my $data = read_cache("svn", "", 0);
+    my @dirs = grep({ ref $data->{$_} and $data->{$_}{pkgname} and
+            $data->{$_}{pkgname} eq $pkg } keys %$data);
+    return $dirs[0] if(@dirs);
+    return undef;
 }
 # Parses watchfile, returns an arrayref containing one element for each source,
 # consisting of the URL spec, an MD5 sum of the line (to detect changes from




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