r12764 - in /scripts/qa/DebianQA: Cache.pm Common.pm

tincho-guest at users.alioth.debian.org tincho-guest at users.alioth.debian.org
Tue Jan 15 12:07:48 UTC 2008


Author: tincho-guest
Date: Tue Jan 15 12:07:48 2008
New Revision: 12764

URL: http://svn.debian.org/wsvn/?sc=1&rev=12764
Log:
Support for versioned data files, when $DebianQA::Common::Version is bumped,
all files become stale until a complete update is done.

Modified:
    scripts/qa/DebianQA/Cache.pm
    scripts/qa/DebianQA/Common.pm

Modified: scripts/qa/DebianQA/Cache.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/Cache.pm?rev=12764&op=diff
==============================================================================
--- scripts/qa/DebianQA/Cache.pm (original)
+++ scripts/qa/DebianQA/Cache.pm Tue Jan 15 12:07:48 2008
@@ -163,6 +163,7 @@
             $root = ($root->{$leaf} = $data);
         }
         $root->{"/stamp"} = $stamp;
+        $root->{"/version"} = $VERSION;
     } else {
         $root = dive_hash($cdata, $root);
         foreach(keys(%$data)) {
@@ -202,11 +203,16 @@
 }
 # Search a stamp in $hash, starting at $path and going upwards until the
 # root. Returns 0 if not found.
+# Remember to call it with the root of the cache, to have proper stamp and
+# version handling.
 sub find_stamp {
     my($hash, $path) = @_;
     $path ||= "";
     debug("find_stamp($hash, $path) invoked");
     die "Invalid hashref" unless($hash and ref $hash and ref $hash eq "HASH");
+    if(! $hash->{"/version"} or $hash->{"/version"} < $VERSION) {
+        return 0;
+    }
     my $ctsmp = 0;
     if($path =~ s{^/*([^/]+)}{}) {
         my $root = $1;

Modified: scripts/qa/DebianQA/Common.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/Common.pm?rev=12764&op=diff
==============================================================================
--- scripts/qa/DebianQA/Common.pm (original)
+++ scripts/qa/DebianQA/Common.pm Tue Jan 15 12:07:48 2008
@@ -9,10 +9,13 @@
 package DebianQA::Common;
 use strict;
 use warnings;
+use version;
 
 our @ISA = "Exporter";
 our @EXPORT = qw(debug info warn error $VERSION);
-our $VERSION = sprintf "%d.%03d", q$Revision$ =~ /(\d+)/g;
+#our $VERSION = join(".", q$Revision$ =~ /(\d+)/g);
+# Bump this version in case of data file change
+our $VERSION = qv("1.000");
 
 use DebianQA::Config '%CFG';
 use POSIX;




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