[libconfig-model-dpkg-perl] 02/08: skip non dep-3 patches with -force option

dod at debian.org dod at debian.org
Sun Jun 15 12:43:46 UTC 2014


This is an automated email from the git hooks/post-receive script.

dod pushed a commit to annotated tag debian/2.049
in repository libconfig-model-dpkg-perl.

commit c5190d50419c654c3d9c5bbafdf4f1367d00d316
Author: Dominique Dumont <dod at debian.org>
Date:   Mon Jun 2 16:47:29 2014 +0200

    skip non dep-3 patches with -force option
---
 lib/Config/Model/Backend/Dpkg.pm | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/lib/Config/Model/Backend/Dpkg.pm b/lib/Config/Model/Backend/Dpkg.pm
index 7001b53..82ae0b0 100644
--- a/lib/Config/Model/Backend/Dpkg.pm
+++ b/lib/Config/Model/Backend/Dpkg.pm
@@ -18,7 +18,7 @@ sub read_hash {
         my $patch_dir = $args->{root} . $args->{config_dir} . "patches";
         $logger->info("Checking patches directory ($patch_dir)");
 
-        $self->read_patch_series( $obj, $check, $patch_dir );
+        $self->read_patch_series( $obj, $check, $patch_dir, $args );
     }
     else {
         $self->SUPER::read_hash(@_);
@@ -26,7 +26,7 @@ sub read_hash {
 }
 
 sub read_patch_series {
-    my ( $self, $hash, $check, $patch_dir ) = @_;
+    my ( $self, $hash, $check, $patch_dir, $args ) = @_;
 
     my $series_files = "$patch_dir/series";
 
@@ -49,9 +49,25 @@ sub read_patch_series {
 		$pname =~ s/#.*//; # skip comment
         next unless $pname =~ /\w/;    # skip empty lines
         my $obj = $hash->fetch_with_id($pname);
-        $obj->init;
-        my $location = $obj->name;
-        $logger->info("found patch $pname, stored in $location ($obj)");
+        eval { $obj->init; };
+        my $e;
+        if ($e = Exception::Class->caught('Config::Model::Exception::Syntax')) {
+            if ( $args->{check} eq 'yes' ) {
+                my $msg = $e ->message. ". Use -force option to override" ;
+                ref($e) -> throw(message => $msg);
+            }
+            else {
+                warn "Warning: Ignoring patch $pname: ", $e->message,"\n";
+            }
+            $hash->delete($pname);
+        }
+        elsif ( $e = Exception::Class->caught() ) {
+            ref $e ? $e->rethrow : die $e;
+        }
+        elsif ($logger->is_info) {
+            my $location = $obj->name;
+            $logger->info("found patch $pname, stored in $location ($obj)");
+        }
     }
 
     $ser_io->close;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git



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