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 eaa14839a6329a4ec72f23e67afe8fd7bd8a4c1f Author: Dominique Dumont <d...@debian.org> Date: Sat Jan 28 18:55:57 2017 +0100 add default dummy value for debian/changelog tests are tweaked to add the changelog file now created by the model --- lib/Config/Model/Dpkg/Dependency.pm | 7 ++++-- lib/Config/Model/models/Dpkg.pl | 22 +++++++++++++++++ lib/Config/Model/models/Dpkg/Meta.pl | 10 ++++++++ t/model_tests.d/dpkg-test-conf.pl | 48 +++++++++++++++++++++++++----------- 4 files changed, 70 insertions(+), 17 deletions(-) diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm index 225bf46..05ab7da 100644 --- a/lib/Config/Model/Dpkg/Dependency.pm +++ b/lib/Config/Model/Dpkg/Dependency.pm @@ -373,6 +373,7 @@ sub check_debhelper_version { $logger->debug("checking '$dep_string' with lintian"); # try to create compat_obj, but do not try twice (hence the exists test) + # compat_obj will be undef with 'cme edit dpkg-control' if (not exists $self->{_compat_obj} ) { # using mode loose because debian-control model can be used alone # and compat is outside of debian-control @@ -385,9 +386,11 @@ sub check_debhelper_version { my $compat_value = $self->{_compat_obj}->fetch; my $min_dep = Lintian::Relation->new("debhelper ( >= $compat_value)") ; - $logger->debug("checking if ".$lintian_dep->unparse." implies ". $min_dep->unparse); - return if $lintian_dep->implies ($min_dep) ; + if ($lintian_dep->implies ($min_dep)) { + $logger->debug($dep_string." -> ".$lintian_dep->unparse." implies ". $min_dep->unparse); + return; + } $logger->debug("'$dep_string' does not imply debhelper >= $compat_value"); diff --git a/lib/Config/Model/models/Dpkg.pl b/lib/Config/Model/models/Dpkg.pl index 7ca3a0f..d4277d1 100644 --- a/lib/Config/Model/models/Dpkg.pl +++ b/lib/Config/Model/models/Dpkg.pl @@ -55,6 +55,28 @@ include /usr/share/dpkg/default.mk 'type' => 'leaf', 'value_type' => 'string' }, + 'changelog', + { + 'compute' => { + 'allow_override' => '1', + 'formula' => '$pkg_name (0.001-1) UNRELEASED; urgency=medium + + * ... + + -- $name <$mail> Wed, 18 Jan 2017 18:28:23 +0100 +', + 'variables' => { + 'mail' => '! my_config email', + 'name' => '! my_config fullname', + 'pkg_name' => '! control source Source' + } + }, + 'description' => 'Dummy changelog entry with a dummy date. +Don\'t forget to change the version +number. Use L<dch> command to update.', + 'type' => 'leaf', + 'value_type' => 'string' + }, 'scan-copyright-patterns', { 'config_class_name' => 'Dpkg::Copyright::ScanPatterns', diff --git a/lib/Config/Model/models/Dpkg/Meta.pl b/lib/Config/Model/models/Dpkg/Meta.pl index 09b5ed9..832722a 100644 --- a/lib/Config/Model/models/Dpkg/Meta.pl +++ b/lib/Config/Model/models/Dpkg/Meta.pl @@ -8,6 +8,16 @@ '2010,2011 Dominique Dumont' ], 'element' => [ + 'fullname', + { + 'compute' => { + 'allow_override' => '1', + 'formula' => '$ENV{DEBFULLNAME}', + 'use_eval' => '1' + }, + 'type' => 'leaf', + 'value_type' => 'uniline' + }, 'email', { 'compute' => { diff --git a/t/model_tests.d/dpkg-test-conf.pl b/t/model_tests.d/dpkg-test-conf.pl index 76e18f6..d9b01de 100644 --- a/t/model_tests.d/dpkg-test-conf.pl +++ b/t/model_tests.d/dpkg-test-conf.pl @@ -1,6 +1,8 @@ use Data::Dumper; use IO::File; use File::HomeDir ; +use strict; +use warnings; $conf_file_name = ""; $conf_dir = ''; @@ -9,20 +11,34 @@ $model_to_test = "Dpkg"; eval { require AptPkg::Config; }; $skip = ( $@ or not -r '/etc/debian_version' ) ? 1 : 0; -my $add_home = sub { - my $r = shift ; - my $home = File::HomeDir->my_home; # Works also on Windows - push @$r, "$home/.dpkg-meta.yml" ; +my %add_map = ( + # Works also on Windows + home => File::HomeDir->my_home."/.dpkg-meta.yml", + log => '/debian/changelog', + rules => '/debian/rules', +); + +# used to tweak list of debian files +sub add { + # @to_add is a closure used in inner sub + my @to_add = @_; + return sub { + push @{$_[0]}, map { $add_map{$_} } @to_add; + }; }; @tests = ( { name => 't0', - check => - { 'control source Build-Depends-Indep:3', 'libtest-pod-perl', }, - file_check_sub => $add_home, + check => { + 'control source Build-Depends-Indep:3' => 'libtest-pod-perl', + }, + # add() returns a sub used to tweak file list + file_check_sub => add('home'), apply_fix => 1 , + load_warnings => [ qr/dual life/ ], }, { name => 't1', + load_warnings => [ qr/compat/, qr/standard/, (qr/canonical/) x 2 ], apply_fix => 1 , load => qq!patches:fix-spelling Description="more spelling details"! . qq( ! patches:glib-single-include Synopsis="mega patchchoid") @@ -38,18 +54,20 @@ my $add_home = sub { 'compat' => 8 , # test setup 'control source Build-Depends:0' => 'debhelper (>= 8)' , }, - file_check_sub => $add_home, + file_check_sub => add('home'), # dump_warnings => [ (qr/deprecated/) x 3 ], }, { name => 'libversion' , + load_warnings => [ qr/unnecessary/, (qr/dual life/) x2, + qr/standard/, (qr/canonical/) x 2 ], apply_fix => 1 , check => { 'control source Build-Depends-Indep:0', => 'perl', 'control source Build-Depends-Indep:1', => 'libdist-zilla-perl', }, - file_check_sub => $add_home, + file_check_sub => add('home'), }, { name => 'pan-copyright-from-scratch', @@ -69,7 +87,7 @@ my $add_home = sub { "copyright License:GPL-2 text" => {value => undef, mode => 'custom'}, "copyright License:GPL-2 text" => qr/GNU/, }, - file_check_sub => $add_home, + file_check_sub => add(qw/home log/), }, { # should that be pan-copyright-upgrate ? :-p @@ -95,7 +113,7 @@ my $add_home = sub { "copyright License:GPL-2 text" => {value => undef, mode => 'custom'}, "copyright License:GPL-2 text" => qr/GNU/, }, - file_check_sub => $add_home, + file_check_sub => add(qw/home log/), }, { # emulate removed and added file, updated copyright years @@ -125,7 +143,7 @@ my $add_home = sub { "copyright License:GPL-2 text" => {value => undef, mode => 'custom'}, "copyright License:GPL-2 text" => qr/GNU/, }, - file_check_sub => $add_home, + file_check_sub => add(qw/home log/), }, { @@ -137,7 +155,7 @@ my $add_home = sub { qr!Files: src/im_mad/remotes/az.d/\*! ] }, - file_check_sub => sub { splice @{$_[0]}, 3,0,'/debian/rules'; $add_home->(@_); }, + file_check_sub => add(qw/rules home log/), file_contents_unlike => { 'debian/copyright' => [ qr!Files: src/im_mad/\*!, @@ -158,7 +176,7 @@ my $add_home = sub { qr!Files: src/im_mad/remotes/az.d/\*! ] }, - file_check_sub => sub { splice @{$_[0]}, 3,0,'/debian/rules'; $add_home->(@_); }, + file_check_sub => add(qw/rules home log/), # check that some entries were fixed by update check => { 'copyright Files:"share/vendor/*" Copyright' => '2010-2012, VMware, Inc.', @@ -182,7 +200,7 @@ my $add_home = sub { 'copyright Files:"modules/Perl6-MIME-Base64/*" Copyright' => 'Adrian White', 'copyright Files:"modules/DBIish/*" Comment' => qr/should be preserved by cme update/, }, - file_check_sub => $add_home, + file_check_sub => add(qw/home log/), }, ); -- 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