r52189 - in /trunk/dh-make-perl: TODO debian/changelog lib/DhMakePerl.pm lib/DhMakePerl/Config.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Fri Feb 5 07:16:09 UTC 2010
Author: dmn
Date: Fri Feb 5 07:15:57 2010
New Revision: 52189
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=52189
Log:
fix_rules() replaced with update_file_list() and Config::check_obsolete_entries
Modified:
trunk/dh-make-perl/TODO
trunk/dh-make-perl/debian/changelog
trunk/dh-make-perl/lib/DhMakePerl.pm
trunk/dh-make-perl/lib/DhMakePerl/Config.pm
Modified: trunk/dh-make-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/TODO?rev=52189&op=diff
==============================================================================
--- trunk/dh-make-perl/TODO (original)
+++ trunk/dh-make-perl/TODO Fri Feb 5 07:15:57 2010
@@ -35,5 +35,3 @@
adds a leading "0" (even worse). we somehow need to get those versions
back. or strip the "v". or something. - at least if the tarball is
Foo-Bar-v1.2.0.
-* cleanup lib/DhMakePerl.pm: fix_rules doesn't fix rules anymore but only
- writes examples and docs, ...
Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=52189&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Fri Feb 5 07:15:57 2010
@@ -1,6 +1,9 @@
dh-make-perl (0.64) UNRELEASED; urgency=low
* DhMakePerl: drop unused extract_changelog()
+ * DhMakePerl: fix_rules() replaced with update_file_list() for updating
+ examples and docs and checks for deprecated/obsolete entries in
+ DhMakePerl::Config
-- Damyan Ivanov <dmn at debian.org> Fri, 05 Feb 2010 09:05:25 +0200
Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=52189&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Fri Feb 5 07:15:57 2010
@@ -226,7 +226,7 @@
}
if ( 'docs' ~~ $self->cfg->only or 'examples' ~~ $self->cfg->only) {
- $self->fix_rules( $self->debian_file('rules'), \@docs, \@examples, );
+ $self->update_file_list( docs => \@docs, examples => \@examples );
}
if ( 'copyright' ~~ $self->cfg->only ) {
@@ -387,7 +387,7 @@
#create_readme("$debiandir/README.Debian");
$self->create_copyright("$debiandir/copyright");
- $self->fix_rules( "$debiandir/rules", \@docs, \@examples );
+ $self->update_file_list( docs => \@docs, examples => \@examples );
$self->apply_final_overrides();
$self->build_package
if $self->cfg->build or $self->cfg->install;
@@ -1432,67 +1432,41 @@
}
}
-sub fix_rules {
- my ( $self, $rules_file, $docs, $examples ) = @_;
-
- my ( $test_line, $fh, @content );
-
- $fh = $self->_file_rw($rules_file);
- @content = $fh->getlines;
-
- $fh->seek( 0, 0 ) || die "Can't rewind $rules_file: $!";
- $fh->truncate(0) || die "Can't truncate $rules_file: $!";
-
- warn "--notest ignored. if you don't want to run the tests when building the package, add 'nocheck' to DEB_BUILD_OPTIONS\n"
- if $self->cfg->notest;
-
- if ( $self->cfg->dh < 7 ) {
- warn "debhelper compatibility levels before 7 are not supported.\n";
- exit(1);
- }
- else {
- $fh->print($_) for @content;
- if (@examples) {
- # pkgname.examples file
- my $pkg_examples_file = $self->debian_file("$pkgname.examples");
-
- # if a package.examples exists read these values first
- if ( -r $pkg_examples_file ) {
- my $fh = $self->_file_r($pkg_examples_file);
- my @existing_examples = $fh->getlines;
- chomp(@existing_examples);
-
- # make list of files for package.examples unique
- push @examples, @existing_examples;
- }
-
- # write package.examples file with unique entries
- open F, '>', $pkg_examples_file or die $!;
- print F "$_\n" foreach @examples;
- close F;
- }
- if (@docs) {
- # pkgname.docs file
- my $pkg_docs_file = $self->debian_file("$pkgname.docs");
-
- # if a apcakge.docs exists read these values first
- if ( -r $pkg_docs_file ) {
- my $fh = $self->_file_r($pkg_docs_file);
- my @existing_docs = $fh->getlines;
- chomp(@existing_docs);
-
- # make list of files for package.docs unique
- push @docs, @existing_docs;
- }
-
- # write package.docs with unique entries
- open F, '>', $pkg_docs_file or die $!;
- print F "$_\n" foreach @docs;
- close F;
- }
- }
-
- $fh->close;
+sub update_file_list( $ % ) {
+ my ( $self, %p ) = @_;
+
+ while ( my ( $file, $new_content ) = each %p ) {
+ # pkgname.foo file
+ my $pkg_file = $self->debian_file("$pkgname.$file");
+ my %uniq_content;
+
+ # if a package.foo exists read its values first
+ if ( -r $pkg_file ) {
+ my $fh = $self->_file_r($pkg_file);
+ my @existing_content = $fh->getlines;
+ chomp(@existing_content);
+
+ # make list of files for package.foo unique
+ $uniq_content{$_} = 1 for @existing_examples;
+ }
+
+ $uniq_content{$_} = 1 for @$new_content;
+
+ # write package.foo file with unique entries
+ open F, '>', $pkg_file or die $!;
+ for ( @content, @$new_content ) {
+
+ # we have the unique hash
+ # we delete from it each printed line
+ # so if a line is not in the hash, this means we have already
+ # printed it
+ next unless exists $uniq_content{$_};
+
+ delete $uniq_content{$_};
+ print F "$_\n";
+ }
+ close F;
+ }
}
sub create_control {
Modified: trunk/dh-make-perl/lib/DhMakePerl/Config.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Config.pm?rev=52189&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Config.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Config.pm Fri Feb 5 07:15:57 2010
@@ -166,6 +166,8 @@
$self->build(1);
$self->command('make');
}
+
+ $self->check_obsolete_entries;
}
=item parse_config_file()
@@ -208,6 +210,8 @@
die "Error parsing $fn: the following keys are not known:\n"
. join( "\n", map( " - $_", keys %$yaml ) )
if %$yaml;
+
+ $self->check_obsolete_entries;
}
}
@@ -236,6 +240,25 @@
return YAML::Dump( \%hash );
}
+=item check_obsolete_entries
+
+Checks for presense of deprecated/obsolete entries and warns/dies if any is
+found.
+
+=cut
+
+sub check_obsolete_enties {
+ my ($self) = @_;
+
+ warn "--notest ignored. if you don't want to run the tests when building the package, add 'nocheck' to DEB_BUILD_OPTIONS\n"
+ if $self->notest;
+
+ if ( $self->dh < 7 ) {
+ warn "debhelper compatibility levels before 7 are not supported.\n";
+ exit(1);
+ }
+}
+
=back
=cut
More information about the Pkg-perl-cvs-commits
mailing list