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

dod pushed a commit to branch master
in repository libconfig-model-dpkg-perl.

commit 3044ff5d3117eb21d31a16ea3e8b2c92dc97ce84
Author: Dominique Dumont <d...@debian.org>
Date:   Wed Jul 6 20:51:00 2016 +0200

    delete files in debian/ once all data is removed
    
    Fix the following bug: debian/fix.scanned.copyright file was not
    deleted even when all data were cleared in fix.scanned.copyright
    element.
---
 lib/Config/Model/Backend/Dpkg.pm | 8 ++++++++
 lib/Config/Model/models/Dpkg.pl  | 1 +
 2 files changed, 9 insertions(+)

diff --git a/lib/Config/Model/Backend/Dpkg.pm b/lib/Config/Model/Backend/Dpkg.pm
index 1243c87..4c6617a 100644
--- a/lib/Config/Model/Backend/Dpkg.pm
+++ b/lib/Config/Model/Backend/Dpkg.pm
@@ -4,8 +4,10 @@ use Carp;
 use Mouse;
 use Config::Model::Exception;
 use UNIVERSAL;
+use Path::Tiny;
 use File::Path;
 use Log::Log4perl qw(get_logger :levels);
+use 5.10.1;
 
 extends 'Config::Model::Backend::PlainFile';
 
@@ -103,6 +105,7 @@ sub write {
         my $obj = $args{object}->fetch_element( name => $elt );
         my $type = $obj->get_type;
         my @v;
+        my $skip = 0;
 
         if ( $type eq 'leaf' ) {
             my $lv = $obj->fetch( check => $args{check} );
@@ -115,6 +118,7 @@ sub write {
             @v = map { "$_\n" } $obj->fetch_all_values;
         }
         else {
+            $skip = 1;
             $logger->debug("Dpkg write skipped $type $elt");
         }
 
@@ -126,6 +130,10 @@ sub write {
             $fh->print(@v);
             $fh->close;
         }
+        elsif ($args{auto_delete} and not $skip) {
+            warn "deleting $file";
+            path($dir)->child($file)->remove;
+        }
     }
 
     return 1;
diff --git a/lib/Config/Model/models/Dpkg.pl b/lib/Config/Model/models/Dpkg.pl
index 436972f..eb8f55a 100644
--- a/lib/Config/Model/models/Dpkg.pl
+++ b/lib/Config/Model/models/Dpkg.pl
@@ -136,6 +136,7 @@ By default, it will include all existing files in the 
top-level source directory
     'read_config' => [
       {
         'auto_create' => '1',
+        'auto_delete' => '1',
         'backend' => 'Dpkg',
         'config_dir' => 'debian',
         'file' => 'clean'

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

_______________________________________________
Pkg-perl-cvs-commits mailing list
Pkg-perl-cvs-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-perl-cvs-commits

Reply via email to