--- /dev/null
+fix-dh-make-perl-for-perl583.patch
--- /dev/null
+#!/usr/bin/perl -w
+use Pod::Parser;
+use YAML;
+use IO::File;
+use File::Basename;
+use File::Find;
+use File::Copy qw(copy move);
+use User::pwent;
+use Getopt::Long;
+use Cwd;
+use CPAN;
+use Module::Depends::Intrusive;
+use Email::Date::Format qw(email_date);
+use strict;
+
+# TODO:
+# * get more info from the package (maybe using CPAN methods)
+
+######################################################################
+# This Pod::Parser must be declared before the main program flow. If you
+# are trying to figure out what happens inside dh-make-perl, skip down
+# until 'package main'.
+package MyPod;
+
+@MyPod::ISA = qw(Pod::Parser);
+
+sub set_names {
+ my ($parser, @names) = @_;
+ foreach my $n (@names) {
+ $parser->{_deb_}->{$n} = undef;
+ }
+}
+
+sub get {
+ my ($parser, $name) = @_;
+ $parser->{_deb_}->{$name};
+}
+
+sub cleanup {
+ my $parser = shift;
+ delete $parser->{_current_};
+ foreach my $k ( keys %{$parser->{_deb_}}) {
+ $parser->{_deb_}->{$k} = undef;
+ }
+}
+
+sub command {
+ my ($parser, $command, $paragraph, $line_num) = @_;
+ $paragraph =~ s/\s+$//s;
+ if ($command =~ /head/ && exists($parser->{_deb_}->{$paragraph})) {
+ $parser->{_current_} = $paragraph;
+ $parser->{_lineno_} = $line_num;
+ } else {
+ delete $parser->{_current_};
+ }
+ #print "GOT: $command -> $paragraph\n";
+}
+
+sub add_text {
+ my ($parser, $paragraph, $line_num) = @_;
+ return unless exists $parser->{_current_};
+ return if ($line_num - $parser->{_lineno_} > 15);
+ $paragraph =~ s/^\s+//s;
+ $paragraph =~ s/\s+$//s;
+ $paragraph = $parser->interpolate($paragraph, $line_num);
+ $parser->{_deb_}->{$parser->{_current_}} .= "\n\n".$paragraph;
+ #print "GOTT: $paragraph'\n";
+}
+
+sub verbatim { shift->add_text(@_)}
+
+sub textblock { shift->add_text(@_)}
+
+sub interior_sequence {
+ my ($parser, $seq_command, $seq_argument) = @_;
+ if ($seq_command eq 'E') {
+ my %map = ('gt' => '>', 'lt' => '<', 'sol' => '/', 'verbar' => '|');
+ return $map{$seq_argument} if exists $map{$seq_argument};
+ return chr($seq_argument) if ($seq_argument =~ /^\d+$/);
+ # html names...
+ }
+ return $seq_argument;
+}
+
+######################################################################
+# Main dh-make-perl starts here, don't look any further!
+package main;
+my (@stdmodules, $min_perl_version, $debstdversion, $priority, $section,
+ $depends, $bdepends, $bdependsi, $maintainer, $arch, $closes, $date,
+ $debiandir, $startdir, $datadir, $homedir, $email);
+our %overrides;
+
+$debstdversion = '3.8.0';
+$priority = 'optional';
+$section = 'perl';
+$depends = '${perl:Depends}';
+# 5.6.0-12 is where arch-indep modules are moved in /usr/share/perl5
+# (according to dh_perl)
+# if the module has stricter requirements, this build-dependency
+# is replaced below by calling substitute_perl_dependency
+$min_perl_version = '5.6.10-12';
+$bdependsi = "perl (>= $min_perl_version)";
+$arch = 'all';
+$date = email_date(time);
+$startdir = getcwd();
+$datadir = '/usr/share/dh-make-perl';
+$homedir = "$ENV{HOME}/.dh-make-perl";
+
+my ($perlname, $maindir, $modulepm, $meta);
+my ($pkgname, $srcname,
+ # $version is the version from the perl module itself
+ $version,
+ # $pkgversion is the resulting version of the package: User's
+ # --version=s or "$version-1"
+ $pkgversion,
+ $desc, $longdesc, $copyright, $author, $upsurl);
+my ($extrasfields, $extrapfields);
+my ($module_build);
+my (@docs, @examples, $changelog, @args);
+
+my %opts = (
+ 'dh' => 5,
+);
+
+my $mod_cpan_version;
+
+$opts{dbflags} = $>==0?"":"-rfakeroot";
+chomp($date);
+
+GetOptions(\%opts,
+ 'arch=s', 'basepkgs=s', 'bdepends=s', 'bdependsi=s',
+ 'build!', 'core-ok', 'cpan=s', 'cpanplus=s', 'closes=i',
+ 'cpan-mirror=s', 'dbflags=s', 'depends=s', 'desc=s',
+ 'exclude|i:s{,}', 'help', 'install!', 'nometa', 'notest',
+ 'pkg-perl!', 'requiredeps', 'version=s', 'e=s', 'email=s',
+ 'p=s', 'packagename=s', 'refresh|R', 'dh=i'
+) or die usage_instructions();
+
+$bdepends = "debhelper (>= $opts{dh})";
+@stdmodules = get_stdmodules();
+
+# Help requested? Nice, we can just die! Isn't it helpful?
+die usage_instructions() if $opts{help};
+die "CPANPLUS support disabled, sorry" if $opts{cpanplus};
+
+$opts{exclude} = '(?:\/|^)(?:CVS|\.svn)\/' if (!defined $opts{exclude} or
+ $opts{exclude} eq '');
+
+$arch = $opts{arch} if defined $opts{arch};
+
+if ( $opts{refresh} )
+{
+ print "Engaging refresh mode\n";
+ $maindir='.';
+ $meta = process_meta("$maindir/META.yml") if (-f "$maindir/META.yml"); # package name
+ ($pkgname, $version) = extract_basic(); # also detects arch-dep package
+ $module_build = (-f "$maindir/Build.PL") ? "Module-Build" : "MakeMaker";
+ $debiandir='./debian';
+ extract_changelog($maindir);
+ extract_docs($maindir);
+ extract_examples($maindir);
+ print "Found changelog: $changelog\n" if defined $changelog;
+ print "Found docs: @docs\n";
+ print "Found examples: @examples\n" if @examples;
+ create_rules("$debiandir/rules");
+ fix_rules(
+ "$debiandir/rules",
+ (defined $changelog ? $changelog : ''),
+ \@docs, \@examples,
+ );
+ print "Done\n";
+ exit 0;
+}
+
+load_overrides();
+my $tarball = setup_dir();
+$meta = process_meta("$maindir/META.yml") if (-f "$maindir/META.yml");
+findbin_fix();
+
+if (defined $opts{e}) {
+ $email = $opts{e};
+} elsif (defined $opts{email}) {
+ $email = $opts{email};
+} else {
+ $email = '';
+}
+$maintainer = get_maintainer($email);
+
+if (defined $opts{desc}) {
+ $desc = $opts{desc};
+} else {
+ $desc = '';
+}
+($pkgname, $version) = extract_basic();
+if (defined $opts{p}) {
+ $pkgname = $opts{p};
+} elsif (defined $opts{packagename}) {
+ $pkgname = $opts{packagename};
+}
+unless (defined $opts{version}) {
+ $pkgversion = $version . "-1";
+} else {
+ $pkgversion = $opts{version};
+}
+
+move ($tarball, dirname($tarball) . "/${pkgname}_${version}.orig.tar.gz") if ($tarball && $tarball =~ /(?:\.tar\.gz|\.tgz)$/);
+$module_build = (-f "$maindir/Build.PL") ? "Module-Build" : "MakeMaker";
+extract_changelog($maindir);
+extract_docs($maindir);
+extract_examples($maindir);
+
+if (defined $opts{bdepends}) {
+ $bdepends = $opts{bdepends};
+} else {
+ $bdepends .= ', libmodule-build-perl' if ($module_build eq "Module-Build");
+}
+$bdependsi = $opts{bdependsi} if defined $opts{bdependsi};
+
+if (defined $opts{depends}) {
+ $depends = $opts{depends};
+} else {
+ $depends .= ', ${shlibs:Depends}' if $arch eq 'any';
+ $depends .= ', ${misc:Depends}';
+ my $extradeps = extract_depends($maindir, $meta);
+ $depends .= ( $extradeps ? ", $extradeps" : '' );
+}
+
+apply_overrides();
+
+die "Cannot find a description for the package: use the --desc switch\n"
+ unless $desc;
+print "Package does not provide a long description - " ,
+ " Please fill it in manually.\n"
+ if (!defined $longdesc or $longdesc =~ /^\s*\.?\s*$/);
+print "Using maintainer: $maintainer\n";
+print "Found changelog: $changelog\n" if defined $changelog;
+print "Found docs: @docs\n";
+print "Found examples: @examples\n" if @examples;
+-d $debiandir && die "The directory $debiandir is already present and I won't overwrite it: remove it yourself.\n";
+# start writing out the data
+mkdir ($debiandir, 0755) || die "Cannot create $debiandir dir: $!\n";
+create_control("$debiandir/control");
+if (defined $opts{closes}) {
+ $closes = $opts{closes};
+} else {
+ $closes = get_itp($pkgname);
+}
+create_changelog("$debiandir/changelog", $closes);
+create_rules("$debiandir/rules");
+create_compat("$debiandir/compat");
+create_watch("$debiandir/watch") if $upsurl;
+#create_readme("$debiandir/README.Debian");
+create_copyright("$debiandir/copyright");
+fix_rules("$debiandir/rules", (defined $changelog ? $changelog : ''), \@docs, \@examples);
+apply_final_overrides();
+build_package($maindir) if $opts{build} or $opts{install};
+install_package($debiandir) if $opts{install};
+print "Done\n";
+exit(0);
+
+sub usage_instructions {
+return <<"USAGE"
+Usage:
+$0 [ --build ] [ --install ] [ SOURCE_DIR | --cpan MODULE ]
+$0 --refresh|-R
+Other options: [ --desc DESCRIPTION ] [ --arch all|any ] [ --version VERSION ]
+ [ --depends DEPENDS ] [ --bdepends BUILD-DEPENDS ]
+ [ --bdependsi BUILD-DEPENDS-INDEP ] [ --cpan-mirror MIRROR ]
+ [ --exclude|-i [REGEX] ] [ --notest ] [ --nometa ]
+ [ --requiredeps ] [ --core-ok ] [ --basepkgs PKGSLIST ]
+ [ --closes ITPBUG ] [ --packagename|-p PACKAGENAME ]
+ [ --email|-e EMAIL ] [ --pkg-perl ] [ --dh <ver> ]
+USAGE
+}
+
+sub get_stdmodules {
+ my ($base_packages, @modules, $paths);
+ $base_packages = $opts{basepkgs} || 'perl,perl-base,perl-modules';
+
+ # We will check on all the base Perl packages for the modules they provide.
+ # To know which files we care for, we look at @INC - In a format easy to
+ # integrate into a regex
+ $paths = join('|', @INC);
+
+ for my $pkg (split(/,/,$base_packages)) {
+ for my $file (map {chomp;$_} `dpkg -L $pkg`) {
+ next unless $file =~ s!^(?:$paths)[\d\.]*/(.*).pm$!$1!x;
+
+ $file =~ s!/!::!g;
+ push @modules, $file;
+ }
+ }
+
+ return sort @modules;
+}
+
+sub setup_dir {
+ my ($dist, $mod, $cpanversion, $tarball);
+ $mod_cpan_version = '';
+ if ($opts{cpan}) {
+ my ($new_maindir);
+ # Is the module a core module?
+ if (grep(/$opts{cpan}/, @stdmodules)) {
+ die "$opts{cpan} is a standard module.\n"
+ unless $opts{'core-ok'};
+ }
+
+ # Make CPAN happy, make the user happy: Be more tolerant!
+ # Accept names to be specified with double-colon, dash or slash
+ $opts{cpan} =~ s![/-]!::!g;
+
+### require CPAN;
+ CPAN::Config->load;
+
+ unshift(@{$CPAN::Config->{'urllist'}}, $opts{'cpan-mirror'})
+ if $opts{'cpan-mirror'};
+
+ $CPAN::Config->{'build_dir'} = $ENV{'HOME'} . "/.cpan/build";
+ $CPAN::Config->{'cpan_home'} = $ENV{'HOME'} . "/.cpan/";
+ $CPAN::Config->{'histfile'} = $ENV{'HOME'} . "/.cpan/history";
+ $CPAN::Config->{'keep_source_where'} = $ENV{'HOME'} . "/.cpan/source";
+
+ # This modification allows to retrieve all the modules that
+ # match the user-provided string.
+ #
+ # expand() returns a list of matching items when called in list
+ # context, so after retrieving it, I try to match exactly what
+ # the user asked for. Specially important when there are
+ # different modules which only differ in case.
+ #
+ # This Closes: #451838
+ my @mod = CPAN::Shell->expand('Module', '/^'.$opts{cpan}.'$/')
+ or die "Can't find '$opts{cpan}' module on CPAN\n";
+ foreach(@mod) {
+ my $file = $_->cpan_file();
+ $file =~ s#.*/##; # remove directory
+ $file =~ s/(.*)-.*/$1/; # remove version and extension
+ $file =~ s/-/::/g; # convert dashes to colons
+ if($file eq $opts{cpan}) {
+ $mod = $_;
+ last;
+ }
+ }
+ $mod = shift @mod unless($mod);
+ $mod_cpan_version = $mod->cpan_version;
+ $cpanversion = $CPAN::VERSION;
+ $cpanversion =~ s/_.*//;
+
+ $tarball = $CPAN::Config->{'keep_source_where'} . "/authors/id/";
+
+ if ($cpanversion < 1.59) { # wild guess on the version number
+ $dist = $CPAN::META->instance('CPAN::Distribution', $mod->{CPAN_FILE});
+ $dist->get || die "Cannot get $mod->{CPAN_FILE}\n";
+ $tarball .= $mod->{CPAN_FILE};
+ $maindir = $dist->{'build_dir'};
+ } else {
+ # CPAN internals changed
+ $dist = $CPAN::META->instance('CPAN::Distribution', $mod->cpan_file);
+ $dist->get || die "Cannot get ", $mod->cpan_file, "\n";
+ $tarball .= $mod->cpan_file;
+ $maindir = $dist->dir;
+ }
+
+ copy ($tarball, $ENV{'PWD'});
+ $tarball = $ENV{'PWD'} . "/" . basename($tarball);
+ # build_dir contains a random part since 1.88_59
+ # use the new CPAN::Distribution::base_id (introduced in 1.91_53)
+ $new_maindir = $ENV{PWD} . "/" . (
+ $cpanversion < 1.9153 ? basename($maindir) : $dist->base_id
+ );
+ # rename existing directory
+ if (-d $new_maindir && system("mv", "$new_maindir", "$new_maindir.$$") == 0) {
+ print '='x70,"\n";
+ print "Unpacked tarball already existed, directory renamed to $new_maindir.$$\n";
+ print '='x70,"\n";
+ }
+ system("mv", "$maindir", "$new_maindir") == 0
+ or die "Failed to move $maindir to $new_maindir: $!";
+ $maindir = $new_maindir;
+
+ } elsif ($opts{cpanplus}) {
+ die "CPANPLUS support is b0rken at the moment.";
+# my ($cb, $href, $file);
+
+# eval "use CPANPLUS 0.045;";
+# $cb = CPANPLUS::Backend->new(conf => {debug => 1, verbose => 1});
+# $href = $cb->fetch( modules => [ $opts{cpanplus} ], fetchdir => $ENV{'PWD'});
+# die "Cannot get $opts{cpanplus}\n" if keys(%$href) != 1;
+# $file = (values %$href)[0];
+# print $file, "\n\n";
+# $maindir = $cb->extract( files => [ $file ], extractdir => $ENV{'PWD'} )->{$file};
+ } else {
+ $maindir = shift(@ARGV) || '.';
+ $maindir =~ s/\/$//;
+ }
+ return $tarball;
+}
+
+sub build_package {
+ my $maindir = shift;
+ # uhmf! dpkg-genchanges doesn't cope with the deb being in another dir..
+ #system("dpkg-buildpackage -b -us -uc $opts{dbflags}") == 0
+ system("fakeroot make -C $maindir -f debian/rules clean");
+ system("fakeroot make -C $maindir -f debian/rules binary") == 0
+ || die "Cannot create deb package\n";
+}
+
+sub install_package {
+ my ($archspec, $debname);
+
+ if ($arch eq 'any') {
+ $archspec = `dpkg --print-architecture`;
+ chomp($archspec);
+ } else {
+ $archspec = $arch;
+ }
+
+ $debname = "${pkgname}_$version-1_$archspec.deb";
+
+ system("dpkg -i $startdir/$debname") == 0
+ || die "Cannot install package $startdir/$debname\n";
+}
+
+sub process_meta {
+ my ($file, $yaml);
+ $file = shift;
+ # Command line option nometa causes this function not to be run
+ return {} if $opts{nometa};
+
+ # YAML::LoadFile has the bad habit of dying when it cannot properly parse
+ # a file - Catch it in an eval, and if it dies, return -again- just an
+ # empty hashref. Oh, were it not enough: It dies, but $! is not set, so we
+ # check against $@. Crap, crap, crap :-/
+ eval {
+ $yaml = YAML::LoadFile($file);
+ };
+ if ($@) {
+ print "Error parsing $file - Ignoring it.\n";
+ print "Please notify module upstream maintainer.\n";
+ $yaml = {};
+ }
+
+ # Returns a simple hashref with all the keys/values defined in META.yml
+ return $yaml;
+}
+
+sub extract_basic_copyright {
+ for my $f (qw(LICENSE LICENCE COPYING)) {
+ if (-f $f) {
+ return `cat $f`;
+ }
+ }
+ return undef;
+}
+
+sub extract_basic {
+ ($perlname, $version) = extract_name_ver();
+ find(\&check_for_xs, $maindir);
+ $pkgname = lc $perlname;
+ $pkgname = 'lib'.$pkgname unless $pkgname =~ /^lib/;
+ $pkgname .= '-perl' unless ($pkgname =~ /-perl$/ and $opts{cpan} !~ /::perl$/i);
+
+ # ensure policy compliant names and versions (from Joeyh)...
+ $pkgname =~ s/[^-.+a-zA-Z0-9]+/-/g;
+
+ $srcname = $pkgname;
+ $version =~ s/[^-.+a-zA-Z0-9]+/-/g;
+ $version = "0$version" unless $version =~ /^\d/;
+
+ print "Found: $perlname $version ($pkgname arch=$arch)\n";
+ $debiandir = "$maindir/debian";
+
+ $upsurl = "http://search.cpan.org/dist/$perlname/";
+
+ $copyright = extract_basic_copyright();
+ if ($modulepm) {
+ extract_desc($modulepm);
+ }
+
+ $opts{exclude} = '^$' unless $opts{exclude};
+ find(sub {
+ $File::Find::name !~ /$opts{exclude}/ &&
+ /\.(pm|pod)$/ &&
+ extract_desc($_);
+ }, $maindir);
+
+ return ($pkgname, $version);
+}
+
+sub makefile_pl {
+ return "$maindir/Makefile.PL";
+}
+
+sub findbin_fix {
+ # FindBin requires to know the name of the invoker - and requires it to be
+ # Makefile.PL to function properly :-/
+ $0 = makefile_pl();
+ if (exists $FindBin::{Bin}) {
+ FindBin::again();
+ }
+}
+
+sub extract_name_ver {
+ my ($name, $ver, $makefile);
+ $makefile = makefile_pl();
+
+ if (defined $meta->{name} and defined $meta->{version}) {
+ $name = $meta->{name};
+ $ver = $meta->{version};
+
+ } else {
+ ($name, $ver) = extract_name_ver_from_makefile($makefile);
+ }
+
+ $name =~ s/::/-/g;
+ return ($name, $ver);
+}
+
+sub extract_name_ver_from_makefile {
+ my ($file, $name, $ver, $vfrom, $dir, $makefile);
+ $makefile = shift;
+
+ {
+ local $/ = undef;
+ my $fh = _file_r($makefile);
+ $file = $fh->getline;
+ }
+
+ # Replace q[quotes] by "quotes"
+ $file =~ s/q\[(.+)]/'$1'/g;
+
+ # Get the name
+ if ($file =~ /([\'\"]?)
+ DISTNAME\1\s*
+ (=>|,)
+ \s*
+ ([\'\"]?)
+ (\S+)\3/xs) {
+ # Regular MakeMaker
+ $name = $4;
+ } elsif ($file =~ /([\'\"]?)
+ NAME\1\s*
+ (=>|,)
+ \s*
+ ([\'\"]?)
+ (\S+)\3/xs) {
+ # Regular MakeMaker
+ $name = $4;
+ } elsif ($file =~ /name
+ \s*
+ \(
+ ([\'\"]?)
+ (\S+)
+ \1
+ \);/xs) {
+ # Module::Install syntax
+ $name = $2;
+ }
+ $name =~ s/,.*$//;
+ # band aid: need to find a solution also for build in directories
+ # warn "name is $name (cpan name: $opts{cpan})\n";
+ $name = $opts{cpan} if ($name eq '__PACKAGE__' && $opts{cpan});
+ $name = $opts{cpanplus} if ($name eq '__PACKAGE__' && $opts{cpanplus});
+
+ # Get the version
+ if (defined $opts{version}) {
+ # Explicitly specified
+ $ver = $opts{version};
+
+ } elsif ($file =~ /([\'\"]?)VERSION\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s) {
+ # Regular MakeMaker
+ $ver = $4;
+ # Where is the version taken from?
+ $vfrom = $4 if
+ $file =~ /([\'\"]?)VERSION_FROM\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s;
+
+ } elsif ($file =~ /([\'\"]?)VERSION_FROM\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s) {
+ # Regular MakeMaker pointing to where the version is taken from
+ $vfrom = $4;
+
+ } elsif ($file =~ /version\((\S+)\)/s) {
+ # Module::Install
+ $ver = $1;
+ }
+
+ $dir = dirname($makefile) || './';
+
+ $modulepm = "$dir/$vfrom" if defined $vfrom;
+
+ for (($name, $ver)) {
+ next unless defined;
+ next unless /^\$/;
+ # decode simple vars
+ s/(\$\w+).*/$1/;
+ if ($file =~ /\Q$_\E\s*=\s*([\'\"]?)(\S+)\1\s*;/) {
+ $_ = $2;
+ }
+ }
+
+ unless (defined $ver) {
+ local $/ = "\n";
+ # apply the method used by makemaker
+ if (defined $dir and defined $vfrom and -f "$dir/$vfrom"
+ and -r "$dir/$vfrom") {
+ my $fh = _file_r("$dir/$vfrom");
+ while (my $lin = $fh->getline) {
+ if ($lin =~ /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/) {
+ no strict;
+ #warn "ver: $lin";
+ $ver = (eval $lin)[0];
+ last;
+ }
+ }
+ $fh->close;
+ } else {
+ if ( $mod_cpan_version ) {
+ $ver = $mod_cpan_version;
+ warn "Cannot use internal module data to gather the ".
+ "version; using cpan_version\n";
+ } else {
+ die "Cannot use internal module data to gather the ".
+ "version; use --cpan or --version\n";
+ }
+ }
+ }
+
+ return ($name, $ver);
+}
+
+sub extract_desc {
+ my ($file, $parser);
+ $file = shift;
+ $parser = new MyPod;
+ return unless -f $file;
+ $parser->set_names(qw(NAME DESCRIPTION DETAILS COPYRIGHT AUTHOR AUTHORS));
+ $parser->parse_from_file($file);
+ if ($desc) {
+ # No-op - We already have it, probably from the command line
+
+ } elsif ($meta->{abstract}) {
+ # Get it from META.yml
+ $desc = $meta->{abstract};
+
+ } elsif (my $my_desc = $parser->get('NAME')) {
+ # Parse it, fix it, send it!
+ $my_desc =~ s/^\s*\S+\s+-\s+//s;
+ $my_desc =~ s/^\s+//s;
+ $my_desc =~ s/\s+$//s;
+ $my_desc =~ s/^([^\s])/ $1/mg;
+ $my_desc =~ s/\n.*$//s;
+ $desc = $my_desc;
+ }
+ # Replace linefeeds (not followed by a space) in $desc with spaces
+ $desc =~ s/\n(?=\S)/ /gs;
+
+ unless ($longdesc) {
+ $longdesc = $parser->get('DESCRIPTION')
+ || $parser->get('DETAILS')
+ || $desc;
+ }
+ if (defined $longdesc && $longdesc !~ /^$/) {
+ $longdesc =~ s/^\s+//s;
+ $longdesc =~ s/\s+$//s;
+ $longdesc =~ s/^\t/ /mg;
+ $longdesc =~ s/^\s*$/ ./mg;
+ $longdesc =~ s/^\s*/ /mg;
+ $longdesc =~ s/^([^\s])/ $1/mg;
+ $longdesc =~ s/\r//g;
+ }
+
+ $copyright = $copyright || $parser->get('COPYRIGHT');
+ if (!$author) {
+ if (ref $meta->{author}) {
+ # Does the author information appear in META.yml?
+ $author = join(', ', @{$meta->{author}});
+ } else {
+ # Get it from the POD
+ $author = $parser->get('AUTHOR') || $parser->get('AUTHORS');
+ }
+ }
+
+ $parser->cleanup;
+}
+
+sub extract_changelog {
+ my ($dir) = shift;
+ $dir .= '/' unless $dir =~ m(/$);
+ find(sub {
+ $changelog = substr($File::Find::name, length($dir))
+ if (!defined($changelog) && /^change(s|log)$/i and (! $opts{exclude} or $File::Find::name !~ /$opts{exclude}/));
+ }, $dir);
+}
+
+sub extract_docs {
+ my ($dir) = shift;
+ $dir .= '/' unless $dir =~ m(/$);
+ find(sub {
+ push (@docs, substr($File::Find::name, length($dir)))
+ if (/^(README|TODO|BUGS|NEWS|ANNOUNCE)/i and (! $opts{exclude} or $File::Find::name !~ /$opts{exclude}/)) ;
+ }, $dir);
+}
+
+sub extract_examples {
+ my ($dir) = shift;
+ $dir .= '/' unless $dir =~ m(/$);
+ find(sub {
+ push (@examples, substr($File::Find::name, length($dir)) . '/*')
+ if (/^(examples|eg|samples?)$/i and (! $opts{exclude} or $File::Find::name !~ /$opts{exclude}/)) ;
+ }, $dir);
+}
+
+sub run_depends {
+ my ($depends_module, $dir) = @_;
+
+ no warnings;
+ local *STDERR;
+ open(STDERR, ">/dev/null");
+ my $mod_dep = $depends_module->new();
+
+ $mod_dep->dist_dir( $dir );
+ $mod_dep->find_modules();
+
+ my %dep_hash = %{$mod_dep->requires};
+
+ my $error = $mod_dep->error();
+ die "Error: $error\n" if $error;
+ return %dep_hash;
+}
+
+sub extract_depends {
+ my $dir = shift;
+ my $meta = shift;
+ my (%dep_hash, @uses, @deps, @not_debs, $has_apt_file);
+ local @INC = ($dir, @INC);
+
+ $dir .= '/' unless $dir =~ m/\/$/;
+
+ # try Module::Depends::Intrusive, but if that fails then
+ # fall back to Module::Depends.
+
+ eval {
+ %dep_hash = run_depends('Module::Depends::Intrusive',$dir);
+ };
+ if ($@) {
+ warn '='x70,"\n";
+ warn "First attempt (Module::Depends::Intrusive) at a dependency\n" .
+ "check failed. Possible use of Module::Install ?\n" .
+ "Trying again with Module::Depends ... \n";
+ warn '='x70,"\n";
+
+ eval {
+ %dep_hash = run_depends('Module::Depends',$dir);
+ };
+
+ if ($@) {
+ warn '='x70,"\n";
+ warn "Could not find the dependencies for the requested module.\n";
+ warn "Generated error: $@";
+
+ warn "Please check if your module depends on Module::Install\n" .
+ "for its build process - Automatically finding its\n" .
+ "dependencies is unsupported, please specify them manually\n" .
+ "using the 'depends' option. \n";
+ warn "Alternatively, including a META.yml file with dependencies\n" .
+ "should allow discovery even for Module::Install modules. \n";
+ warn '='x70,"\n";
+
+ exit 1;
+ }
+ }
+
+ foreach my $module (keys( %dep_hash )) {
+ next if (grep ( /^$module$/, @stdmodules));
+
+ push @uses, $module;
+ }
+
+ if (`which apt-file`) {
+ $has_apt_file = 1;
+ foreach my $module (@uses) {
+ my (@rawsearch, @search, $ls, $ver, $re, $mod);
+
+ if ($module eq 'perl') {
+ substitute_perl_dependency($dep_hash{perl});
+ next;
+ }
+
+ $mod = $module;
+ print "Searching for package containing $module using apt-file.\n";
+ $module =~ s|::|/|g;
+
+ # Regex's to search the return of apt-file to find the right pkg
+ $ls = '(?:lib|share)';
+ $ver = '\d+(\.\d+)+';
+ $re = "usr/(?:$ls/perl/$ver|$ls/perl5)/$module\\.pm";
+
+ @rawsearch = `apt-file search -x '$re'`;
+
+ # rank non -perl packages lower
+ @search = sort {
+ if ($a !~ /-perl: /) { return 1; }
+ elsif ($b !~ /-perl: /) { return -1; }
+ else { return $a cmp $b; } # or 0?
+ } @rawsearch;
+
+ for (@search) {
+ # apt-file output
+ # package-name: path/to/perl/module.pm
+ chomp;
+ my ($p, $f) = split / /, $_;
+ chop($p); #Get rid of the ":"
+ if ($f =~ /$re/ && !
+ grep { $_ eq $p } @deps, split(/,/,@stdmodules)) {
+ if (exists $dep_hash{$mod}) {
+ my $v = $dep_hash{$mod};
+ $v =~ s/^v//; # strip leading 'v' from version
+ push @deps, {name=>$p,
+ version=>$v};
+ } else {
+ push @deps, {name => $p};
+ }
+ last;
+ }
+ }
+
+ unless (@search) {
+ $module =~ s|/|::|g;
+ push @not_debs, $module;
+ }
+ }
+ } elsif ( $opts{requiredeps} ) {
+ die "--requiredeps was specified, but apt-file was not found\n";
+ }
+
+ print "\n";
+ print "Needs the following debian packages: " .
+ join (", ", map {$_->{name}} @deps) . "\n" if (@deps);
+ if (@not_debs) {
+ my ($missing_debs_str);
+ if ($has_apt_file) {
+ $missing_debs_str = join("\n", "Needs the following modules for which there are no debian packages available",
+ map({" - $_"} @not_debs), '');
+ } else {
+ $missing_debs_str = join("\n", "The following Perl modules are required and not installed in your system:",
+ map({" - $_"} @not_debs),
+ "You do not have 'apt-file' currently installed - If you install it, I will",
+ "be able to tell you which Debian packages are those modules in (if they are",
+ "packaged).");
+ }
+
+ if ( $opts{requiredeps} ) {
+ die $missing_debs_str;
+ } else {
+ print $missing_debs_str;
+ }
+
+ }
+
+ return join (", ", map { $_->{version} ?
+ $_->{name} ." (>= ". $_->{version} .")" :
+ $_->{name} } @deps);
+}
+
+sub get_itp {
+ use WWW::Mechanize;
+
+ my ($package) = shift @_;
+
+ my $wnpp = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=wnpp;includesubj=ITP: $package";
+ my $mech = WWW::Mechanize->new();
+
+ $mech->get($wnpp);
+
+ my @links = $mech->links();
+
+ foreach my $link (@links) {
+ my $desc = $link->text();
+
+ return $1 if $desc =~ /^#(\d+): ITP: $package /;
+ }
+ return 0;
+}
+
+sub substitute_perl_dependency {
+ # If we get 'perl' specified in here, the module requires a
+ # specific version of Perl in order to be run. This is only
+ # reliable if we have ${perl:Depends} in $depends and either
+ # of $bdepends and $bdependsi - Warn otherwise.
+ my ($version, $dep_str, $old_dep_str, $old_bdep_str);
+ $version = shift;
+
+ # Over-escaping? I'm putting this in variables to get a bit more clarity.
+ # Remember they will be fed into the regex engine.
+ $dep_str = "perl (>= $version)";
+ $old_dep_str = '\\$\\{perl:Depends\\}';
+ $old_bdep_str = "perl \\(>= $min_perl_version\\)";
+
+ unless ($depends =~ s/$old_dep_str/$dep_str/ and
+ ($bdepends =~ s/$old_bdep_str/$dep_str/ or
+ $bdependsi =~ s/$old_bdep_str/$dep_str/)) {
+ warn "The module requires Perl version $version, but you have ",
+ "apparently overriden the default dependency handling.\n",
+ "Please note that you might need to manually edit your debian/control ",
+ "- It might not make sense at all!\n";
+ }
+}
+
+sub check_for_xs {
+ (! $opts{exclude} or $File::Find::name !~ /$opts{exclude}/) && /\.(xs|c|cpp|cxx)$/i && do {
+ $arch = 'any';
+ };
+}
+
+sub fix_rules {
+ my ($rules_file, $changelog_file, $docs, $examples, $test_line, $fh, @content);
+ ($rules_file, $changelog_file, $docs, $examples) = @_;
+
+ if( $opts{dh} < 7 )
+ {
+ $test_line = ($module_build eq 'Module-Build') ?
+ '$(PERL) Build test' : '$(MAKE) test';
+ $test_line = "#$test_line" if $opts{notest};
+
+ $fh = _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: $!";
+ for (@content) {
+ s/#CHANGES#/$changelog_file/g;
+ s/#EXAMPLES#/join " ", @examples/eg;
+ s/\s+dh_installexamples\s+$//g; # no need for empty dh_installexamples
+ s/#DOCS#/join " ", @docs/eg;
+ s/#TEST#/$test_line/g;
+ $fh->print($_);
+ }
+ $fh->close;
+ }
+ else
+ {
+ if( @examples )
+ {
+ open F, '>>', "$maindir/debian/$pkgname.examples" or die $!;
+ print F "$_\n" foreach @examples;
+ close F;
+ }
+ if( @docs )
+ {
+ open F, '>>', "$maindir/debian/$pkgname.docs" or die $!;
+ print F "$_\n" foreach @docs;
+ close F;
+ }
+ }
+}
+
+sub create_control {
+ my $fh = _file_w(shift);
+
+ if ($arch ne 'all' and
+ !defined($opts{bdepends}) and !defined($opts{bdependsi})) {
+ $bdepends .= ", $bdependsi";
+ $bdependsi = '';
+ }
+
+ $fh->print("Source: $srcname\n");
+ $fh->print("Section: $section\n");
+ $fh->print("Priority: $priority\n");
+ $fh->print("Build-Depends: $bdepends\n") if $bdepends;
+ $fh->print("Build-Depends-Indep: $bdependsi\n") if $bdependsi;
+ $fh->print($extrasfields) if defined $extrasfields;
+ if( $opts{'pkg-perl'} )
+ {
+ $fh->print("Maintainer: Debian Perl Group <pkg-perl-maintainers\@lists.alioth.debian.org>\n");
+ $fh->print("Uploaders: $maintainer\n");
+ }
+ else
+ {
+ $fh->print("Maintainer: $maintainer\n");
+ }
+ $fh->print("Standards-Version: $debstdversion\n");
+ $fh->print("Homepage: $upsurl\n") if $upsurl;
+ do {
+ $fh->print("Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/$srcname/\n");
+ $fh->print("Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/$srcname/\n");
+ } if $opts{'pkg-perl'};
+ $fh->print("\n");
+ $fh->print("Package: $pkgname\n");
+ $fh->print("Architecture: $arch\n");
+ $fh->print("Depends: $depends\n") if $depends;
+ $fh->print($extrapfields) if defined $extrapfields;
+ $fh->print("Description: $desc\n$longdesc\n .\n This description was automagically extracted from the module by dh-make-perl.\n");
+ $fh->close;
+}
+
+sub create_changelog {
+ my $fh = _file_w(shift);
+ my $bug = shift;
+
+ my $closes = $bug ? " (Closes: #$bug)" : '';
+
+ $fh->print("$srcname ($pkgversion) unstable; urgency=low\n");
+ $fh->print("\n * Initial Release.$closes\n\n");
+ $fh->print(" -- $maintainer $date\n");
+ #$fh->print("Local variables:\nmode: debian-changelog\nEnd:\n");
+ $fh->close
+}
+
+sub create_rules {
+ my ($file, $rulesname, $error);
+ ($file) = shift;
+ $rulesname = (
+ ($opts{dh} eq 7)
+ ? $arch eq 'all'?'rules.dh7.noxs' :'rules.dh7.xs'
+ : $arch eq 'all'?"rules.$module_build.noxs":"rules.$module_build.xs"
+ );
+
+ for my $source (("$homedir/$rulesname", "$datadir/$rulesname")) {
+ copy($source, $file) && do {
+ print "Using rules: $source\n";
+ last;
+ };
+ $error = $!;
+ }
+ die "Cannot copy rules file ($rulesname): $error\n" unless -e $file;
+ chmod(0755, $file);
+}
+
+sub create_compat {
+ my $fh = _file_w(shift);
+ $fh->print("$opts{dh}\n");
+ $fh->close;
+}
+
+sub create_copyright {
+ my $fh = _file_w(shift);
+ my $incomplete = '';
+
+ $fh->print(
+"This is the debian package for the $perlname module.
+It was created by $maintainer using dh-make-perl.
+
+");
+ if (defined $upsurl) {
+ $fh->print("It was downloaded from $upsurl\n\n");
+ } else {
+ $incomplete .= "No upstream URL\n";
+ }
+ $fh->print(
+"This copyright info was automatically extracted from the perl module.
+It may not be accurate, so you better check the module sources
+if you don\'t want to get into legal troubles.
+
+");
+ if (defined $author) {
+ $fh->print("The upstream author is: $author.\n");
+ } else {
+ $incomplete .= "No upstream author\n";
+ }
+
+ if (defined($copyright)) {
+ $fh->print($copyright);
+ # Fun with regexes
+ if ( $copyright =~ /terms as Perl itself/i ) {
+ $fh->print("
+
+Perl is distributed under your choice of the GNU General Public License or
+the Artistic License. On Debian GNU/Linux systems, the complete text of the
+GNU General Public License can be found in \`/usr/share/common-licenses/GPL\'
+and the Artistic Licence in \`/usr/share/common-licenses/Artistic\'.
+");
+ } elsif ( $copyright =~ /GPL/ ) {
+ $fh->print("
+
+The full text of the GPL is available on Debian systems in
+/usr/share/common-licenses/GPL
+");
+ }
+ } else {
+ $incomplete .= "No licensing information\n";
+ }
+
+ my $year = (localtime)[5]+1900;
+ $fh->print("
+
+The Debian packaging is (C) $year, $maintainer and
+is licensed under the same terms as the software itself (see above).
+");
+
+ $fh->close;
+
+ if ($incomplete) {
+ _warn_incomplete_copyright($incomplete)
+ }
+}
+
+sub create_readme {
+ my $fh = _file_w(shift);
+ $fh->print(
+"This is the debian package for the $perlname module.
+It was created by $maintainer using dh-make-perl.
+");
+ $fh->close;
+}
+
+sub create_watch {
+ my $fh = _file_w(shift);
+
+ my $version_re = 'v?(\d[\d_.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)';
+
+ $fh->print(
+"\# format version number, currently 3; this line is compulsory!
+version=3
+\# URL to the package page followed by a regex to search
+$upsurl .*/$perlname-$version_re\$
+");
+ $fh->close;
+}
+
+sub get_maintainer {
+ my ($user, $pwnam, $email, $name, $mailh);
+ $user = $ENV{LOGNAME} || $ENV{USER};
+ $pwnam = getpwuid($<);
+ die "Cannot determine current user\n" unless $pwnam;
+ if (defined $ENV{DEBFULLNAME}) {
+ $name = $ENV{DEBFULLNAME};
+ } else {
+ $name = $pwnam->gecos;
+ $name =~ s/,.*//;
+ }
+ $user ||= $pwnam->name;
+ $name ||= $user;
+ $email = shift @_ || ($ENV{DEBEMAIL} || $ENV{EMAIL});
+ unless ($email) {
+ chomp($mailh = `cat /etc/mailname`);
+ $email = $user.'@'.$mailh;
+ }
+
+ $email =~ s/^(.*)\s+<(.*)>$/$2/;
+
+ return "$name <$email>";
+}
+
+sub load_overrides {
+ eval {
+ do "$datadir/overrides" if -f "$datadir/overrides";
+ do "$homedir/overrides" if -f "$homedir/overrides";
+ };
+ if ($@) {
+ die "Error when processing the overrides files: $@";
+ }
+}
+
+sub apply_overrides {
+ my ($data, $val, $subkey);
+
+ ($data, $subkey) = get_override_data();
+ return unless defined $data;
+ $pkgname = $val if (defined($val=get_override_val($data, $subkey, 'pkgname')));
+ $srcname = $val if (defined($val=get_override_val($data, $subkey, 'srcname')));
+ $section = $val if (defined($val=get_override_val($data, $subkey, 'section')));
+ $priority = $val if (defined($val=get_override_val($data, $subkey, 'priority')));
+ $depends = $val if (defined($val=get_override_val($data, $subkey, 'depends')));
+ $bdepends = $val if (defined($val=get_override_val($data, $subkey, 'bdepends')));
+ $bdependsi = $val if (defined($val=get_override_val($data, $subkey, 'bdependsi')));
+ $desc = $val if (defined($val=get_override_val($data, $subkey, 'desc')));
+ $longdesc = $val if (defined($val=get_override_val($data, $subkey, 'longdesc')));
+ $pkgversion = $val if (defined($val=get_override_val($data, $subkey, 'version')));
+ $arch = $val if (defined($val=get_override_val($data, $subkey, 'arch')));
+ $changelog = $val if (defined($val=get_override_val($data, $subkey, 'changelog')));
+ @docs = split(/\s+/, $val) if (defined($val=get_override_val($data, $subkey, 'docs')));
+
+ $extrasfields = $val if (defined($val=get_override_val($data, $subkey, 'sfields')));
+ $extrapfields = $val if (defined($val=get_override_val($data, $subkey, 'pfields')));
+ $maintainer = $val if (defined($val=get_override_val($data, $subkey, 'maintainer')));
+ # fix longdesc if needed
+ $longdesc =~ s/^\s*/ /mg;
+}
+
+sub apply_final_overrides {
+ my ($data, $val, $subkey);
+
+ ($data, $subkey) = get_override_data();
+ return unless defined $data;
+ get_override_val($data, $subkey, 'finish');
+}
+
+sub get_override_data {
+ my ($data, $checkver, $subkey);
+ $data = $overrides{$perlname};
+
+ return unless defined $data;
+ die "Value of '$perlname' in overrides not a hashref\n" unless ref($data) eq 'HASH';
+ if (defined($checkver = $data->{checkver})) {
+ die "checkver not a function\n" unless (ref($checkver) eq 'CODE');
+ $subkey = &$checkver($maindir);
+ } else {
+ $subkey = $pkgversion;
+ }
+ return ($data, $subkey);
+}
+
+sub get_override_val {
+ my ($data, $subkey, $key, $val);
+ ($data, $subkey, $key) = @_;
+ $val = defined($data->{$subkey.$key})?$data->{$subkey.$key}:$data->{$key};
+ return &$val() if (defined($val) && ref($val) eq 'CODE');
+ return $val;
+}
+
+sub _warn_incomplete_copyright {
+ print '*'x10, '
+Copyright information incomplete!
+
+Upstream copyright information could not be automatically determined.
+
+If you are building this package for your personal use, you might disregard
+this information; however, if you intend to upload this package to Debian
+(or in general, if you plan on distributing it), you must look into the
+complete copyright information.
+
+The causes for this warning are:
+', @_;
+}
+
+sub _file_r {
+ my ($file, $fh);
+ $file = shift;
+ $fh = IO::File->new($file, 'r') or die "Cannot open $file: $!\n";
+ return $fh;
+}
+
+sub _file_w {
+ my ($file, $fh);
+ $file = shift;
+ $fh = IO::File->new($file, 'w') or die "Cannot open $file: $!\n";
+ return $fh;
+}
+
+sub _file_rw {
+ my ($file, $fh);
+ $file = shift;
+ $fh = IO::File->new($file, 'r+') or die "Cannot open $file: $!\n";
+ return $fh;
+}
+
+=head1 NAME
+
+B<dh-make-perl> - Create debian source packages from perl modules
+
+=head1 SYNOPSIS
+
+B<dh-make-perl> [B<SOURCE_DIR> | B<--cpan> I<MODULE>]
+
+B<dh-make-perl> B<--refresh>
+
+You can modify B<dh-make-perl>'s behaviour with some switches:
+
+=over
+
+=item B<--desc> I<SHORT DESCRIPTION>
+
+Uses the argument to --desc as short description for the package.
+
+=item B<--arch> I<any> | I<all>
+
+This switches between arch-dependent and arch-independet packages. If B<--arch>
+isn't used, B<dh-make-perl> uses a relatively good-working algorithms to
+decide this alone.
+
+=item B<--version> I<VERSION>
+
+Specifies the version of the resulting package.
+
+=item B<--email> | B<-e> I<EMAIL>
+
+Manually specify the Maintainer email address to use in debian/control and
+in debian/changelog.
+
+=item B<--packagename> | B<-p> I<PACKAGENAME>
+
+Manually specify the Package Name, useful when the module has dashes in its
+name.
+
+=item B<--closes> I<ITPBUG>
+
+Manually specify the ITP bug number that this package closes. If not
+given, dh-make-perl will try to connect to bugs.debian.org to fetch the
+appropriate bug number, using WWW::Mechanize.
+
+=item B<--depends> I<DEPENDS>
+
+Manually specify the string to be used for the module's dependencies. This
+should be used when building modules where dh-make-perl cannot guess the Perl
+dependencies (such as modules built using L<Module::Install>), or when the
+Perl code depends on non-Perl binaries or libraries. Usually, dh-make-perl
+will figure out the dependencies by itself. If you need to pass dh-make-perl
+dependency information, you must do it using the debian package format. i.e.
+
+dh-make-perl --depends libtest-more-perl
+
+=item B<--bdepends> I<BUILD-DEPENDS>
+
+Manually specify the string to be used for the module's build-dependencies
+(that is, the packages and their versions that have to be installed in order to
+successfully build the package). Keep in mind that packages generated by
+dh-make-perl require debhelper to be specified as a build dependency. Same note
+as for --depends applies here - Use only when needed.
+
+=item B<--bdependsi> I<BUILD-DEPENDS-INDEP>
+
+Manually specify the string to be used for the module's build-dependencies
+for architecture-independent builds. Same notes as those for the --depends
+and --bdepends options apply here.
+
+Note that for --depends, --bdepends and --bdependsi you can also specify that
+the field should not appear in debian/rules (if you really mean it, of course
+;-) ) by giving it an empty string as an argument.
+
+=item B<--pkg-perl>
+
+Useful when preparing a package for the Debian Perl Group
+L<http://pkg-perl.alioth.debian.org>.
+
+Sets C<Maintainer>, C<Uploaders>, C<Vcs-Svn> and C<Vcs-Browser> fields in
+debian/control accordingly.
+
+=item B<--cpan-mirror> I<MIRROR>
+
+Specifies a CPAN site to use as mirror.
+
+=item B<--exclude> | B<-i> [I<REGEX>]
+
+This allows you to specify a PCRE to exclude some files from the search for
+docs and stuff like that. If no argument is given (but the switch is specified
+- not specifying the switch will include everything), it defaults to exclude
+CVS and .svn directories.
+
+=item B<--build>
+
+Builds the package after setting it up.
+
+NB: This builds only a binary package (by calling "fakeroot debian/rules
+binary") and does not sign the package. It is meant for a quick local
+install of a package, not for creating a package ready for submission to the
+Debian archive.
+
+=item B<--install>
+
+Installs the freshly built package. Specifying --install implies --build - The
+package will not be installed unless it was built (obviously ;-) )
+
+=item B<--notest>
+
+Does not run the automatic testing of the module as part of the build script.
+This is mostly useful when packaging buggy or incomplete software.
+
+=item B<--basepkgs>
+
+Explicitly gives a comma-separated list of packages to consider "base"
+packages (i.e. packages that should always be available in Debian
+systems). This option defaults to C<perl,perl-base,perl-modules> - It
+is used to check for module dependencies. If a needed module is in the
+C<basepkgs>, it won't be mentioned in the C<depends:> field of
+C<debian/control>.
+
+If this option is specified, the above mentioned default packages will
+not be included (but will be mentioned as explicit dependencies in the
+resulting package). You can, of course, mention your own modules
+and explicitly specify the default values.
+
+Note that this option should be used sparsingly and with care, as it
+might lead to packages not being rebuildable because of unfulfilled
+dependencies.
+
+=item B<--requiredeps>
+
+Fail if a dependency perl package was not found (dependency tracking
+requires the apt-file package installed and updated)
+
+=item B<--core-ok>
+
+Allows building core Perl modules. By default, dh-make-perl will not allow
+building a module that is shipped as part of the standard Perl library; by
+specifying this option, dh-make-perl will build them anyway.
+
+Note that, although it is not probable, this might break unrelated items in
+your system - If a newer version of a core module breaks the API, all kinds
+of daemons might get upset ;-)
+
+=item B<--refresh>
+
+Refresh mode.
+
+Instead of creating new debian/ directory, B<--refresh> makes B<dh-make-perl>
+to re-create only B<debian/rules> according to the current templates.
+
+This is useful when B<debian/rules> was created using older templates and
+doesn't contain much customisations. As always, you're strongly encouraged to
+verify if B<debian/rules> looks sane.
+
+=back
+
+=item B<--dh ver>
+
+Set desired debhelper version. If C<ver> is 7, generated debian/rules is
+minimalistic, using the auto-mode of debhelper. Also, any additional
+documentation and examples are listed in additional files under debian/, instead
+of being listed in debian/rules
+
+=back
+
+=head1 DESCRIPTION
+
+B<dh-make-perl> will create the files required to build
+a debian source package out of a perl package.
+This works for most simple packages and is also useful
+for getting started with packaging perl modules.
+
+You can specify a module name with the B<--cpan> switch
+and B<dh-make-perl> will download the module for you from
+a CPAN mirror, or you can specify the directory with the
+already unpacked sources. If neither --cpan nor a directory
+is given as argument, dh-make-perl tries to create a
+perl package from the data in F<.>
+
+There is an override mechanism in place to handle most of
+the little changes that may be needed for some modules
+(this hasn't been tested much, though, and the override
+database needs to be filled in).
+
+You can build and install the debian package using the --build
+and --install command line switches.
+
+Using this program is no excuse for not reading the
+debian developer documentation, including the Debian policy,
+the perl policy, the packaging manual and so on.
+
+=head1 FILES
+
+The following directories will be searched to find additional files
+required by dh-make-perl:
+
+ /usr/share/dh-make-perl/
+ $HOME/.dh-make-perl/
+
+=over 4
+
+=item * overrides
+
+File that overrides information retreived (or guessed) about the package.
+All the files in the library directories are loaded: entries in the home
+take precedence. See the distributed overrides file for usage information.
+
+=item * rules.MakeMaker.noxs
+
+A debian/rules makefile for modules that use ExtUtils::MakeMaker, but don't
+have C/XS code.
+
+=item * rules.MakeMaker.xs
+
+A debian/rules makefile for modules that use ExtUtils::MakerMaker and
+C/XS code.
+
+=item * rules.Module-Build.noxs
+
+A debian/rules makefile for modules that use Module::Build, but don't have
+C/XS code.
+
+=item * rules.Module-Build.xs
+
+A debian/rules makefile for modules that use Module::Build and C/XS code.
+
+=back
+
+=head1 ENVIRONMENT
+
+HOME - get user's home directory
+
+DEBFULLNAME - get the real name of the maintainer
+
+LOGNAME or USER - get the username
+
+DEBEMAIL or EMAIL - get the email address of the user
+
+=head1 BUGS
+
+Several, let me know when you find them.
+
+=head1 AUTHOR
+
+Paolo Molaro E<lt>lupus@debian.orgE<gt> (MIA)
+
+Maintained for a time by Ivan Kohler E<lt>ivan-debian@420.amE<gt>.
+
+Maintained for a time by Marc Brockschmdit E<lt>marc@dch-faq.deE<gt>.
+
+Now maintained by Gunnar Wolf E<lt>gwolf@gwolf.orgE<gt>, and team-maintained
+by the Debian pkg-perl team, http://alioth.debian.org/projects/pkg-perl
+
+Patches from:
+
+=over
+
+=item Adam Sjoegren E<lt>asjo@koldfront.dkE<gt>
+
+=item Adrian Phillips E<lt>adrianp@powertech.noE<gt>
+
+=item Amos Shapira E<lt>amos.shapira@gmail.comE<gt>
+
+=item Christian Kurz E<lt>shorty@debian.orgE<gt>
+
+=item Damyan Ivanov E<lt>divanov@creditreform.bgE<gt>
+
+=item David Paleino E<lt>d.paleino@gmail.comE<gt>
+
+=item David Pashley E<lt>david@davidpashley.comE<gt>
+
+=item Edward Betts E<lt>edward@debian.orgE<gt>
+
+=item Fermin Galan E<lt>galan@dit.upm.esE<gt>
+
+=item Geoff Richards E<lt>qef@ungwe.orgE<gt>
+
+=item Gergely Nagy E<lt>algernon@bonehunter.rulez.orgE<gt>
+
+=item gregor herrmann E<lt>gregoa@debian.orgE<gt>
+
+=item Hilko Bengen E<lt>bengen@debian.orgE<gt>
+
+=item Kees Cook E<lt>keex@outflux.netE<gt>
+
+=item Jesper Krogh E<lt>jesper@krogh.ccE<gt>
+
+=item Johnny Morano E<lt>jmorano@moretrix.comE<gt>
+
+=item Juerd E<lt>juerd@ouranos.juerd.netE<gt>
+
+=item Marc Chantreux (mail withheld)
+
+=item Matt Hope E<lt>dopey@debian.orgE<gt>
+
+=item Noel Maddy E<lt>noel@zhtwn.comE<gt>
+
+=item Oliver Gorwits E<lt>oliver.gorwits@oucs.ox.ac.ukE<gt>
+
+=item Peter Moerch E<lt>mn3k66i02@sneakemail.comE<gt>
+
+=item Stephen Oberholtzer E<lt>oliverklozoff@gmail.comE<gt>
+
+=item Ton Nijkes E<lt>tonn@wau.mis.ah.nlE<gt>
+
+=back
+
+... And others who, sadly, we have forgot to add :-/
+
+=cut
+
--- /dev/null
+dh_installdirs
+dh_installdocs
+dh_installman
+dh_installchangelogs
+dh_compress
+dh_fixperms
+dh_installdeb
+dh_perl
+dh_gencontrol
+dh_md5sums
+dh_builddeb
--- /dev/null
+perl:Depends=perl
+misc:Depends=
--- /dev/null
+Package: dh-make-perl
+Version: 0.47maemo1
+Section: devel
+Priority: optional
+Architecture: all
+Depends: debhelper (>= 4.0.2), libpod-parser-perl, perl, make, dpkg-dev, fakeroot, libyaml-perl, libmodule-depends-perl, libwww-mechanize-perl, libemail-date-format-perl
+Recommends: apt-file (>= 2.1.0), libmodule-build-perl
+Installed-Size: 144
+Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
+Description: Create Debian packages from perl modules
+ dh-make-perl will create the files required to build a Debian source
+ package out of a perl package. This works for most simple packages
+ and is also useful for getting started with packaging perl modules.
+ Given a perl package name, it can also automatically download it from
+ CPAN.
--- /dev/null
+f40ab4632be652bc04f3cd68b3e0af86 usr/share/dh-make-perl/overrides
+9afc98c99fd9c652920554b84f754563 usr/share/dh-make-perl/rules.dh7.xs
+215c5b3939d905f8a31df650d9032fed usr/share/dh-make-perl/rules.dh7.noxs
+8ae1f54f8a0a87b0fd50a79c1e18087e usr/share/dh-make-perl/rules.MakeMaker.noxs
+55d946a21b019e1449f41211cfffd150 usr/share/dh-make-perl/rules.MakeMaker.xs
+3277f7ab796a051be9ec5b48b4d54acf usr/share/dh-make-perl/rules.Module-Build.xs
+777b868dc8a463e0a8bd436e735d5b30 usr/share/dh-make-perl/rules.Module-Build.noxs
+c4754c02a471205249e63a13dcffd6b7 usr/share/doc/dh-make-perl/copyright
+3b26ea702726f48c57c091e08835a043 usr/share/doc/dh-make-perl/changelog.gz
+7151cadfb192b6338d8b3bb93ba99252 usr/share/doc/dh-make-perl/README
+9441a814c77edf7f9608ef723d568c45 usr/share/man/man1/dh-make-perl.1.gz
+5f40abbf6bd05fbf1be2e06bca04d0bc usr/bin/dh-make-perl
--- /dev/null
+#!/usr/bin/perl -w
+use Pod::Parser;
+use YAML;
+use IO::File;
+use File::Basename;
+use File::Find;
+use File::Copy qw(copy move);
+use User::pwent;
+use Getopt::Long;
+use Cwd;
+use CPAN;
+use Module::Depends::Intrusive;
+use Email::Date::Format qw(email_date);
+use strict;
+
+# TODO:
+# * get more info from the package (maybe using CPAN methods)
+
+######################################################################
+# This Pod::Parser must be declared before the main program flow. If you
+# are trying to figure out what happens inside dh-make-perl, skip down
+# until 'package main'.
+package MyPod;
+
+@MyPod::ISA = qw(Pod::Parser);
+
+sub set_names {
+ my ($parser, @names) = @_;
+ foreach my $n (@names) {
+ $parser->{_deb_}->{$n} = undef;
+ }
+}
+
+sub get {
+ my ($parser, $name) = @_;
+ $parser->{_deb_}->{$name};
+}
+
+sub cleanup {
+ my $parser = shift;
+ delete $parser->{_current_};
+ foreach my $k ( keys %{$parser->{_deb_}}) {
+ $parser->{_deb_}->{$k} = undef;
+ }
+}
+
+sub command {
+ my ($parser, $command, $paragraph, $line_num) = @_;
+ $paragraph =~ s/\s+$//s;
+ if ($command =~ /head/ && exists($parser->{_deb_}->{$paragraph})) {
+ $parser->{_current_} = $paragraph;
+ $parser->{_lineno_} = $line_num;
+ } else {
+ delete $parser->{_current_};
+ }
+ #print "GOT: $command -> $paragraph\n";
+}
+
+sub add_text {
+ my ($parser, $paragraph, $line_num) = @_;
+ return unless exists $parser->{_current_};
+ return if ($line_num - $parser->{_lineno_} > 15);
+ $paragraph =~ s/^\s+//s;
+ $paragraph =~ s/\s+$//s;
+ $paragraph = $parser->interpolate($paragraph, $line_num);
+ $parser->{_deb_}->{$parser->{_current_}} .= "\n\n".$paragraph;
+ #print "GOTT: $paragraph'\n";
+}
+
+sub verbatim { shift->add_text(@_)}
+
+sub textblock { shift->add_text(@_)}
+
+sub interior_sequence {
+ my ($parser, $seq_command, $seq_argument) = @_;
+ if ($seq_command eq 'E') {
+ my %map = ('gt' => '>', 'lt' => '<', 'sol' => '/', 'verbar' => '|');
+ return $map{$seq_argument} if exists $map{$seq_argument};
+ return chr($seq_argument) if ($seq_argument =~ /^\d+$/);
+ # html names...
+ }
+ return $seq_argument;
+}
+
+######################################################################
+# Main dh-make-perl starts here, don't look any further!
+package main;
+my (@stdmodules, $min_perl_version, $debstdversion, $priority, $section,
+ $depends, $bdepends, $bdependsi, $maintainer, $arch, $closes, $date,
+ $debiandir, $startdir, $datadir, $homedir, $email);
+our %overrides;
+
+$debstdversion = '3.8.0';
+$priority = 'optional';
+$section = 'perl';
+$depends = '${perl:Depends}';
+# 5.6.0-12 is where arch-indep modules are moved in /usr/share/perl5
+# (according to dh_perl)
+# if the module has stricter requirements, this build-dependency
+# is replaced below by calling substitute_perl_dependency
+$min_perl_version = '5.6.10-12';
+$bdependsi = "perl (>= $min_perl_version)";
+$arch = 'all';
+$date = email_date(time);
+$startdir = getcwd();
+$datadir = '/usr/share/dh-make-perl';
+$homedir = "$ENV{HOME}/.dh-make-perl";
+
+my ($perlname, $maindir, $modulepm, $meta);
+my ($pkgname, $srcname,
+ # $version is the version from the perl module itself
+ $version,
+ # $pkgversion is the resulting version of the package: User's
+ # --version=s or "$version-1"
+ $pkgversion,
+ $desc, $longdesc, $copyright, $author, $upsurl);
+my ($extrasfields, $extrapfields);
+my ($module_build);
+my (@docs, @examples, $changelog, @args);
+
+my %opts = (
+ 'dh' => 5,
+);
+
+my $mod_cpan_version;
+
+$opts{dbflags} = $>==0?"":"-rfakeroot";
+chomp($date);
+
+GetOptions(\%opts,
+ 'arch=s', 'basepkgs=s', 'bdepends=s', 'bdependsi=s',
+ 'build!', 'core-ok', 'cpan=s', 'cpanplus=s', 'closes=i',
+ 'cpan-mirror=s', 'dbflags=s', 'depends=s', 'desc=s',
+ 'exclude|i=s', 'help', 'install!', 'nometa', 'notest',
+ 'pkg-perl!', 'requiredeps', 'version=s', 'e=s', 'email=s',
+ 'p=s', 'packagename=s', 'refresh|R', 'dh=i'
+) or die usage_instructions();
+
+$bdepends = "debhelper (>= $opts{dh})";
+@stdmodules = get_stdmodules();
+
+# Help requested? Nice, we can just die! Isn't it helpful?
+die usage_instructions() if $opts{help};
+die "CPANPLUS support disabled, sorry" if $opts{cpanplus};
+
+$opts{exclude} = '(?:\/|^)(?:CVS|\.svn)\/' if (!defined $opts{exclude} or
+ $opts{exclude} eq '');
+
+$arch = $opts{arch} if defined $opts{arch};
+
+if ( $opts{refresh} )
+{
+ print "Engaging refresh mode\n";
+ $maindir='.';
+ $meta = process_meta("$maindir/META.yml") if (-f "$maindir/META.yml"); # package name
+ ($pkgname, $version) = extract_basic(); # also detects arch-dep package
+ $module_build = (-f "$maindir/Build.PL") ? "Module-Build" : "MakeMaker";
+ $debiandir='./debian';
+ extract_changelog($maindir);
+ extract_docs($maindir);
+ extract_examples($maindir);
+ print "Found changelog: $changelog\n" if defined $changelog;
+ print "Found docs: @docs\n";
+ print "Found examples: @examples\n" if @examples;
+ create_rules("$debiandir/rules");
+ fix_rules(
+ "$debiandir/rules",
+ (defined $changelog ? $changelog : ''),
+ \@docs, \@examples,
+ );
+ print "Done\n";
+ exit 0;
+}
+
+load_overrides();
+my $tarball = setup_dir();
+$meta = process_meta("$maindir/META.yml") if (-f "$maindir/META.yml");
+findbin_fix();
+
+if (defined $opts{e}) {
+ $email = $opts{e};
+} elsif (defined $opts{email}) {
+ $email = $opts{email};
+} else {
+ $email = '';
+}
+$maintainer = get_maintainer($email);
+
+if (defined $opts{desc}) {
+ $desc = $opts{desc};
+} else {
+ $desc = '';
+}
+($pkgname, $version) = extract_basic();
+if (defined $opts{p}) {
+ $pkgname = $opts{p};
+} elsif (defined $opts{packagename}) {
+ $pkgname = $opts{packagename};
+}
+unless (defined $opts{version}) {
+ $pkgversion = $version . "-1";
+} else {
+ $pkgversion = $opts{version};
+}
+
+move ($tarball, dirname($tarball) . "/${pkgname}_${version}.orig.tar.gz") if ($tarball && $tarball =~ /(?:\.tar\.gz|\.tgz)$/);
+$module_build = (-f "$maindir/Build.PL") ? "Module-Build" : "MakeMaker";
+extract_changelog($maindir);
+extract_docs($maindir);
+extract_examples($maindir);
+
+if (defined $opts{bdepends}) {
+ $bdepends = $opts{bdepends};
+} else {
+ $bdepends .= ', libmodule-build-perl' if ($module_build eq "Module-Build");
+}
+$bdependsi = $opts{bdependsi} if defined $opts{bdependsi};
+
+if (defined $opts{depends}) {
+ $depends = $opts{depends};
+} else {
+ $depends .= ', ${shlibs:Depends}' if $arch eq 'any';
+ $depends .= ', ${misc:Depends}';
+ my $extradeps = extract_depends($maindir, $meta);
+ $depends .= ( $extradeps ? ", $extradeps" : '' );
+}
+
+apply_overrides();
+
+die "Cannot find a description for the package: use the --desc switch\n"
+ unless $desc;
+print "Package does not provide a long description - " ,
+ " Please fill it in manually.\n"
+ if (!defined $longdesc or $longdesc =~ /^\s*\.?\s*$/);
+print "Using maintainer: $maintainer\n";
+print "Found changelog: $changelog\n" if defined $changelog;
+print "Found docs: @docs\n";
+print "Found examples: @examples\n" if @examples;
+-d $debiandir && die "The directory $debiandir is already present and I won't overwrite it: remove it yourself.\n";
+# start writing out the data
+mkdir ($debiandir, 0755) || die "Cannot create $debiandir dir: $!\n";
+create_control("$debiandir/control");
+if (defined $opts{closes}) {
+ $closes = $opts{closes};
+} else {
+ $closes = get_itp($pkgname);
+}
+create_changelog("$debiandir/changelog", $closes);
+create_rules("$debiandir/rules");
+create_compat("$debiandir/compat");
+create_watch("$debiandir/watch") if $upsurl;
+#create_readme("$debiandir/README.Debian");
+create_copyright("$debiandir/copyright");
+fix_rules("$debiandir/rules", (defined $changelog ? $changelog : ''), \@docs, \@examples);
+apply_final_overrides();
+build_package($maindir) if $opts{build} or $opts{install};
+install_package($debiandir) if $opts{install};
+print "Done\n";
+exit(0);
+
+sub usage_instructions {
+return <<"USAGE"
+Usage:
+$0 [ --build ] [ --install ] [ SOURCE_DIR | --cpan MODULE ]
+$0 --refresh|-R
+Other options: [ --desc DESCRIPTION ] [ --arch all|any ] [ --version VERSION ]
+ [ --depends DEPENDS ] [ --bdepends BUILD-DEPENDS ]
+ [ --bdependsi BUILD-DEPENDS-INDEP ] [ --cpan-mirror MIRROR ]
+ [ --exclude|-i [REGEX] ] [ --notest ] [ --nometa ]
+ [ --requiredeps ] [ --core-ok ] [ --basepkgs PKGSLIST ]
+ [ --closes ITPBUG ] [ --packagename|-p PACKAGENAME ]
+ [ --email|-e EMAIL ] [ --pkg-perl ] [ --dh <ver> ]
+USAGE
+}
+
+sub get_stdmodules {
+ my ($base_packages, @modules, $paths);
+ $base_packages = $opts{basepkgs} || 'perl,perl-base,perl-modules';
+
+ # We will check on all the base Perl packages for the modules they provide.
+ # To know which files we care for, we look at @INC - In a format easy to
+ # integrate into a regex
+ $paths = join('|', @INC);
+
+ for my $pkg (split(/,/,$base_packages)) {
+ for my $file (map {chomp;$_} `dpkg -L $pkg`) {
+ next unless $file =~ s!^(?:$paths)[\d\.]*/(.*).pm$!$1!x;
+
+ $file =~ s!/!::!g;
+ push @modules, $file;
+ }
+ }
+
+ return sort @modules;
+}
+
+sub setup_dir {
+ my ($dist, $mod, $cpanversion, $tarball);
+ $mod_cpan_version = '';
+ if ($opts{cpan}) {
+ my ($new_maindir);
+ # Is the module a core module?
+ if (grep(/$opts{cpan}/, @stdmodules)) {
+ die "$opts{cpan} is a standard module.\n"
+ unless $opts{'core-ok'};
+ }
+
+ # Make CPAN happy, make the user happy: Be more tolerant!
+ # Accept names to be specified with double-colon, dash or slash
+ $opts{cpan} =~ s![/-]!::!g;
+
+### require CPAN;
+ CPAN::Config->load;
+
+ unshift(@{$CPAN::Config->{'urllist'}}, $opts{'cpan-mirror'})
+ if $opts{'cpan-mirror'};
+
+ $CPAN::Config->{'build_dir'} = $ENV{'HOME'} . "/.cpan/build";
+ $CPAN::Config->{'cpan_home'} = $ENV{'HOME'} . "/.cpan/";
+ $CPAN::Config->{'histfile'} = $ENV{'HOME'} . "/.cpan/history";
+ $CPAN::Config->{'keep_source_where'} = $ENV{'HOME'} . "/.cpan/source";
+
+ # This modification allows to retrieve all the modules that
+ # match the user-provided string.
+ #
+ # expand() returns a list of matching items when called in list
+ # context, so after retrieving it, I try to match exactly what
+ # the user asked for. Specially important when there are
+ # different modules which only differ in case.
+ #
+ # This Closes: #451838
+ my @mod = CPAN::Shell->expand('Module', '/^'.$opts{cpan}.'$/')
+ or die "Can't find '$opts{cpan}' module on CPAN\n";
+ foreach(@mod) {
+ my $file = $_->cpan_file();
+ $file =~ s#.*/##; # remove directory
+ $file =~ s/(.*)-.*/$1/; # remove version and extension
+ $file =~ s/-/::/g; # convert dashes to colons
+ if($file eq $opts{cpan}) {
+ $mod = $_;
+ last;
+ }
+ }
+ $mod = shift @mod unless($mod);
+ $mod_cpan_version = $mod->cpan_version;
+ $cpanversion = $CPAN::VERSION;
+ $cpanversion =~ s/_.*//;
+
+ $tarball = $CPAN::Config->{'keep_source_where'} . "/authors/id/";
+
+ if ($cpanversion < 1.59) { # wild guess on the version number
+ $dist = $CPAN::META->instance('CPAN::Distribution', $mod->{CPAN_FILE});
+ $dist->get || die "Cannot get $mod->{CPAN_FILE}\n";
+ $tarball .= $mod->{CPAN_FILE};
+ $maindir = $dist->{'build_dir'};
+ } else {
+ # CPAN internals changed
+ $dist = $CPAN::META->instance('CPAN::Distribution', $mod->cpan_file);
+ $dist->get || die "Cannot get ", $mod->cpan_file, "\n";
+ $tarball .= $mod->cpan_file;
+ $maindir = $dist->dir;
+ }
+
+ copy ($tarball, $ENV{'PWD'});
+ $tarball = $ENV{'PWD'} . "/" . basename($tarball);
+ # build_dir contains a random part since 1.88_59
+ # use the new CPAN::Distribution::base_id (introduced in 1.91_53)
+ $new_maindir = $ENV{PWD} . "/" . (
+ $cpanversion < 1.9153 ? basename($maindir) : $dist->base_id
+ );
+ # rename existing directory
+ if (-d $new_maindir && system("mv", "$new_maindir", "$new_maindir.$$") == 0) {
+ print '='x70,"\n";
+ print "Unpacked tarball already existed, directory renamed to $new_maindir.$$\n";
+ print '='x70,"\n";
+ }
+ system("mv", "$maindir", "$new_maindir") == 0
+ or die "Failed to move $maindir to $new_maindir: $!";
+ $maindir = $new_maindir;
+
+ } elsif ($opts{cpanplus}) {
+ die "CPANPLUS support is b0rken at the moment.";
+# my ($cb, $href, $file);
+
+# eval "use CPANPLUS 0.045;";
+# $cb = CPANPLUS::Backend->new(conf => {debug => 1, verbose => 1});
+# $href = $cb->fetch( modules => [ $opts{cpanplus} ], fetchdir => $ENV{'PWD'});
+# die "Cannot get $opts{cpanplus}\n" if keys(%$href) != 1;
+# $file = (values %$href)[0];
+# print $file, "\n\n";
+# $maindir = $cb->extract( files => [ $file ], extractdir => $ENV{'PWD'} )->{$file};
+ } else {
+ $maindir = shift(@ARGV) || '.';
+ $maindir =~ s/\/$//;
+ }
+ return $tarball;
+}
+
+sub build_package {
+ my $maindir = shift;
+ # uhmf! dpkg-genchanges doesn't cope with the deb being in another dir..
+ #system("dpkg-buildpackage -b -us -uc $opts{dbflags}") == 0
+ system("fakeroot make -C $maindir -f debian/rules clean");
+ system("fakeroot make -C $maindir -f debian/rules binary") == 0
+ || die "Cannot create deb package\n";
+}
+
+sub install_package {
+ my ($archspec, $debname);
+
+ if ($arch eq 'any') {
+ $archspec = `dpkg --print-architecture`;
+ chomp($archspec);
+ } else {
+ $archspec = $arch;
+ }
+
+ $debname = "${pkgname}_$version-1_$archspec.deb";
+
+ system("dpkg -i $startdir/$debname") == 0
+ || die "Cannot install package $startdir/$debname\n";
+}
+
+sub process_meta {
+ my ($file, $yaml);
+ $file = shift;
+ # Command line option nometa causes this function not to be run
+ return {} if $opts{nometa};
+
+ # YAML::LoadFile has the bad habit of dying when it cannot properly parse
+ # a file - Catch it in an eval, and if it dies, return -again- just an
+ # empty hashref. Oh, were it not enough: It dies, but $! is not set, so we
+ # check against $@. Crap, crap, crap :-/
+ eval {
+ $yaml = YAML::LoadFile($file);
+ };
+ if ($@) {
+ print "Error parsing $file - Ignoring it.\n";
+ print "Please notify module upstream maintainer.\n";
+ $yaml = {};
+ }
+
+ # Returns a simple hashref with all the keys/values defined in META.yml
+ return $yaml;
+}
+
+sub extract_basic_copyright {
+ for my $f (qw(LICENSE LICENCE COPYING)) {
+ if (-f $f) {
+ return `cat $f`;
+ }
+ }
+ return undef;
+}
+
+sub extract_basic {
+ ($perlname, $version) = extract_name_ver();
+ find(\&check_for_xs, $maindir);
+ $pkgname = lc $perlname;
+ $pkgname = 'lib'.$pkgname unless $pkgname =~ /^lib/;
+ $pkgname .= '-perl' unless ($pkgname =~ /-perl$/ and $opts{cpan} !~ /::perl$/i);
+
+ # ensure policy compliant names and versions (from Joeyh)...
+ $pkgname =~ s/[^-.+a-zA-Z0-9]+/-/g;
+
+ $srcname = $pkgname;
+ $version =~ s/[^-.+a-zA-Z0-9]+/-/g;
+ $version = "0$version" unless $version =~ /^\d/;
+
+ print "Found: $perlname $version ($pkgname arch=$arch)\n";
+ $debiandir = "$maindir/debian";
+
+ $upsurl = "http://search.cpan.org/dist/$perlname/";
+
+ $copyright = extract_basic_copyright();
+ if ($modulepm) {
+ extract_desc($modulepm);
+ }
+
+ $opts{exclude} = '^$' unless $opts{exclude};
+ find(sub {
+ $File::Find::name !~ /$opts{exclude}/ &&
+ /\.(pm|pod)$/ &&
+ extract_desc($_);
+ }, $maindir);
+
+ return ($pkgname, $version);
+}
+
+sub makefile_pl {
+ return "$maindir/Makefile.PL";
+}
+
+sub findbin_fix {
+ # FindBin requires to know the name of the invoker - and requires it to be
+ # Makefile.PL to function properly :-/
+ $0 = makefile_pl();
+ if (exists $FindBin::{Bin}) {
+ FindBin::again();
+ }
+}
+
+sub extract_name_ver {
+ my ($name, $ver, $makefile);
+ $makefile = makefile_pl();
+
+ if (defined $meta->{name} and defined $meta->{version}) {
+ $name = $meta->{name};
+ $ver = $meta->{version};
+
+ } else {
+ ($name, $ver) = extract_name_ver_from_makefile($makefile);
+ }
+
+ $name =~ s/::/-/g;
+ return ($name, $ver);
+}
+
+sub extract_name_ver_from_makefile {
+ my ($file, $name, $ver, $vfrom, $dir, $makefile);
+ $makefile = shift;
+
+ {
+ local $/ = undef;
+ my $fh = _file_r($makefile);
+ $file = $fh->getline;
+ }
+
+ # Replace q[quotes] by "quotes"
+ $file =~ s/q\[(.+)]/'$1'/g;
+
+ # Get the name
+ if ($file =~ /([\'\"]?)
+ DISTNAME\1\s*
+ (=>|,)
+ \s*
+ ([\'\"]?)
+ (\S+)\3/xs) {
+ # Regular MakeMaker
+ $name = $4;
+ } elsif ($file =~ /([\'\"]?)
+ NAME\1\s*
+ (=>|,)
+ \s*
+ ([\'\"]?)
+ (\S+)\3/xs) {
+ # Regular MakeMaker
+ $name = $4;
+ } elsif ($file =~ /name
+ \s*
+ \(
+ ([\'\"]?)
+ (\S+)
+ \1
+ \);/xs) {
+ # Module::Install syntax
+ $name = $2;
+ }
+ $name =~ s/,.*$//;
+ # band aid: need to find a solution also for build in directories
+ # warn "name is $name (cpan name: $opts{cpan})\n";
+ $name = $opts{cpan} if ($name eq '__PACKAGE__' && $opts{cpan});
+ $name = $opts{cpanplus} if ($name eq '__PACKAGE__' && $opts{cpanplus});
+
+ # Get the version
+ if (defined $opts{version}) {
+ # Explicitly specified
+ $ver = $opts{version};
+
+ } elsif ($file =~ /([\'\"]?)VERSION\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s) {
+ # Regular MakeMaker
+ $ver = $4;
+ # Where is the version taken from?
+ $vfrom = $4 if
+ $file =~ /([\'\"]?)VERSION_FROM\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s;
+
+ } elsif ($file =~ /([\'\"]?)VERSION_FROM\1\s*(=>|,)\s*([\'\"]?)(\S+)\3/s) {
+ # Regular MakeMaker pointing to where the version is taken from
+ $vfrom = $4;
+
+ } elsif ($file =~ /version\((\S+)\)/s) {
+ # Module::Install
+ $ver = $1;
+ }
+
+ $dir = dirname($makefile) || './';
+
+ $modulepm = "$dir/$vfrom" if defined $vfrom;
+
+ for (($name, $ver)) {
+ next unless defined;
+ next unless /^\$/;
+ # decode simple vars
+ s/(\$\w+).*/$1/;
+ if ($file =~ /\Q$_\E\s*=\s*([\'\"]?)(\S+)\1\s*;/) {
+ $_ = $2;
+ }
+ }
+
+ unless (defined $ver) {
+ local $/ = "\n";
+ # apply the method used by makemaker
+ if (defined $dir and defined $vfrom and -f "$dir/$vfrom"
+ and -r "$dir/$vfrom") {
+ my $fh = _file_r("$dir/$vfrom");
+ while (my $lin = $fh->getline) {
+ if ($lin =~ /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/) {
+ no strict;
+ #warn "ver: $lin";
+ $ver = (eval $lin)[0];
+ last;
+ }
+ }
+ $fh->close;
+ } else {
+ if ( $mod_cpan_version ) {
+ $ver = $mod_cpan_version;
+ warn "Cannot use internal module data to gather the ".
+ "version; using cpan_version\n";
+ } else {
+ die "Cannot use internal module data to gather the ".
+ "version; use --cpan or --version\n";
+ }
+ }
+ }
+
+ return ($name, $ver);
+}
+
+sub extract_desc {
+ my ($file, $parser);
+ $file = shift;
+ $parser = new MyPod;
+ return unless -f $file;
+ $parser->set_names(qw(NAME DESCRIPTION DETAILS COPYRIGHT AUTHOR AUTHORS));
+ $parser->parse_from_file($file);
+ if ($desc) {
+ # No-op - We already have it, probably from the command line
+
+ } elsif ($meta->{abstract}) {
+ # Get it from META.yml
+ $desc = $meta->{abstract};
+
+ } elsif (my $my_desc = $parser->get('NAME')) {
+ # Parse it, fix it, send it!
+ $my_desc =~ s/^\s*\S+\s+-\s+//s;
+ $my_desc =~ s/^\s+//s;
+ $my_desc =~ s/\s+$//s;
+ $my_desc =~ s/^([^\s])/ $1/mg;
+ $my_desc =~ s/\n.*$//s;
+ $desc = $my_desc;
+ }
+ # Replace linefeeds (not followed by a space) in $desc with spaces
+ $desc =~ s/\n(?=\S)/ /gs;
+
+ unless ($longdesc) {
+ $longdesc = $parser->get('DESCRIPTION')
+ || $parser->get('DETAILS')
+ || $desc;
+ }
+ if (defined $longdesc && $longdesc !~ /^$/) {
+ $longdesc =~ s/^\s+//s;
+ $longdesc =~ s/\s+$//s;
+ $longdesc =~ s/^\t/ /mg;
+ $longdesc =~ s/^\s*$/ ./mg;
+ $longdesc =~ s/^\s*/ /mg;
+ $longdesc =~ s/^([^\s])/ $1/mg;
+ $longdesc =~ s/\r//g;
+ }
+
+ $copyright = $copyright || $parser->get('COPYRIGHT');
+ if (!$author) {
+ if (ref $meta->{author}) {
+ # Does the author information appear in META.yml?
+ $author = join(', ', @{$meta->{author}});
+ } else {
+ # Get it from the POD
+ $author = $parser->get('AUTHOR') || $parser->get('AUTHORS');
+ }
+ }
+
+ $parser->cleanup;
+}
+
+sub extract_changelog {
+ my ($dir) = shift;
+ $dir .= '/' unless $dir =~ m(/$);
+ find(sub {
+ $changelog = substr($File::Find::name, length($dir))
+ if (!defined($changelog) && /^change(s|log)$/i and (! $opts{exclude} or $File::Find::name !~ /$opts{exclude}/));
+ }, $dir);
+}
+
+sub extract_docs {
+ my ($dir) = shift;
+ $dir .= '/' unless $dir =~ m(/$);
+ find(sub {
+ push (@docs, substr($File::Find::name, length($dir)))
+ if (/^(README|TODO|BUGS|NEWS|ANNOUNCE)/i and (! $opts{exclude} or $File::Find::name !~ /$opts{exclude}/)) ;
+ }, $dir);
+}
+
+sub extract_examples {
+ my ($dir) = shift;
+ $dir .= '/' unless $dir =~ m(/$);
+ find(sub {
+ push (@examples, substr($File::Find::name, length($dir)) . '/*')
+ if (/^(examples|eg|samples?)$/i and (! $opts{exclude} or $File::Find::name !~ /$opts{exclude}/)) ;
+ }, $dir);
+}
+
+sub run_depends {
+ my ($depends_module, $dir) = @_;
+
+ no warnings;
+ local *STDERR;
+ open(STDERR, ">/dev/null");
+ my $mod_dep = $depends_module->new();
+
+ $mod_dep->dist_dir( $dir );
+ $mod_dep->find_modules();
+
+ my %dep_hash = %{$mod_dep->requires};
+
+ my $error = $mod_dep->error();
+ die "Error: $error\n" if $error;
+ return %dep_hash;
+}
+
+sub extract_depends {
+ my $dir = shift;
+ my $meta = shift;
+ my (%dep_hash, @uses, @deps, @not_debs, $has_apt_file);
+ local @INC = ($dir, @INC);
+
+ $dir .= '/' unless $dir =~ m/\/$/;
+
+ # try Module::Depends::Intrusive, but if that fails then
+ # fall back to Module::Depends.
+
+ eval {
+ %dep_hash = run_depends('Module::Depends::Intrusive',$dir);
+ };
+ if ($@) {
+ warn '='x70,"\n";
+ warn "First attempt (Module::Depends::Intrusive) at a dependency\n" .
+ "check failed. Possible use of Module::Install ?\n" .
+ "Trying again with Module::Depends ... \n";
+ warn '='x70,"\n";
+
+ eval {
+ %dep_hash = run_depends('Module::Depends',$dir);
+ };
+
+ if ($@) {
+ warn '='x70,"\n";
+ warn "Could not find the dependencies for the requested module.\n";
+ warn "Generated error: $@";
+
+ warn "Please check if your module depends on Module::Install\n" .
+ "for its build process - Automatically finding its\n" .
+ "dependencies is unsupported, please specify them manually\n" .
+ "using the 'depends' option. \n";
+ warn "Alternatively, including a META.yml file with dependencies\n" .
+ "should allow discovery even for Module::Install modules. \n";
+ warn '='x70,"\n";
+
+ exit 1;
+ }
+ }
+
+ foreach my $module (keys( %dep_hash )) {
+ next if (grep ( /^$module$/, @stdmodules));
+
+ push @uses, $module;
+ }
+
+ if (`which apt-file`) {
+ $has_apt_file = 1;
+ foreach my $module (@uses) {
+ my (@rawsearch, @search, $ls, $ver, $re, $mod);
+
+ if ($module eq 'perl') {
+ substitute_perl_dependency($dep_hash{perl});
+ next;
+ }
+
+ $mod = $module;
+ print "Searching for package containing $module using apt-file.\n";
+ $module =~ s|::|/|g;
+
+ # Regex's to search the return of apt-file to find the right pkg
+ $ls = '(?:lib|share)';
+ $ver = '\d+(\.\d+)+';
+ $re = "usr/(?:$ls/perl/$ver|$ls/perl5)/$module\\.pm";
+
+ @rawsearch = `apt-file search -x '$re'`;
+
+ # rank non -perl packages lower
+ @search = sort {
+ if ($a !~ /-perl: /) { return 1; }
+ elsif ($b !~ /-perl: /) { return -1; }
+ else { return $a cmp $b; } # or 0?
+ } @rawsearch;
+
+ for (@search) {
+ # apt-file output
+ # package-name: path/to/perl/module.pm
+ chomp;
+ my ($p, $f) = split / /, $_;
+ chop($p); #Get rid of the ":"
+ if ($f =~ /$re/ && !
+ grep { $_ eq $p } @deps, split(/,/,@stdmodules)) {
+ if (exists $dep_hash{$mod}) {
+ my $v = $dep_hash{$mod};
+ $v =~ s/^v//; # strip leading 'v' from version
+ push @deps, {name=>$p,
+ version=>$v};
+ } else {
+ push @deps, {name => $p};
+ }
+ last;
+ }
+ }
+
+ unless (@search) {
+ $module =~ s|/|::|g;
+ push @not_debs, $module;
+ }
+ }
+ } elsif ( $opts{requiredeps} ) {
+ die "--requiredeps was specified, but apt-file was not found\n";
+ }
+
+ print "\n";
+ print "Needs the following debian packages: " .
+ join (", ", map {$_->{name}} @deps) . "\n" if (@deps);
+ if (@not_debs) {
+ my ($missing_debs_str);
+ if ($has_apt_file) {
+ $missing_debs_str = join("\n", "Needs the following modules for which there are no debian packages available",
+ map({" - $_"} @not_debs), '');
+ } else {
+ $missing_debs_str = join("\n", "The following Perl modules are required and not installed in your system:",
+ map({" - $_"} @not_debs),
+ "You do not have 'apt-file' currently installed - If you install it, I will",
+ "be able to tell you which Debian packages are those modules in (if they are",
+ "packaged).");
+ }
+
+ if ( $opts{requiredeps} ) {
+ die $missing_debs_str;
+ } else {
+ print $missing_debs_str;
+ }
+
+ }
+
+ return join (", ", map { $_->{version} ?
+ $_->{name} ." (>= ". $_->{version} .")" :
+ $_->{name} } @deps);
+}
+
+sub get_itp {
+ use WWW::Mechanize;
+
+ my ($package) = shift @_;
+
+ my $wnpp = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=wnpp;includesubj=ITP: $package";
+ my $mech = WWW::Mechanize->new();
+
+ $mech->get($wnpp);
+
+ my @links = $mech->links();
+
+ foreach my $link (@links) {
+ my $desc = $link->text();
+
+ return $1 if $desc =~ /^#(\d+): ITP: $package /;
+ }
+ return 0;
+}
+
+sub substitute_perl_dependency {
+ # If we get 'perl' specified in here, the module requires a
+ # specific version of Perl in order to be run. This is only
+ # reliable if we have ${perl:Depends} in $depends and either
+ # of $bdepends and $bdependsi - Warn otherwise.
+ my ($version, $dep_str, $old_dep_str, $old_bdep_str);
+ $version = shift;
+
+ # Over-escaping? I'm putting this in variables to get a bit more clarity.
+ # Remember they will be fed into the regex engine.
+ $dep_str = "perl (>= $version)";
+ $old_dep_str = '\\$\\{perl:Depends\\}';
+ $old_bdep_str = "perl \\(>= $min_perl_version\\)";
+
+ unless ($depends =~ s/$old_dep_str/$dep_str/ and
+ ($bdepends =~ s/$old_bdep_str/$dep_str/ or
+ $bdependsi =~ s/$old_bdep_str/$dep_str/)) {
+ warn "The module requires Perl version $version, but you have ",
+ "apparently overriden the default dependency handling.\n",
+ "Please note that you might need to manually edit your debian/control ",
+ "- It might not make sense at all!\n";
+ }
+}
+
+sub check_for_xs {
+ (! $opts{exclude} or $File::Find::name !~ /$opts{exclude}/) && /\.(xs|c|cpp|cxx)$/i && do {
+ $arch = 'any';
+ };
+}
+
+sub fix_rules {
+ my ($rules_file, $changelog_file, $docs, $examples, $test_line, $fh, @content);
+ ($rules_file, $changelog_file, $docs, $examples) = @_;
+
+ if( $opts{dh} < 7 )
+ {
+ $test_line = ($module_build eq 'Module-Build') ?
+ '$(PERL) Build test' : '$(MAKE) test';
+ $test_line = "#$test_line" if $opts{notest};
+
+ $fh = _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: $!";
+ for (@content) {
+ s/#CHANGES#/$changelog_file/g;
+ s/#EXAMPLES#/join " ", @examples/eg;
+ s/\s+dh_installexamples\s+$//g; # no need for empty dh_installexamples
+ s/#DOCS#/join " ", @docs/eg;
+ s/#TEST#/$test_line/g;
+ $fh->print($_);
+ }
+ $fh->close;
+ }
+ else
+ {
+ if( @examples )
+ {
+ open F, '>>', "$maindir/debian/$pkgname.examples" or die $!;
+ print F "$_\n" foreach @examples;
+ close F;
+ }
+ if( @docs )
+ {
+ open F, '>>', "$maindir/debian/$pkgname.docs" or die $!;
+ print F "$_\n" foreach @docs;
+ close F;
+ }
+ }
+}
+
+sub create_control {
+ my $fh = _file_w(shift);
+
+ if ($arch ne 'all' and
+ !defined($opts{bdepends}) and !defined($opts{bdependsi})) {
+ $bdepends .= ", $bdependsi";
+ $bdependsi = '';
+ }
+
+ $fh->print("Source: $srcname\n");
+ $fh->print("Section: $section\n");
+ $fh->print("Priority: $priority\n");
+ $fh->print("Build-Depends: $bdepends\n") if $bdepends;
+ $fh->print("Build-Depends-Indep: $bdependsi\n") if $bdependsi;
+ $fh->print($extrasfields) if defined $extrasfields;
+ if( $opts{'pkg-perl'} )
+ {
+ $fh->print("Maintainer: Debian Perl Group <pkg-perl-maintainers\@lists.alioth.debian.org>\n");
+ $fh->print("Uploaders: $maintainer\n");
+ }
+ else
+ {
+ $fh->print("Maintainer: $maintainer\n");
+ }
+ $fh->print("Standards-Version: $debstdversion\n");
+ $fh->print("Homepage: $upsurl\n") if $upsurl;
+ do {
+ $fh->print("Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/$srcname/\n");
+ $fh->print("Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/$srcname/\n");
+ } if $opts{'pkg-perl'};
+ $fh->print("\n");
+ $fh->print("Package: $pkgname\n");
+ $fh->print("Architecture: $arch\n");
+ $fh->print("Depends: $depends\n") if $depends;
+ $fh->print($extrapfields) if defined $extrapfields;
+ $fh->print("Description: $desc\n$longdesc\n .\n This description was automagically extracted from the module by dh-make-perl.\n");
+ $fh->close;
+}
+
+sub create_changelog {
+ my $fh = _file_w(shift);
+ my $bug = shift;
+
+ my $closes = $bug ? " (Closes: #$bug)" : '';
+
+ $fh->print("$srcname ($pkgversion) unstable; urgency=low\n");
+ $fh->print("\n * Initial Release.$closes\n\n");
+ $fh->print(" -- $maintainer $date\n");
+ #$fh->print("Local variables:\nmode: debian-changelog\nEnd:\n");
+ $fh->close
+}
+
+sub create_rules {
+ my ($file, $rulesname, $error);
+ ($file) = shift;
+ $rulesname = (
+ ($opts{dh} eq 7)
+ ? $arch eq 'all'?'rules.dh7.noxs' :'rules.dh7.xs'
+ : $arch eq 'all'?"rules.$module_build.noxs":"rules.$module_build.xs"
+ );
+
+ for my $source (("$homedir/$rulesname", "$datadir/$rulesname")) {
+ copy($source, $file) && do {
+ print "Using rules: $source\n";
+ last;
+ };
+ $error = $!;
+ }
+ die "Cannot copy rules file ($rulesname): $error\n" unless -e $file;
+ chmod(0755, $file);
+}
+
+sub create_compat {
+ my $fh = _file_w(shift);
+ $fh->print("$opts{dh}\n");
+ $fh->close;
+}
+
+sub create_copyright {
+ my $fh = _file_w(shift);
+ my $incomplete = '';
+
+ $fh->print(
+"This is the debian package for the $perlname module.
+It was created by $maintainer using dh-make-perl.
+
+");
+ if (defined $upsurl) {
+ $fh->print("It was downloaded from $upsurl\n\n");
+ } else {
+ $incomplete .= "No upstream URL\n";
+ }
+ $fh->print(
+"This copyright info was automatically extracted from the perl module.
+It may not be accurate, so you better check the module sources
+if you don\'t want to get into legal troubles.
+
+");
+ if (defined $author) {
+ $fh->print("The upstream author is: $author.\n");
+ } else {
+ $incomplete .= "No upstream author\n";
+ }
+
+ if (defined($copyright)) {
+ $fh->print($copyright);
+ # Fun with regexes
+ if ( $copyright =~ /terms as Perl itself/i ) {
+ $fh->print("
+
+Perl is distributed under your choice of the GNU General Public License or
+the Artistic License. On Debian GNU/Linux systems, the complete text of the
+GNU General Public License can be found in \`/usr/share/common-licenses/GPL\'
+and the Artistic Licence in \`/usr/share/common-licenses/Artistic\'.
+");
+ } elsif ( $copyright =~ /GPL/ ) {
+ $fh->print("
+
+The full text of the GPL is available on Debian systems in
+/usr/share/common-licenses/GPL
+");
+ }
+ } else {
+ $incomplete .= "No licensing information\n";
+ }
+
+ my $year = (localtime)[5]+1900;
+ $fh->print("
+
+The Debian packaging is (C) $year, $maintainer and
+is licensed under the same terms as the software itself (see above).
+");
+
+ $fh->close;
+
+ if ($incomplete) {
+ _warn_incomplete_copyright($incomplete)
+ }
+}
+
+sub create_readme {
+ my $fh = _file_w(shift);
+ $fh->print(
+"This is the debian package for the $perlname module.
+It was created by $maintainer using dh-make-perl.
+");
+ $fh->close;
+}
+
+sub create_watch {
+ my $fh = _file_w(shift);
+
+ my $version_re = 'v?(\d[\d_.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)';
+
+ $fh->print(
+"\# format version number, currently 3; this line is compulsory!
+version=3
+\# URL to the package page followed by a regex to search
+$upsurl .*/$perlname-$version_re\$
+");
+ $fh->close;
+}
+
+sub get_maintainer {
+ my ($user, $pwnam, $email, $name, $mailh);
+ $user = $ENV{LOGNAME} || $ENV{USER};
+ $pwnam = getpwuid($<);
+ die "Cannot determine current user\n" unless $pwnam;
+ if (defined $ENV{DEBFULLNAME}) {
+ $name = $ENV{DEBFULLNAME};
+ } else {
+ $name = $pwnam->gecos;
+ $name =~ s/,.*//;
+ }
+ $user ||= $pwnam->name;
+ $name ||= $user;
+ $email = shift @_ || ($ENV{DEBEMAIL} || $ENV{EMAIL});
+ unless ($email) {
+ chomp($mailh = `cat /etc/mailname`);
+ $email = $user.'@'.$mailh;
+ }
+
+ $email =~ s/^(.*)\s+<(.*)>$/$2/;
+
+ return "$name <$email>";
+}
+
+sub load_overrides {
+ eval {
+ do "$datadir/overrides" if -f "$datadir/overrides";
+ do "$homedir/overrides" if -f "$homedir/overrides";
+ };
+ if ($@) {
+ die "Error when processing the overrides files: $@";
+ }
+}
+
+sub apply_overrides {
+ my ($data, $val, $subkey);
+
+ ($data, $subkey) = get_override_data();
+ return unless defined $data;
+ $pkgname = $val if (defined($val=get_override_val($data, $subkey, 'pkgname')));
+ $srcname = $val if (defined($val=get_override_val($data, $subkey, 'srcname')));
+ $section = $val if (defined($val=get_override_val($data, $subkey, 'section')));
+ $priority = $val if (defined($val=get_override_val($data, $subkey, 'priority')));
+ $depends = $val if (defined($val=get_override_val($data, $subkey, 'depends')));
+ $bdepends = $val if (defined($val=get_override_val($data, $subkey, 'bdepends')));
+ $bdependsi = $val if (defined($val=get_override_val($data, $subkey, 'bdependsi')));
+ $desc = $val if (defined($val=get_override_val($data, $subkey, 'desc')));
+ $longdesc = $val if (defined($val=get_override_val($data, $subkey, 'longdesc')));
+ $pkgversion = $val if (defined($val=get_override_val($data, $subkey, 'version')));
+ $arch = $val if (defined($val=get_override_val($data, $subkey, 'arch')));
+ $changelog = $val if (defined($val=get_override_val($data, $subkey, 'changelog')));
+ @docs = split(/\s+/, $val) if (defined($val=get_override_val($data, $subkey, 'docs')));
+
+ $extrasfields = $val if (defined($val=get_override_val($data, $subkey, 'sfields')));
+ $extrapfields = $val if (defined($val=get_override_val($data, $subkey, 'pfields')));
+ $maintainer = $val if (defined($val=get_override_val($data, $subkey, 'maintainer')));
+ # fix longdesc if needed
+ $longdesc =~ s/^\s*/ /mg;
+}
+
+sub apply_final_overrides {
+ my ($data, $val, $subkey);
+
+ ($data, $subkey) = get_override_data();
+ return unless defined $data;
+ get_override_val($data, $subkey, 'finish');
+}
+
+sub get_override_data {
+ my ($data, $checkver, $subkey);
+ $data = $overrides{$perlname};
+
+ return unless defined $data;
+ die "Value of '$perlname' in overrides not a hashref\n" unless ref($data) eq 'HASH';
+ if (defined($checkver = $data->{checkver})) {
+ die "checkver not a function\n" unless (ref($checkver) eq 'CODE');
+ $subkey = &$checkver($maindir);
+ } else {
+ $subkey = $pkgversion;
+ }
+ return ($data, $subkey);
+}
+
+sub get_override_val {
+ my ($data, $subkey, $key, $val);
+ ($data, $subkey, $key) = @_;
+ $val = defined($data->{$subkey.$key})?$data->{$subkey.$key}:$data->{$key};
+ return &$val() if (defined($val) && ref($val) eq 'CODE');
+ return $val;
+}
+
+sub _warn_incomplete_copyright {
+ print '*'x10, '
+Copyright information incomplete!
+
+Upstream copyright information could not be automatically determined.
+
+If you are building this package for your personal use, you might disregard
+this information; however, if you intend to upload this package to Debian
+(or in general, if you plan on distributing it), you must look into the
+complete copyright information.
+
+The causes for this warning are:
+', @_;
+}
+
+sub _file_r {
+ my ($file, $fh);
+ $file = shift;
+ $fh = IO::File->new($file, 'r') or die "Cannot open $file: $!\n";
+ return $fh;
+}
+
+sub _file_w {
+ my ($file, $fh);
+ $file = shift;
+ $fh = IO::File->new($file, 'w') or die "Cannot open $file: $!\n";
+ return $fh;
+}
+
+sub _file_rw {
+ my ($file, $fh);
+ $file = shift;
+ $fh = IO::File->new($file, 'r+') or die "Cannot open $file: $!\n";
+ return $fh;
+}
+
+=head1 NAME
+
+B<dh-make-perl> - Create debian source packages from perl modules
+
+=head1 SYNOPSIS
+
+B<dh-make-perl> [B<SOURCE_DIR> | B<--cpan> I<MODULE>]
+
+B<dh-make-perl> B<--refresh>
+
+You can modify B<dh-make-perl>'s behaviour with some switches:
+
+=over
+
+=item B<--desc> I<SHORT DESCRIPTION>
+
+Uses the argument to --desc as short description for the package.
+
+=item B<--arch> I<any> | I<all>
+
+This switches between arch-dependent and arch-independet packages. If B<--arch>
+isn't used, B<dh-make-perl> uses a relatively good-working algorithms to
+decide this alone.
+
+=item B<--version> I<VERSION>
+
+Specifies the version of the resulting package.
+
+=item B<--email> | B<-e> I<EMAIL>
+
+Manually specify the Maintainer email address to use in debian/control and
+in debian/changelog.
+
+=item B<--packagename> | B<-p> I<PACKAGENAME>
+
+Manually specify the Package Name, useful when the module has dashes in its
+name.
+
+=item B<--closes> I<ITPBUG>
+
+Manually specify the ITP bug number that this package closes. If not
+given, dh-make-perl will try to connect to bugs.debian.org to fetch the
+appropriate bug number, using WWW::Mechanize.
+
+=item B<--depends> I<DEPENDS>
+
+Manually specify the string to be used for the module's dependencies. This
+should be used when building modules where dh-make-perl cannot guess the Perl
+dependencies (such as modules built using L<Module::Install>), or when the
+Perl code depends on non-Perl binaries or libraries. Usually, dh-make-perl
+will figure out the dependencies by itself. If you need to pass dh-make-perl
+dependency information, you must do it using the debian package format. i.e.
+
+dh-make-perl --depends libtest-more-perl
+
+=item B<--bdepends> I<BUILD-DEPENDS>
+
+Manually specify the string to be used for the module's build-dependencies
+(that is, the packages and their versions that have to be installed in order to
+successfully build the package). Keep in mind that packages generated by
+dh-make-perl require debhelper to be specified as a build dependency. Same note
+as for --depends applies here - Use only when needed.
+
+=item B<--bdependsi> I<BUILD-DEPENDS-INDEP>
+
+Manually specify the string to be used for the module's build-dependencies
+for architecture-independent builds. Same notes as those for the --depends
+and --bdepends options apply here.
+
+Note that for --depends, --bdepends and --bdependsi you can also specify that
+the field should not appear in debian/rules (if you really mean it, of course
+;-) ) by giving it an empty string as an argument.
+
+=item B<--pkg-perl>
+
+Useful when preparing a package for the Debian Perl Group
+L<http://pkg-perl.alioth.debian.org>.
+
+Sets C<Maintainer>, C<Uploaders>, C<Vcs-Svn> and C<Vcs-Browser> fields in
+debian/control accordingly.
+
+=item B<--cpan-mirror> I<MIRROR>
+
+Specifies a CPAN site to use as mirror.
+
+=item B<--exclude> | B<-i> [I<REGEX>]
+
+This allows you to specify a PCRE to exclude some files from the search for
+docs and stuff like that. If no argument is given (but the switch is specified
+- not specifying the switch will include everything), it defaults to exclude
+CVS and .svn directories.
+
+=item B<--build>
+
+Builds the package after setting it up.
+
+NB: This builds only a binary package (by calling "fakeroot debian/rules
+binary") and does not sign the package. It is meant for a quick local
+install of a package, not for creating a package ready for submission to the
+Debian archive.
+
+=item B<--install>
+
+Installs the freshly built package. Specifying --install implies --build - The
+package will not be installed unless it was built (obviously ;-) )
+
+=item B<--notest>
+
+Does not run the automatic testing of the module as part of the build script.
+This is mostly useful when packaging buggy or incomplete software.
+
+=item B<--basepkgs>
+
+Explicitly gives a comma-separated list of packages to consider "base"
+packages (i.e. packages that should always be available in Debian
+systems). This option defaults to C<perl,perl-base,perl-modules> - It
+is used to check for module dependencies. If a needed module is in the
+C<basepkgs>, it won't be mentioned in the C<depends:> field of
+C<debian/control>.
+
+If this option is specified, the above mentioned default packages will
+not be included (but will be mentioned as explicit dependencies in the
+resulting package). You can, of course, mention your own modules
+and explicitly specify the default values.
+
+Note that this option should be used sparsingly and with care, as it
+might lead to packages not being rebuildable because of unfulfilled
+dependencies.
+
+=item B<--requiredeps>
+
+Fail if a dependency perl package was not found (dependency tracking
+requires the apt-file package installed and updated)
+
+=item B<--core-ok>
+
+Allows building core Perl modules. By default, dh-make-perl will not allow
+building a module that is shipped as part of the standard Perl library; by
+specifying this option, dh-make-perl will build them anyway.
+
+Note that, although it is not probable, this might break unrelated items in
+your system - If a newer version of a core module breaks the API, all kinds
+of daemons might get upset ;-)
+
+=item B<--refresh>
+
+Refresh mode.
+
+Instead of creating new debian/ directory, B<--refresh> makes B<dh-make-perl>
+to re-create only B<debian/rules> according to the current templates.
+
+This is useful when B<debian/rules> was created using older templates and
+doesn't contain much customisations. As always, you're strongly encouraged to
+verify if B<debian/rules> looks sane.
+
+=back
+
+=item B<--dh ver>
+
+Set desired debhelper version. If C<ver> is 7, generated debian/rules is
+minimalistic, using the auto-mode of debhelper. Also, any additional
+documentation and examples are listed in additional files under debian/, instead
+of being listed in debian/rules
+
+=back
+
+=head1 DESCRIPTION
+
+B<dh-make-perl> will create the files required to build
+a debian source package out of a perl package.
+This works for most simple packages and is also useful
+for getting started with packaging perl modules.
+
+You can specify a module name with the B<--cpan> switch
+and B<dh-make-perl> will download the module for you from
+a CPAN mirror, or you can specify the directory with the
+already unpacked sources. If neither --cpan nor a directory
+is given as argument, dh-make-perl tries to create a
+perl package from the data in F<.>
+
+There is an override mechanism in place to handle most of
+the little changes that may be needed for some modules
+(this hasn't been tested much, though, and the override
+database needs to be filled in).
+
+You can build and install the debian package using the --build
+and --install command line switches.
+
+Using this program is no excuse for not reading the
+debian developer documentation, including the Debian policy,
+the perl policy, the packaging manual and so on.
+
+=head1 FILES
+
+The following directories will be searched to find additional files
+required by dh-make-perl:
+
+ /usr/share/dh-make-perl/
+ $HOME/.dh-make-perl/
+
+=over 4
+
+=item * overrides
+
+File that overrides information retreived (or guessed) about the package.
+All the files in the library directories are loaded: entries in the home
+take precedence. See the distributed overrides file for usage information.
+
+=item * rules.MakeMaker.noxs
+
+A debian/rules makefile for modules that use ExtUtils::MakeMaker, but don't
+have C/XS code.
+
+=item * rules.MakeMaker.xs
+
+A debian/rules makefile for modules that use ExtUtils::MakerMaker and
+C/XS code.
+
+=item * rules.Module-Build.noxs
+
+A debian/rules makefile for modules that use Module::Build, but don't have
+C/XS code.
+
+=item * rules.Module-Build.xs
+
+A debian/rules makefile for modules that use Module::Build and C/XS code.
+
+=back
+
+=head1 ENVIRONMENT
+
+HOME - get user's home directory
+
+DEBFULLNAME - get the real name of the maintainer
+
+LOGNAME or USER - get the username
+
+DEBEMAIL or EMAIL - get the email address of the user
+
+=head1 BUGS
+
+Several, let me know when you find them.
+
+=head1 AUTHOR
+
+Paolo Molaro E<lt>lupus@debian.orgE<gt> (MIA)
+
+Maintained for a time by Ivan Kohler E<lt>ivan-debian@420.amE<gt>.
+
+Maintained for a time by Marc Brockschmdit E<lt>marc@dch-faq.deE<gt>.
+
+Now maintained by Gunnar Wolf E<lt>gwolf@gwolf.orgE<gt>, and team-maintained
+by the Debian pkg-perl team, http://alioth.debian.org/projects/pkg-perl
+
+Patches from:
+
+=over
+
+=item Adam Sjoegren E<lt>asjo@koldfront.dkE<gt>
+
+=item Adrian Phillips E<lt>adrianp@powertech.noE<gt>
+
+=item Amos Shapira E<lt>amos.shapira@gmail.comE<gt>
+
+=item Christian Kurz E<lt>shorty@debian.orgE<gt>
+
+=item Damyan Ivanov E<lt>divanov@creditreform.bgE<gt>
+
+=item David Paleino E<lt>d.paleino@gmail.comE<gt>
+
+=item David Pashley E<lt>david@davidpashley.comE<gt>
+
+=item Edward Betts E<lt>edward@debian.orgE<gt>
+
+=item Fermin Galan E<lt>galan@dit.upm.esE<gt>
+
+=item Geoff Richards E<lt>qef@ungwe.orgE<gt>
+
+=item Gergely Nagy E<lt>algernon@bonehunter.rulez.orgE<gt>
+
+=item gregor herrmann E<lt>gregoa@debian.orgE<gt>
+
+=item Hilko Bengen E<lt>bengen@debian.orgE<gt>
+
+=item Kees Cook E<lt>keex@outflux.netE<gt>
+
+=item Jesper Krogh E<lt>jesper@krogh.ccE<gt>
+
+=item Johnny Morano E<lt>jmorano@moretrix.comE<gt>
+
+=item Juerd E<lt>juerd@ouranos.juerd.netE<gt>
+
+=item Marc Chantreux (mail withheld)
+
+=item Matt Hope E<lt>dopey@debian.orgE<gt>
+
+=item Noel Maddy E<lt>noel@zhtwn.comE<gt>
+
+=item Oliver Gorwits E<lt>oliver.gorwits@oucs.ox.ac.ukE<gt>
+
+=item Peter Moerch E<lt>mn3k66i02@sneakemail.comE<gt>
+
+=item Stephen Oberholtzer E<lt>oliverklozoff@gmail.comE<gt>
+
+=item Ton Nijkes E<lt>tonn@wau.mis.ah.nlE<gt>
+
+=back
+
+... And others who, sadly, we have forgot to add :-/
+
+=cut
+
--- /dev/null
+# override file for dh-make-perl
+# chdir is set to the module dir while executing the code in the override hashes
+# you can have your own overrides to this overrides in a similar file
+# in ~/.dh-make-perl/overrides
+# Please contribute back the fixes that may be needed for some modules
+# to lupus@debian.org.
+
+# sample overrides entry
+$overrides{'Strange'} = {
+ pkgname => 'libstrange-perl',
+ srcname => 'libstrange-perl',
+ section => 'misc',
+ priority => 'Extra',
+ depends => 'perl6',
+ # build depends
+ bdepends => 'perl6, xlib-dev',
+ desc => 'A really ugly module to test dh-make-perl',
+ longdesc => "A really ugly long description\nfor a really ugly perl module.",
+ arch => 'all',
+ # starting from version 2 it's an xs module
+ checkver => sub {return 'v2-' if (($version || "") =~ /^[2-9]\./);return '';},
+ 'v2-arch' => 'any',
+ 'v2-version' => sub {
+ if (($version || "") =~ /^\d+\.(\d+)/ && length($1) < 3) {
+ return $version.("0"x(3-length($1))); # maitain 3 digits after the dot
+ } else {
+ return $version;
+ } },
+ # Note the \n in pfield and sfields (extra fields for the source and package section)
+ pfields => "Conflicts: ba-ba-buma\n",
+
+};
+
+$overrides{'Crypt::SSLeay'} = {
+ finish => sub {
+ my @a=("perl", "-pi", "-e", 's,(Makefile\.PL),$1 /usr,', "debian/rules");
+ system(@a);},
+};
+
--- /dev/null
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc@dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ # Add commands to compile the package here
+ $(PERL) Makefile.PL INSTALLDIRS=vendor
+ $(MAKE)
+ #TEST#
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ dh_clean build-stamp install-stamp
+ # Add commands to clean up after the build process here
+ [ ! -f Makefile ] || $(MAKE) realclean
+
+install: install-stamp
+install-stamp: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ # Add commands to install the package into $(TMP) here
+ $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+ [ ! -d $(TMP)/usr/lib/perl5 ] || \
+ rmdir --ignore-fail-on-non-empty --parents --verbose \
+ $(TMP)/usr/lib/perl5
+ touch $@
+
+binary-arch:
+# We have nothing to do here for an architecture-independent package
+
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+ dh_installexamples #EXAMPLES#
+ dh_installdocs #DOCS#
+ dh_installchangelogs #CHANGES#
+ dh_perl
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc@dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+# Allow disabling build optimisation by setting noopt in
+# $DEB_BUILD_OPTIONS
+CFLAGS = -Wall -g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ # Add commands to compile the package here
+ $(PERL) Makefile.PL INSTALLDIRS=vendor
+ $(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH=""
+ #TEST#
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ dh_clean build-stamp install-stamp
+ # Add commands to clean up after the build process here
+ [ ! -f Makefile ] || $(MAKE) realclean
+
+install: install-stamp
+install-stamp: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ # Add commands to install the package into $(TMP)
+ $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+ [ ! -d $(TMP)/usr/share/perl5 ] || \
+ rmdir --ignore-fail-on-non-empty --parents --verbose \
+ $(TMP)/usr/share/perl5
+ touch $@
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do here for an architecture-dependent package
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installexamples #EXAMPLES#
+ dh_installdocs #DOCS#
+ dh_installchangelogs #CHANGES#
+ dh_shlibdeps
+ dh_strip
+ dh_perl
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc@dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+#
+# It was later modified by Jason Kohles <email@jasonkohles.com>
+# http://www.jasonkohles.com/ to support Module::Build installed modules
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ # Add commands to compile the package here
+ $(PERL) Build.PL installdirs=vendor
+ $(PERL) Build
+ #TEST#
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ dh_clean build-stamp install-stamp
+ # Add commands to clean up after the build process here
+ [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
+
+install: install-stamp
+install-stamp: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ # Add commands to install the package into $(TMP) here
+ $(PERL) Build install destdir=$(TMP) create_packlist=0
+ touch $@
+
+binary-arch:
+# We have nothing to do here for an architecture-independent package
+
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+ dh_installdocs #DOCS#
+ dh_installexamples #EXAMPLES#
+ dh_installchangelogs #CHANGES#
+ dh_perl
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc@dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+# Allow disabling build optimisation by setting noopt in
+# $DEB_BUILD_OPTIONS
+CFLAGS = -Wall -g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ # Add commands to compile the package here
+ $(PERL) Build.PL installdirs=vendor config=optimize="$(CFLAGS)"
+ OPTIMIZE="$(CFLAGS)" $(PERL) Build
+ #TEST#
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ dh_clean build-stamp install-stamp
+ # Add commands to clean up after the build process here
+ [ ! -f Build ] || $(PERL) Build --allow_mb_mismatch 1 distclean
+
+install: install-stamp
+install-stamp: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ # Add commands to install the package into $(TMP) here
+ $(PERL) Build install destdir=$(TMP) create_packlist=0
+ touch $@
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do here for an architecture-dependent package
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installdocs #DOCS#
+ dh_installexamples #EXAMPLES#
+ dh_installchangelogs #CHANGES#
+ dh_shlibdeps
+ dh_strip
+ dh_perl
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+#!/usr/bin/make -f
+
+build: build-stamp
+build-stamp:
+ dh build
+ touch $@
+
+clean:
+ dh $@
+
+install: install-stamp
+install-stamp: build-stamp
+ dh install
+ touch $@
+
+binary-arch:
+
+binary-indep: install
+ dh $@
+
+binary: binary-arch binary-indep
+
+.PHONY: binary binary-arch binary-indep install clean build
--- /dev/null
+#!/usr/bin/make -f
+
+build: build-stamp
+build-stamp:
+ dh build
+ touch $@
+
+clean:
+ dh $@
+
+install: install-stamp
+install-stamp: build-stamp
+ dh install
+ touch $@
+
+binary-arch: install
+ dh $@
+
+binary-indep:
+
+binary: binary-arch binary-indep
+
+.PHONY: binary binary-arch binary-indep install clean build
--- /dev/null
+dh-make-perl
+
+Create debian packages from perl modules
+
+dh-make-perl will create the files required to build
+a debian source package out of a perl package.
+This works for most simple packages and is also useful
+for getting started with packaging perl modules.
+
+There is an override mechanism in place to handle most of
+the little changes that may be needed for some modules
+(this hasn't been tested much, though).
+
+Using this program is no excuse for not reading the
+debian developer documentation, including the policy,
+the perl policy, the packaging manual and so on.
+
+lupus@debian.org
+
--- /dev/null
+dh-make-perl was created by Paolo Molaro.
+
+It is currently maintained by Gunnar Wolf and others, under the umbrella of the
+Debian Perl Group <debian-perl@lists.debian.org>
+
+Copyright (c) 2000,2001 Paolo Molaro <lupus@debian.org>
+ (c) 2002,2003,2008 Ivan Kohler <ivan-debian@420.am>
+ (c) 2003,2004 Marc 'HE' Brockschmidt <he@debian.org>
+ (c) 2005-2007 Gunnar Wolf <gwolf@debian.org>
+ (c) 2006 Frank Lichtenheld <djpig@debian.org>
+ (c) 2007-2008 Gregor Herrmann <gregoa@debian.org>
+ (c) 2007-2008 Damyan Ivanov <dmn@debian.org>
+
+You can do anything with it according to the GPLv2: look
+in /usr/share/common-licenses/GPL-2 on your Debian system.
+
--- /dev/null
+dh-make-perl_0.47maemo1_all.deb devel optional
--- /dev/null
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.14
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. | will give a
+.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
+.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
+.\" expand to `' in nroff, nothing in troff, for use with C<>.
+.tr \(*W-|\(bv\*(Tr
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "DH-MAKE-PERL 1"
+.TH DH-MAKE-PERL 1 "2010-04-14" "perl v5.8.4" "debian"
+.SH "NAME"
+\&\fBdh\-make\-perl\fR \- Create debian source packages from perl modules
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+\&\fBdh-make-perl\fR [\fB\s-1SOURCE_DIR\s0\fR | \fB\-\-cpan\fR \fI\s-1MODULE\s0\fR]
+.PP
+\&\fBdh-make-perl\fR \fB\-\-refresh\fR
+.PP
+You can modify \fBdh-make-perl\fR's behaviour with some switches:
+.IP "\fB\-\-desc\fR \fI\s-1SHORT\s0 \s-1DESCRIPTION\s0\fR" 4
+.IX Item "--desc SHORT DESCRIPTION"
+Uses the argument to \-\-desc as short description for the package.
+.IP "\fB\-\-arch\fR \fIany\fR | \fIall\fR" 4
+.IX Item "--arch any | all"
+This switches between arch-dependent and arch-independet packages. If \fB\-\-arch\fR
+isn't used, \fBdh-make-perl\fR uses a relatively good-working algorithms to
+decide this alone.
+.IP "\fB\-\-version\fR \fI\s-1VERSION\s0\fR" 4
+.IX Item "--version VERSION"
+Specifies the version of the resulting package.
+.IP "\fB\-\-email\fR | \fB\-e\fR \fI\s-1EMAIL\s0\fR" 4
+.IX Item "--email | -e EMAIL"
+Manually specify the Maintainer email address to use in debian/control and
+in debian/changelog.
+.IP "\fB\-\-packagename\fR | \fB\-p\fR \fI\s-1PACKAGENAME\s0\fR" 4
+.IX Item "--packagename | -p PACKAGENAME"
+Manually specify the Package Name, useful when the module has dashes in its
+name.
+.IP "\fB\-\-closes\fR \fI\s-1ITPBUG\s0\fR" 4
+.IX Item "--closes ITPBUG"
+Manually specify the \s-1ITP\s0 bug number that this package closes. If not
+given, dh-make-perl will try to connect to bugs.debian.org to fetch the
+appropriate bug number, using WWW::Mechanize.
+.IP "\fB\-\-depends\fR \fI\s-1DEPENDS\s0\fR" 4
+.IX Item "--depends DEPENDS"
+Manually specify the string to be used for the module's dependencies. This
+should be used when building modules where dh-make-perl cannot guess the Perl
+dependencies (such as modules built using Module::Install), or when the
+Perl code depends on non-Perl binaries or libraries. Usually, dh-make-perl
+will figure out the dependencies by itself. If you need to pass dh-make-perl
+dependency information, you must do it using the debian package format. i.e.
+.Sp
+dh-make-perl \-\-depends libtest-more-perl
+.IP "\fB\-\-bdepends\fR \fIBUILD-DEPENDS\fR" 4
+.IX Item "--bdepends BUILD-DEPENDS"
+Manually specify the string to be used for the module's build-dependencies
+(that is, the packages and their versions that have to be installed in order to
+successfully build the package). Keep in mind that packages generated by
+dh-make-perl require debhelper to be specified as a build dependency. Same note
+as for \-\-depends applies here \- Use only when needed.
+.IP "\fB\-\-bdependsi\fR \fIBUILD-DEPENDS-INDEP\fR" 4
+.IX Item "--bdependsi BUILD-DEPENDS-INDEP"
+Manually specify the string to be used for the module's build-dependencies
+for architecture-independent builds. Same notes as those for the \-\-depends
+and \-\-bdepends options apply here.
+.Sp
+Note that for \-\-depends, \-\-bdepends and \-\-bdependsi you can also specify that
+the field should not appear in debian/rules (if you really mean it, of course
+;\-) ) by giving it an empty string as an argument.
+.IP "\fB\-\-pkg\-perl\fR" 4
+.IX Item "--pkg-perl"
+Useful when preparing a package for the Debian Perl Group
+<http://pkg\-perl.alioth.debian.org>.
+.Sp
+Sets \f(CW\*(C`Maintainer\*(C'\fR, \f(CW\*(C`Uploaders\*(C'\fR, \f(CW\*(C`Vcs\-Svn\*(C'\fR and \f(CW\*(C`Vcs\-Browser\*(C'\fR fields in
+debian/control accordingly.
+.IP "\fB\-\-cpan\-mirror\fR \fI\s-1MIRROR\s0\fR" 4
+.IX Item "--cpan-mirror MIRROR"
+Specifies a \s-1CPAN\s0 site to use as mirror.
+.IP "\fB\-\-exclude\fR | \fB\-i\fR [\fI\s-1REGEX\s0\fR]" 4
+.IX Item "--exclude | -i [REGEX]"
+This allows you to specify a \s-1PCRE\s0 to exclude some files from the search for
+docs and stuff like that. If no argument is given (but the switch is specified
+\&\- not specifying the switch will include everything), it defaults to exclude
+\&\s-1CVS\s0 and .svn directories.
+.IP "\fB\-\-build\fR" 4
+.IX Item "--build"
+Builds the package after setting it up.
+.Sp
+\&\s-1NB:\s0 This builds only a binary package (by calling \*(L"fakeroot debian/rules
+binary\*(R") and does not sign the package. It is meant for a quick local
+install of a package, not for creating a package ready for submission to the
+Debian archive.
+.IP "\fB\-\-install\fR" 4
+.IX Item "--install"
+Installs the freshly built package. Specifying \-\-install implies \-\-build \- The
+package will not be installed unless it was built (obviously ;\-) )
+.IP "\fB\-\-notest\fR" 4
+.IX Item "--notest"
+Does not run the automatic testing of the module as part of the build script.
+This is mostly useful when packaging buggy or incomplete software.
+.IP "\fB\-\-basepkgs\fR" 4
+.IX Item "--basepkgs"
+Explicitly gives a comma-separated list of packages to consider \*(L"base\*(R"
+packages (i.e. packages that should always be available in Debian
+systems). This option defaults to \f(CW\*(C`perl,perl\-base,perl\-modules\*(C'\fR \- It
+is used to check for module dependencies. If a needed module is in the
+\&\f(CW\*(C`basepkgs\*(C'\fR, it won't be mentioned in the \f(CW\*(C`depends:\*(C'\fR field of
+\&\f(CW\*(C`debian/control\*(C'\fR.
+.Sp
+If this option is specified, the above mentioned default packages will
+not be included (but will be mentioned as explicit dependencies in the
+resulting package). You can, of course, mention your own modules
+and explicitly specify the default values.
+.Sp
+Note that this option should be used sparsingly and with care, as it
+might lead to packages not being rebuildable because of unfulfilled
+dependencies.
+.IP "\fB\-\-requiredeps\fR" 4
+.IX Item "--requiredeps"
+Fail if a dependency perl package was not found (dependency tracking
+requires the apt-file package installed and updated)
+.IP "\fB\-\-core\-ok\fR" 4
+.IX Item "--core-ok"
+Allows building core Perl modules. By default, dh-make-perl will not allow
+building a module that is shipped as part of the standard Perl library; by
+specifying this option, dh-make-perl will build them anyway.
+.Sp
+Note that, although it is not probable, this might break unrelated items in
+your system \- If a newer version of a core module breaks the \s-1API\s0, all kinds
+of daemons might get upset ;\-)
+.IP "\fB\-\-refresh\fR" 4
+.IX Item "--refresh"
+Refresh mode.
+.Sp
+Instead of creating new debian/ directory, \fB\-\-refresh\fR makes \fBdh-make-perl\fR
+to re-create only \fBdebian/rules\fR according to the current templates.
+.Sp
+This is useful when \fBdebian/rules\fR was created using older templates and
+doesn't contain much customisations. As always, you're strongly encouraged to
+verify if \fBdebian/rules\fR looks sane.
+.RE
+.IP "\fB\-\-dh ver\fR"
+.IX Item "--dh ver"
+Set desired debhelper version. If \f(CW\*(C`ver\*(C'\fR is 7, generated debian/rules is
+minimalistic, using the auto-mode of debhelper. Also, any additional
+documentation and examples are listed in additional files under debian/, instead
+of being listed in debian/rules
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+\&\fBdh-make-perl\fR will create the files required to build
+a debian source package out of a perl package.
+This works for most simple packages and is also useful
+for getting started with packaging perl modules.
+.PP
+You can specify a module name with the \fB\-\-cpan\fR switch
+and \fBdh-make-perl\fR will download the module for you from
+a \s-1CPAN\s0 mirror, or you can specify the directory with the
+already unpacked sources. If neither \-\-cpan nor a directory
+is given as argument, dh-make-perl tries to create a
+perl package from the data in \fI.\fR
+.PP
+There is an override mechanism in place to handle most of
+the little changes that may be needed for some modules
+(this hasn't been tested much, though, and the override
+database needs to be filled in).
+.PP
+You can build and install the debian package using the \-\-build
+and \-\-install command line switches.
+.PP
+Using this program is no excuse for not reading the
+debian developer documentation, including the Debian policy,
+the perl policy, the packaging manual and so on.
+.SH "FILES"
+.IX Header "FILES"
+The following directories will be searched to find additional files
+required by dh\-make\-perl:
+.PP
+.Vb 2
+\& /usr/share/dh-make-perl/
+\& $HOME/.dh-make-perl/
+.Ve
+.IP "* overrides" 4
+.IX Item "overrides"
+File that overrides information retreived (or guessed) about the package.
+All the files in the library directories are loaded: entries in the home
+take precedence. See the distributed overrides file for usage information.
+.IP "* rules.MakeMaker.noxs" 4
+.IX Item "rules.MakeMaker.noxs"
+A debian/rules makefile for modules that use ExtUtils::MakeMaker, but don't
+have C/XS code.
+.IP "* rules.MakeMaker.xs" 4
+.IX Item "rules.MakeMaker.xs"
+A debian/rules makefile for modules that use ExtUtils::MakerMaker and
+C/XS code.
+.IP "* rules.Module\-Build.noxs" 4
+.IX Item "rules.Module-Build.noxs"
+A debian/rules makefile for modules that use Module::Build, but don't have
+C/XS code.
+.IP "* rules.Module\-Build.xs" 4
+.IX Item "rules.Module-Build.xs"
+A debian/rules makefile for modules that use Module::Build and C/XS code.
+.SH "ENVIRONMENT"
+.IX Header "ENVIRONMENT"
+\&\s-1HOME\s0 \- get user's home directory
+.PP
+\&\s-1DEBFULLNAME\s0 \- get the real name of the maintainer
+.PP
+\&\s-1LOGNAME\s0 or \s-1USER\s0 \- get the username
+.PP
+\&\s-1DEBEMAIL\s0 or \s-1EMAIL\s0 \- get the email address of the user
+.SH "BUGS"
+.IX Header "BUGS"
+Several, let me know when you find them.
+.SH "AUTHOR"
+.IX Header "AUTHOR"
+Paolo Molaro <lupus@debian.org> (\s-1MIA\s0)
+.PP
+Maintained for a time by Ivan Kohler <ivan\-debian@420.am>.
+.PP
+Maintained for a time by Marc Brockschmdit <marc@dch\-faq.de>.
+.PP
+Now maintained by Gunnar Wolf <gwolf@gwolf.org>, and team-maintained
+by the Debian pkg-perl team, http://alioth.debian.org/projects/pkg\-perl
+.PP
+Patches from:
+.IP "Adam Sjoegren <asjo@koldfront.dk>" 4
+.IX Item "Adam Sjoegren <asjo@koldfront.dk>"
+.PD 0
+.IP "Adrian Phillips <adrianp@powertech.no>" 4
+.IX Item "Adrian Phillips <adrianp@powertech.no>"
+.IP "Amos Shapira <amos.shapira@gmail.com>" 4
+.IX Item "Amos Shapira <amos.shapira@gmail.com>"
+.IP "Christian Kurz <shorty@debian.org>" 4
+.IX Item "Christian Kurz <shorty@debian.org>"
+.IP "Damyan Ivanov <divanov@creditreform.bg>" 4
+.IX Item "Damyan Ivanov <divanov@creditreform.bg>"
+.IP "David Paleino <d.paleino@gmail.com>" 4
+.IX Item "David Paleino <d.paleino@gmail.com>"
+.IP "David Pashley <david@davidpashley.com>" 4
+.IX Item "David Pashley <david@davidpashley.com>"
+.IP "Edward Betts <edward@debian.org>" 4
+.IX Item "Edward Betts <edward@debian.org>"
+.IP "Fermin Galan <galan@dit.upm.es>" 4
+.IX Item "Fermin Galan <galan@dit.upm.es>"
+.IP "Geoff Richards <qef@ungwe.org>" 4
+.IX Item "Geoff Richards <qef@ungwe.org>"
+.IP "Gergely Nagy <algernon@bonehunter.rulez.org>" 4
+.IX Item "Gergely Nagy <algernon@bonehunter.rulez.org>"
+.IP "gregor herrmann <gregoa@debian.org>" 4
+.IX Item "gregor herrmann <gregoa@debian.org>"
+.IP "Hilko Bengen <bengen@debian.org>" 4
+.IX Item "Hilko Bengen <bengen@debian.org>"
+.IP "Kees Cook <keex@outflux.net>" 4
+.IX Item "Kees Cook <keex@outflux.net>"
+.IP "Jesper Krogh <jesper@krogh.cc>" 4
+.IX Item "Jesper Krogh <jesper@krogh.cc>"
+.IP "Johnny Morano <jmorano@moretrix.com>" 4
+.IX Item "Johnny Morano <jmorano@moretrix.com>"
+.IP "Juerd <juerd@ouranos.juerd.net>" 4
+.IX Item "Juerd <juerd@ouranos.juerd.net>"
+.IP "Marc Chantreux (mail withheld)" 4
+.IX Item "Marc Chantreux (mail withheld)"
+.IP "Matt Hope <dopey@debian.org>" 4
+.IX Item "Matt Hope <dopey@debian.org>"
+.IP "Noel Maddy <noel@zhtwn.com>" 4
+.IX Item "Noel Maddy <noel@zhtwn.com>"
+.IP "Oliver Gorwits <oliver.gorwits@oucs.ox.ac.uk>" 4
+.IX Item "Oliver Gorwits <oliver.gorwits@oucs.ox.ac.uk>"
+.IP "Peter Moerch <mn3k66i02@sneakemail.com>" 4
+.IX Item "Peter Moerch <mn3k66i02@sneakemail.com>"
+.IP "Stephen Oberholtzer <oliverklozoff@gmail.com>" 4
+.IX Item "Stephen Oberholtzer <oliverklozoff@gmail.com>"
+.IP "Ton Nijkes <tonn@wau.mis.ah.nl>" 4
+.IX Item "Ton Nijkes <tonn@wau.mis.ah.nl>"
+.PD
+.PP
+\&... And others who, sadly, we have forgot to add :\-/
+++ /dev/null
-Revision history for Perl extension Test::Warn.
-
-0.11 Jun 09 2008
- - better Makefile.PL
- - mention Test::Trap
- - uplevel 2 changed to uplevel 1 to work with Sub::Uplevel 0.19_02
- - small fixes
-
-0.10 May 01 2007
- - depend on newer version of Sub::Uplevel
- - fixed pod error
-
-0.09 Mar 15 2007
- - new maintainer: Alexandr Ciornii
- - license in Makefile.PL
- - fixed carped.t (patch by PSINNOTT)
- - pod.t
-
-0.08 Tue Sep 02 2003
- - fixed bug in warning_is, warnings_are when newlines are inside
-
-0.07 Mon Mar 10 2003
- - fixed self test routines
- that it doesn't play a role what kind of file separator is used
- (/ on *nix or \ on win)
- - added File::Spec to the requirements
-
-0.06 Wed Jul 31 2002
- - used a patch given by chromatic and Schwern
- to remove Dependancy of Switch
- - fixed a typo in the doc
-
-0.05 Thu Jul 25 2002
- - implemented the warnings category feature
- warning_like {foo()} 'syntax', "Test for any syntax warning, given by the standard perl distribution";
- - added Tree::DAG_Node to the requirements
-
-0.04 Tue Jul 16 2002
- - implemented the possibility of saying
- warning_like {foo()} {carped => ['x', 'y', 'z']}, "Warnings with x, y and z"
- instead of
- warning_like {foo()} [{carped => 'x'},
- {carped => 'y'},
- {carped => 'z'}], "Warnings with x, y and z, too"
- - added Dependancy to Switch
-
-0.03 Mon Jul 15 2002
- - removed bug that occured with some versions of perl
- Something something like
- use List::Util qw/first/;
- {$warn_kind => first {"$_\n"} split /\n/, $msg};
- where the argument to first wasn't detected as a sub block
- - removed Dependency of List::Util
-
-0.02 Thu Jul 11 2002
- - implemented carped option to define a warning coming from carp
-
-0.01 Wed Jul 10 2002
- - first CPAN release
- - warning_is / warning_are implemented
- - warning_like / warnings_like implemented
+++ /dev/null
-Changes
-Makefile.PL
-MANIFEST
-README
-Warn.pm
-t/1.t
-t/warning_is.t
-t/warning_like.t
-t/warnings_are.t
-t/warnings_like.t
-t/carped.t
-t/pod.t
-META.yml Module meta-data (added by MakeMaker)\r
+++ /dev/null
---- #YAML:1.0\r
-name: Test-Warn\r
-version: 0.11\r
-abstract: Perl extension to test methods for warnings\r
-license: perl\r
-generated_by: ExtUtils::MakeMaker version 6.32\r
-distribution_type: module\r
-requires: \r
- Array::Compare: 0\r
- File::Spec: 0\r
- Sub::Uplevel: 0.12\r
- Test::Builder: 0.13\r
- Test::Builder::Tester: 1.02\r
- Test::Exception: 0\r
- Test::More: 0\r
- Tree::DAG_Node: 0\r
-meta-spec:\r
- url: http://module-build.sourceforge.net/META-spec-v1.2.html\r
- version: 1.2\r
-author:\r
- - Alexandr Ciornii <alexchorny@gmail.com>\r
+++ /dev/null
-use 5.006;
-use strict;
-use ExtUtils::MakeMaker;
-# See lib/ExtUtils/MakeMaker.pm for details of how to influence
-# the contents of the Makefile that is written.
-WriteMakefile(
- 'NAME' => 'Test::Warn',
- 'VERSION_FROM' => 'Warn.pm', # finds $VERSION
- 'PREREQ_PM' => {
- 'Array::Compare' => 0,
- 'Test::Exception' => 0,
- 'Test::Builder' => 0.13,
- 'Test::Builder::Tester' => 1.02,
- 'Sub::Uplevel' => 0.12,
- 'Tree::DAG_Node' => 0,
- 'File::Spec' => 0,
- 'Test::More' => 0,
- }, # e.g., Module::Name => 1.1
- ABSTRACT_FROM => 'Warn.pm', # retrieve abstract from module
- AUTHOR => 'Alexandr Ciornii <alexchorny'.'@gmail.com>',
- ($ExtUtils::MakeMaker::VERSION ge '6.31'?
- ('LICENSE' => 'perl', ) : ()),
-);
+++ /dev/null
-Test/Warn version 0.10
-======================
-
-INSTALLATION
-
-To install this module type the following:
-
- perl Makefile.PL
- make
- make test
- make install
-
-DEPENDENCIES
-
-This module requires these other modules and libraries:
-
-Test::Builder
-Test::Exception
-Array::Compare
-Sub::Uplevel
-List::Util
-Tree::DAG_Node
-File::Spec
-
-SYNOPSIS
- use Test::Warn;
-
- warning_is {foo(-dri => "/")} "Unknown Parameter 'dri'", "dri != dir gives warning";
- warnings_are {bar(1,1)} ["Width very small", "Height very small"];
-
- warning_is {add(2,2)} undef, "No warning to calc 2+2"; # or
- warnings_are {add(2,2)} [], "No warning to calc 2+2"; # what reads better :-)
-
- warning_like {foo(-dri => "/"} qr/unknown param/i, "an unknown parameter test";
- warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i];
-
- warning_is {foo()} {carped => 'didn't found the right parameters'};
- warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}];
-
- warning_like {foo(undef)} 'uninitialized';
- warning_like {bar(file => '/etc/passwd')} 'io';
-
- warning_like {eval q/"$x"; $x;/}
- [qw/void uninitialized/],
- "some warnings at compile time";
-
-DESCRIPTION
- This module provides a few convenience methods for testing warning based
- code.
-
- If you are not already familiar with the Test::More manpage now would be
- the time to go take a look.
-
- FUNCTIONS - OVERVIEW
- warning_is BLOCK STRING, TEST_NAME
- warnings_are BLOCK ARRAYREF, TEST_NAME
- warning_like BLOCK REGEXP, TEST_NAME
- warning_like BLOCK STRING, TEST_NAME
- warnings_like BLOCK ARRAYREF, TEST_NAME
-
-SEE ALSO
- Have a look to the similar Test::Exception module.
-
-THANKS
- Many thanks to Adrian Howard, chromatic and Michael G. Schwern, who all had
- given me a lot of ideas.
-
-AUTHOR
- Janek Schleicher, <bigj@kamelfreund.de>
-
-COPYRIGHT AND LICENSE
- Copyright 2002 by Janek Schleicher
-
- This library is free software; you can redistribute it and/or modify it
- under the same terms as Perl itself.
-
+++ /dev/null
-=head1 NAME
-
-Test::Warn - Perl extension to test methods for warnings
-
-=head1 SYNOPSIS
-
- use Test::Warn;
-
- warning_is {foo(-dri => "/")} "Unknown Parameter 'dri'", "dri != dir gives warning";
- warnings_are {bar(1,1)} ["Width very small", "Height very small"];
-
- warning_is {add(2,2)} undef, "No warning to calc 2+2"; # or
- warnings_are {add(2,2)} [], "No warning to calc 2+2"; # what reads better :-)
-
- warning_like {foo(-dri => "/")} qr/unknown param/i, "an unknown parameter test";
- warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i];
-
- warning_is {foo()} {carped => "didn't found the right parameters"};
- warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}];
-
- warning_like {foo(undef)} 'uninitialized';
- warning_like {bar(file => '/etc/passwd')} 'io';
-
- warning_like {eval q/"$x"; $x;/}
- [qw/void uninitialized/],
- "some warnings at compile time";
-
-=head1 DESCRIPTION
-
-This module provides a few convenience methods for testing warning based code.
-
-If you are not already familiar with the Test::More manpage
-now would be the time to go take a look.
-
-=head2 FUNCTIONS
-
-=over 4
-
-=item warning_is BLOCK STRING, TEST_NAME
-
-Tests that BLOCK gives exactly the one specificated warning.
-The test fails if the BLOCK warns more then one times or doesn't warn.
-If the string is undef,
-then the tests succeeds iff the BLOCK doesn't give any warning.
-Another way to say that there aren't ary warnings in the block,
-is C<warnings_are {foo()} [], "no warnings in">.
-
-If you want to test for a warning given by carp,
-You have to write something like:
-C<warning_is {carp "msg"} {carped =E<gt> 'msg'}, "Test for a carped warning">.
-The test will fail,
-if a "normal" warning is found instead of a "carped" one.
-
-Note: C<warn "foo"> would print something like C<foo at -e line 1>.
-This method ignores everything after the at. That means, to match this warning
-you would have to call C<warning_is {warn "foo"} "foo", "Foo succeeded">.
-If you need to test for a warning at an exactly line,
-try better something like C<warning_like {warn "foo"} qr/at XYZ.dat line 5/>.
-
-warning_is and warning_are are only aliases to the same method.
-So you also could write
-C<warning_is {foo()} [], "no warning"> or something similar.
-I decided me to give two methods to have some better readable method names.
-
-A true value is returned if the test succeeds, false otherwise.
-
-The test name is optional, but recommended.
-
-
-=item warnings_are BLOCK ARRAYREF, TEST_NAME
-
-Tests to see that BLOCK gives exactly the specificated warnings.
-The test fails if the BLOCK warns a different number than the size of the ARRAYREf
-would have expected.
-If the ARRAYREF is equal to [],
-then the test succeeds iff the BLOCK doesn't give any warning.
-
-Please read also the notes to warning_is as these methods are only aliases.
-
-If you want more than one tests for carped warnings look that way:
-C<warnings_are {carp "c1"; carp "c2"} {carped => ['c1','c2'];> or
-C<warnings_are {foo()} ["Warning 1", {carped => ["Carp 1", "Carp 2"]}, "Warning 2"]>.
-Note that C<{carped => ...}> has always to be a hash ref.
-
-=item warning_like BLOCK REGEXP, TEST_NAME
-
-Tests that BLOCK gives exactly one warning and it can be matched to the given regexp.
-If the string is undef,
-then the tests succeeds iff the BLOCK doesn't give any warning.
-
-The REGEXP is matched after the whole warn line,
-which consists in general of "WARNING at __FILE__ line __LINE__".
-So you can check for a warning in at File Foo.pm line 5 with
-C<warning_like {bar()} qr/at Foo.pm line 5/, "Testname">.
-I don't know whether it's sensful to do such a test :-(
-However, you should be prepared as a matching with 'at', 'file', '\d'
-or similar will always pass.
-Think to the qr/^foo/ if you want to test for warning "foo something" in file foo.pl.
-
-You can also write the regexp in a string as "/.../"
-instead of using the qr/.../ syntax.
-Note that the slashes are important in the string,
-as strings without slashes are reserved for warning categories
-(to match warning categories as can be seen in the perllexwarn man page).
-
-Similar to C<warning_is>,
-you can test for warnings via C<carp> with:
-C<warning_like {bar()} {carped => qr/bar called too early/i};>
-
-Similar to C<warning_is>/C<warnings_are>,
-C<warning_like> and C<warnings_like> are only aliases to the same methods.
-
-A true value is returned if the test succeeds, false otherwise.
-
-The test name is optional, but recommended.
-
-=item warning_like BLOCK STRING, TEST_NAME
-
-Tests whether a BLOCK gives exactly one warning of the passed category.
-The categories are grouped in a tree,
-like it is expressed in perllexwarn.
-Note, that they have the hierarchical structure from perl 5.8.0,
-wich has a little bit changed to 5.6.1 or earlier versions
-(You can access the internal used tree with C<$Test::Warn::Categorization::tree>,
-allthough I wouldn't recommend it)
-
-Thanks to the grouping in a tree,
-it's simple possible to test for an 'io' warning,
-instead for testing for a 'closed|exec|layer|newline|pipe|unopened' warning.
-
-Note, that warnings occuring at compile time,
-can only be catched in an eval block. So
-
- warning_like {eval q/"$x"; $x;/}
- [qw/void uninitialized/],
- "some warnings at compile time";
-
-will work,
-while it wouldn't work without the eval.
-
-Note, that it isn't possible yet,
-to test for own categories,
-created with warnings::register.
-
-=item warnings_like BLOCK ARRAYREF, TEST_NAME
-
-Tests to see that BLOCK gives exactly the number of the specificated warnings
-and all the warnings have to match in the defined order to the
-passed regexes.
-
-Please read also the notes to warning_like as these methods are only aliases.
-
-Similar to C<warnings_are>,
-you can test for multiple warnings via C<carp>
-and for warning categories, too:
-
- warnings_like {foo()}
- [qr/bar warning/,
- qr/bar warning/,
- {carped => qr/bar warning/i},
- 'io'
- ],
- "I hope, you'll never have to write a test for so many warnings :-)";
-
-=back
-
-=head2 EXPORT
-
-C<warning_is>,
-C<warnings_are>,
-C<warning_like>,
-C<warnings_like> by default.
-
-=head1 BUGS
-
-Please note that warnings with newlines inside are making a lot of trouble.
-The only sensful way to handle them is to use are the C<warning_like> or
-C<warnings_like> methods. Background for these problems is that there is no
-really secure way to distinguish between warnings with newlines and a tracing
-stacktrace.
-
-If a method has it's own warn handler,
-overwriting C<$SIG{__WARN__}>,
-my test warning methods won't get these warnings.
-
-The C<warning_like BLOCK CATEGORY, TEST_NAME> method isn't extremely tested.
-Please use this calling style with higher attention and
-tell me if you find a bug.
-
-=head1 TODO
-
-Improve this documentation.
-
-The code has some parts doubled - especially in the test scripts.
-This is really awkward and has to be changed.
-
-Please feel free to suggest me any improvements.
-
-=head1 SEE ALSO
-
-Have a look to the similar L<Test::Exception> module. Test::Trap
-
-=head1 THANKS
-
-Many thanks to Adrian Howard, chromatic and Michael G. Schwern,
-who have given me a lot of ideas.
-
-=head1 AUTHOR
-
-Janek Schleicher, E<lt>bigj AT kamelfreund.deE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2002 by Janek Schleicher
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-
-package Test::Warn;
-
-use 5.006;
-use strict;
-use warnings;
-
-use Array::Compare;
-use Sub::Uplevel 0.12;
-
-our $VERSION = '0.11';
-
-require Exporter;
-
-our @ISA = qw(Exporter);
-
-our %EXPORT_TAGS = ( 'all' => [ qw(
- @EXPORT
-) ] );
-
-our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
-
-our @EXPORT = qw(
- warning_is warnings_are
- warning_like warnings_like
-);
-
-use Test::Builder;
-my $Tester = Test::Builder->new;
-
-*warning_is = *warnings_are;
-
-sub warnings_are (&$;$) {
- my $block = shift;
- my @exp_warning = map {_canonical_exp_warning($_)}
- _to_array_if_necessary( shift() || [] );
- my $testname = shift;
- my @got_warning = ();
- local $SIG{__WARN__} = sub {
- my ($called_from) = caller(0); # to find out Carping methods
- push @got_warning, _canonical_got_warning($called_from, shift());
- };
- uplevel 1,$block;
- my $ok = _cmp_is( \@got_warning, \@exp_warning );
- $Tester->ok( $ok, $testname );
- $ok or _diag_found_warning(@got_warning),
- _diag_exp_warning(@exp_warning);
- return $ok;
-}
-
-*warning_like = *warnings_like;
-
-sub warnings_like (&$;$) {
- my $block = shift;
- my @exp_warning = map {_canonical_exp_warning($_)}
- _to_array_if_necessary( shift() || [] );
- my $testname = shift;
- my @got_warning = ();
- local $SIG{__WARN__} = sub {
- my ($called_from) = caller(0); # to find out Carping methods
- push @got_warning, _canonical_got_warning($called_from, shift());
- };
- uplevel 1,$block;
- my $ok = _cmp_like( \@got_warning, \@exp_warning );
- $Tester->ok( $ok, $testname );
- $ok or _diag_found_warning(@got_warning),
- _diag_exp_warning(@exp_warning);
- return $ok;
-}
-
-
-sub _to_array_if_necessary {
- return (ref($_[0]) eq 'ARRAY') ? @{$_[0]} : ($_[0]);
-}
-
-sub _canonical_got_warning {
- my ($called_from, $msg) = @_;
- my $warn_kind = $called_from eq 'Carp' ? 'carped' : 'warn';
- my @warning_stack = split /\n/, $msg; # some stuff of uplevel is included
- return {$warn_kind => $warning_stack[0]}; # return only the real message
-}
-
-sub _canonical_exp_warning {
- my ($exp) = @_;
- if (ref($exp) eq 'HASH') { # could be {carped => ...}
- my $to_carp = $exp->{carped} or return; # undefined message are ignored
- return (ref($to_carp) eq 'ARRAY') # is {carped => [ ..., ...] }
- ? map({ {carped => $_} } grep {defined $_} @$to_carp)
- : +{carped => $to_carp};
- }
- return {warn => $exp};
-}
-
-sub _cmp_got_to_exp_warning {
- my ($got_kind, $got_msg) = %{ shift() };
- my ($exp_kind, $exp_msg) = %{ shift() };
- return 0 if ($got_kind eq 'warn') && ($exp_kind eq 'carped');
- my $cmp = $got_msg =~ /^\Q$exp_msg\E at \S+ line \d+\.?$/;
- return $cmp;
-}
-
-sub _cmp_got_to_exp_warning_like {
- my ($got_kind, $got_msg) = %{ shift() };
- my ($exp_kind, $exp_msg) = %{ shift() };
- return 0 if ($got_kind eq 'warn') && ($exp_kind eq 'carped');
- if (my $re = $Tester->maybe_regex($exp_msg)) {
- my $cmp = $got_msg =~ /$re/;
- return $cmp;
- } else {
- return Test::Warn::Categorization::warning_like_category($got_msg,$exp_msg);
- }
-}
-
-
-sub _cmp_is {
- my @got = @{ shift() };
- my @exp = @{ shift() };
- scalar @got == scalar @exp or return 0;
- my $cmp = 1;
- $cmp &&= _cmp_got_to_exp_warning($got[$_],$exp[$_]) for (0 .. $#got);
- return $cmp;
-}
-
-sub _cmp_like {
- my @got = @{ shift() };
- my @exp = @{ shift() };
- scalar @got == scalar @exp or return 0;
- my $cmp = 1;
- $cmp &&= _cmp_got_to_exp_warning_like($got[$_],$exp[$_]) for (0 .. $#got);
- return $cmp;
-}
-
-sub _diag_found_warning {
- foreach (@_) {
- if (ref($_) eq 'HASH') {
- ${$_}{carped} ? $Tester->diag("found carped warning: ${$_}{carped}")
- : $Tester->diag("found warning: ${$_}{warn}");
- } else {
- $Tester->diag( "found warning: $_" );
- }
- }
- $Tester->diag( "didn't found a warning" ) unless @_;
-}
-
-sub _diag_exp_warning {
- foreach (@_) {
- if (ref($_) eq 'HASH') {
- ${$_}{carped} ? $Tester->diag("expected to find carped warning: ${$_}{carped}")
- : $Tester->diag("expected to find warning: ${$_}{warn}");
- } else {
- $Tester->diag( "expected to find warning: $_" );
- }
- }
- $Tester->diag( "didn't expect to find a warning" ) unless @_;
-}
-
-package Tree::MyDAG_Node;
-
-use strict;
-use warnings;
-use base 'Tree::DAG_Node';
-
-
-sub nice_lol_to_tree {
- my $class = shift;
- $class->new(
- {
- name => shift(),
- daughters => [_nice_lol_to_daughters(shift())]
- });
-}
-
-sub _nice_lol_to_daughters {
- my @names = @{ shift() };
- my @daughters = ();
- my $last_daughter = undef;
- foreach (@names) {
- if (ref($_) ne 'ARRAY') {
- $last_daughter = Tree::DAG_Node->new({name => $_});
- push @daughters, $last_daughter;
- } else {
- $last_daughter->add_daughters(_nice_lol_to_daughters($_));
- }
- }
- return @daughters;
-}
-
-sub depthsearch {
- my ($self, $search_name) = @_;
- my $found_node = undef;
- $self->walk_down({callback => sub {
- my $node = shift();
- $node->name eq $search_name and $found_node = $node,!"go on";
- "go on with searching";
- }});
- return $found_node;
-}
-
-package Test::Warn::Categorization;
-
-use Carp;
-
-our $tree = Tree::MyDAG_Node->nice_lol_to_tree(
- all => [ 'closure',
- 'deprecated',
- 'exiting',
- 'glob',
- 'io' => [ 'closed',
- 'exec',
- 'layer',
- 'newline',
- 'pipe',
- 'unopened'
- ],
- 'misc',
- 'numeric',
- 'once',
- 'overflow',
- 'pack',
- 'portable',
- 'recursion',
- 'redefine',
- 'regexp',
- 'severe' => [ 'debugging',
- 'inplace',
- 'internal',
- 'malloc'
- ],
- 'signal',
- 'substr',
- 'syntax' => [ 'ambiguous',
- 'bareword',
- 'digit',
- 'parenthesis',
- 'precedence',
- 'printf',
- 'prototype',
- 'qw',
- 'reserved',
- 'semicolon'
- ],
- 'taint',
- 'threads',
- 'uninitialized',
- 'unpack',
- 'untie',
- 'utf8',
- 'void',
- 'y2k'
- ]
-);
-
-sub _warning_category_regexp {
- my $sub_tree = $tree->depthsearch(shift()) or return undef;
- my $re = join "|", map {$_->name} $sub_tree->leaves_under;
- return qr/(?=\w)$re/;
-}
-
-sub warning_like_category {
- my ($warning, $category) = @_;
- my $re = _warning_category_regexp($category) or
- carp("Unknown warning category '$category'"),return undef;
- my $ok = $warning =~ /$re/;
- return $ok;
-}
-
-1;
+++ /dev/null
-This package uses quilt to manage patches against the upstream source.
-
-/usr/share/doc/quilt/README.source has more informations.
+++ /dev/null
-libtest-warn-perl (0.11-1) unstable; urgency=low
-
- * debian/control: Added: Vcs-Svn field (source stanza); Vcs-Browser
- field (source stanza); Homepage field (source stanza).
- * Set Maintainer to Debian Perl Group.
- * Use dist-based URL in debian/watch.
- * Refresh debian/rules, no functional changes.
- * Split out changes against upstream code into a patch; add quilt framework.
-
- * New upstream release.
- * Refresh language.patch.
- * debian/copyright: copy copyright/license information verbatim from
- upstream source, update pointer to common licenses on Debian systems.
- * Set debhelper compatibility level to 5.
- * Set Standards-Version to 3.8.0; add debian/REAMDE.source to document quilt
- usage.
- * debian/control:
- - wrap long line in debian/control
- - make (build) dependency on libsub-uplevel-perl versioned
- - split build dependencies between Build-Depends and Build-Depends-Indep
- - add /me to Uploaders
-
- -- gregor herrmann <gregoa@debian.org> Thu, 10 Jul 2008 20:40:17 +0200
-
-libtest-warn-perl (0.10-1) unstable; urgency=low
-
- * New upstream release
- * Acknowledge NMU. Thanks Marc. (Closes: #356829)
- * Fixes debian/watch file so uscan will actually work
- * Partially took patch from Era Eriksson to clean up some manpage language. Thanks! (Closes: #322351)
- * Updated debian-policy to version 3.7.2.2 (No other changes)
- * Added libtest-pod-perl for Build-Depends so test won't skip
- * Changed Build-Depends-Indep to Build-Depends to satisfy lintian
- * Changed make clean check to satisfy lintian warning
-
- -- Jay Bonci <jaybonci@debian.org> Fri, 29 Jun 2007 08:04:42 -0400
-
-libtest-warn-perl (0.08-2.1) unstable; urgency=low
-
- * Non-maintainer upload.
- * debian/control: Test::Builder::Tester is now in libtest-simple-perl.
- * Using the newer module fixes the FTBFS. (Closes: #356829)
-
- -- Marc 'HE' Brockschmidt <he@debian.org> Sun, 23 Apr 2006 16:17:44 +0200
-
-libtest-warn-perl (0.08-2) unstable; urgency=low
-
- * Adds debian/watch so uscan will actually work
-
- -- Jay Bonci <jaybonci@debian.org> Mon, 11 Oct 2004 02:34:25 -0400
-
-libtest-warn-perl (0.08-1) unstable; urgency=low
-
- * Initial Release. (Closes: #212632)
-
- -- Jay Bonci <jaybonci@debian.org> Tue, 11 Nov 2003 15:07:52 -0500
-
+++ /dev/null
-Source: libtest-warn-perl
-Section: perl
-Priority: optional
-Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
-Uploaders: Jay Bonci <jaybonci@debian.org>,
- gregor herrmann <gregoa@debian.org>
-Build-Depends: debhelper (>= 5), quilt (>= 0.40)
-Build-Depends-Indep: perl (>= 5.6.0-16), libsub-uplevel-perl (>= 0.12),
- libtest-exception-perl, libarray-compare-perl, libtest-simple-perl,
- libtree-dagnode-perl, libtest-pod-perl
-Standards-Version: 3.8.0
-Homepage: http://search.cpan.org/dist/Test-Warn/
-Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libtest-warn-perl/
-Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-warn-perl/
-
-Package: libtest-warn-perl
-Architecture: all
-Depends: ${perl:Depends}, libsub-uplevel-perl (>= 0.12), libtest-exception-perl,
- libarray-compare-perl, libtest-simple-perl, libtree-dagnode-perl
-Description: Test for warning-based code in perl
- Test::Warn provides an easy way to test for code throwing warnings in perl.
- It's similar in style to the Test::More family of utilities.
+++ /dev/null
-This package was debianized by Jay Bonci <jaybonci@debian.org> on
-Tue, 11 Nov 2003 15:07:52 -0500.
-
-It was downloaded from http://search.cpan.org/dist/Test-Warn
-
-Upstream Author: Janek Schleicher <bigj@kamelfreund.de>
-
-Copyright 2002 by Janek Schleicher
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-Perl is distributed under your choice of the GNU General Public License or
-the Artistic License. On Debian GNU/Linux systems, the complete text of the
-GNU General Public License can be found in `/usr/share/common-licenses/GPL'
-and the Artistic Licence in `/usr/share/common-licenses/Artistic'.
+++ /dev/null
-Author: Jay Bonci <jaybonci@debian.org>
-Description: Patch from Era Eriksson to clean up some manpage language
-Bug: #322351
-
---- a/Warn.pm
-+++ b/Warn.pm
-@@ -9,13 +9,13 @@
- warning_is {foo(-dri => "/")} "Unknown Parameter 'dri'", "dri != dir gives warning";
- warnings_are {bar(1,1)} ["Width very small", "Height very small"];
-
-- warning_is {add(2,2)} undef, "No warning to calc 2+2"; # or
-- warnings_are {add(2,2)} [], "No warning to calc 2+2"; # what reads better :-)
-+ warning_is {add(2,2)} undef, "No warning for calc 2+2"; # or
-+ warnings_are {add(2,2)} [], "No warning for calc 2+2"; # what reads better :-)
-
- warning_like {foo(-dri => "/")} qr/unknown param/i, "an unknown parameter test";
- warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i];
-
-- warning_is {foo()} {carped => "didn't found the right parameters"};
-+ warning_is {foo()} {carped => "didn't find the right parameters"};
- warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}];
-
- warning_like {foo(undef)} 'uninitialized';
-@@ -27,9 +27,9 @@
-
- =head1 DESCRIPTION
-
--This module provides a few convenience methods for testing warning based code.
-+This module provides a few convenience methods for testing warning-based code.
-
--If you are not already familiar with the Test::More manpage
-+If you are not already familiar with the Test::More manpage,
- now would be the time to go take a look.
-
- =head2 FUNCTIONS
-@@ -38,29 +38,29 @@
-
- =item warning_is BLOCK STRING, TEST_NAME
-
--Tests that BLOCK gives exactly the one specificated warning.
--The test fails if the BLOCK warns more then one times or doesn't warn.
-+Tests that BLOCK give exactly the one specified warning.
-+The test fails if the BLOCK warns more then one time or doesn't warn.
- If the string is undef,
- then the tests succeeds iff the BLOCK doesn't give any warning.
--Another way to say that there aren't ary warnings in the block,
--is C<warnings_are {foo()} [], "no warnings in">.
-+Another way to say that there aren't any warnings in the block
-+is C<warnings_are {foo()} [], "no warnings">.
-
--If you want to test for a warning given by carp,
--You have to write something like:
-+If you want to test for a warning given by carp
-+you have to write something like:
- C<warning_is {carp "msg"} {carped =E<gt> 'msg'}, "Test for a carped warning">.
--The test will fail,
-+The test will fail
- if a "normal" warning is found instead of a "carped" one.
-
- Note: C<warn "foo"> would print something like C<foo at -e line 1>.
- This method ignores everything after the at. That means, to match this warning
- you would have to call C<warning_is {warn "foo"} "foo", "Foo succeeded">.
- If you need to test for a warning at an exactly line,
--try better something like C<warning_like {warn "foo"} qr/at XYZ.dat line 5/>.
-+try something like C<warning_like {warn "foo"} qr/at XYZ.dat line 5/>.
-
- warning_is and warning_are are only aliases to the same method.
- So you also could write
- C<warning_is {foo()} [], "no warning"> or something similar.
--I decided me to give two methods to have some better readable method names.
-+I decided to give two methods to have some more readable method names.
-
- A true value is returned if the test succeeds, false otherwise.
-
-@@ -70,32 +70,33 @@
- =item warnings_are BLOCK ARRAYREF, TEST_NAME
-
- Tests to see that BLOCK gives exactly the specificated warnings.
--The test fails if the BLOCK warns a different number than the size of the ARRAYREf
--would have expected.
-+The test fails if the warnings from BLOCK are not exactly the ones in ARRAYREF.
- If the ARRAYREF is equal to [],
- then the test succeeds iff the BLOCK doesn't give any warning.
-
- Please read also the notes to warning_is as these methods are only aliases.
-
--If you want more than one tests for carped warnings look that way:
-+If you want more than one test for carped warnings, try this:
- C<warnings_are {carp "c1"; carp "c2"} {carped => ['c1','c2'];> or
- C<warnings_are {foo()} ["Warning 1", {carped => ["Carp 1", "Carp 2"]}, "Warning 2"]>.
--Note that C<{carped => ...}> has always to be a hash ref.
-+Note that C<{carped => ...}> always has to be a hash ref.
-
- =item warning_like BLOCK REGEXP, TEST_NAME
-
--Tests that BLOCK gives exactly one warning and it can be matched to the given regexp.
-+Tests that BLOCK gives exactly one warning and it can be matched by
-+the given regexp.
- If the string is undef,
- then the tests succeeds iff the BLOCK doesn't give any warning.
-
--The REGEXP is matched after the whole warn line,
--which consists in general of "WARNING at __FILE__ line __LINE__".
--So you can check for a warning in at File Foo.pm line 5 with
-+The REGEXP is matched against the whole warning message,
-+which in general has the form "WARNING at __FILE__ line __LINE__".
-+So you can check for a warning in the file Foo.pm on line 5 with
- C<warning_like {bar()} qr/at Foo.pm line 5/, "Testname">.
--I don't know whether it's sensful to do such a test :-(
--However, you should be prepared as a matching with 'at', 'file', '\d'
-+Perhaps it isn't sensible to perform such a test;
-+however, you should be aware that matching on a sweeping regular expression
-+such as 'at', 'file', '\d'
- or similar will always pass.
--Think to the qr/^foo/ if you want to test for warning "foo something" in file foo.pl.
-+Consider qr/^foo/ if you want to test for warning "foo something" in file foo.pl.
-
- You can also write the regexp in a string as "/.../"
- instead of using the qr/.../ syntax.
-@@ -103,7 +104,7 @@
- as strings without slashes are reserved for warning categories
- (to match warning categories as can be seen in the perllexwarn man page).
-
--Similar to C<warning_is>,
-+As with C<warning_is>,
- you can test for warnings via C<carp> with:
- C<warning_like {bar()} {carped => qr/bar called too early/i};>
-
-@@ -119,17 +120,18 @@
- Tests whether a BLOCK gives exactly one warning of the passed category.
- The categories are grouped in a tree,
- like it is expressed in perllexwarn.
--Note, that they have the hierarchical structure from perl 5.8.0,
--wich has a little bit changed to 5.6.1 or earlier versions
--(You can access the internal used tree with C<$Test::Warn::Categorization::tree>,
--allthough I wouldn't recommend it)
-+Note that they have the hierarchical structure from perl 5.8.0,
-+which is slightly different from how it was organized up through perl 5.6.1.
-+(You can access the internal hierarchy with
-+C<$Test::Warn::Categorization::tree>,
-+although it isn't recommended).
-
- Thanks to the grouping in a tree,
--it's simple possible to test for an 'io' warning,
--instead for testing for a 'closed|exec|layer|newline|pipe|unopened' warning.
-+it's possible to test simply for an 'io' warning,
-+instead of testing for a 'closed|exec|layer|newline|pipe|unopened' warning.
-
--Note, that warnings occuring at compile time,
--can only be catched in an eval block. So
-+Note that compile-time warnings
-+can only be caught in an eval block. So
-
- warning_like {eval q/"$x"; $x;/}
- [qw/void uninitialized/],
-@@ -138,9 +140,8 @@
- will work,
- while it wouldn't work without the eval.
-
--Note, that it isn't possible yet,
--to test for own categories,
--created with warnings::register.
-+Note also that it isn't yet possible
-+to test for categories you created yourself with C<warnings::register>.
-
- =item warnings_like BLOCK ARRAYREF, TEST_NAME
-
-@@ -160,7 +161,7 @@
- {carped => qr/bar warning/i},
- 'io'
- ],
-- "I hope, you'll never have to write a test for so many warnings :-)";
-+ "I hope you'll never have to write a test for so many warnings :-)";
-
- =back
-
-@@ -174,27 +175,28 @@
- =head1 BUGS
-
- Please note that warnings with newlines inside are making a lot of trouble.
--The only sensful way to handle them is to use are the C<warning_like> or
--C<warnings_like> methods. Background for these problems is that there is no
--really secure way to distinguish between warnings with newlines and a tracing
-+The only sensible way to handle them is to use the C<warning_like> or
-+C<warnings_like> methods.
-+The background for these problems is that there is no
-+really secure way to distinguish between warnings with newlines and a trailing
- stacktrace.
-
--If a method has it's own warn handler,
-+If a method has its own warn handler,
- overwriting C<$SIG{__WARN__}>,
- my test warning methods won't get these warnings.
-
--The C<warning_like BLOCK CATEGORY, TEST_NAME> method isn't extremely tested.
--Please use this calling style with higher attention and
--tell me if you find a bug.
-+The C<warning_like BLOCK CATEGORY, TEST_NAME> method isn't fully tested.
-+Please pay attention if you use this this calling style,
-+and report any bugs you find.
-
- =head1 TODO
-
- Improve this documentation.
-
- The code has some parts doubled - especially in the test scripts.
--This is really awkward and has to be changed.
-+This is really awkward and must be changed.
-
--Please feel free to suggest me any improvements.
-+Please feel free to suggest improvements.
-
- =head1 SEE ALSO
-
-@@ -359,7 +361,7 @@
- $Tester->diag( "found warning: $_" );
- }
- }
-- $Tester->diag( "didn't found a warning" ) unless @_;
-+ $Tester->diag( "didn't find a warning" ) unless @_;
- }
-
- sub _diag_exp_warning {
---- a/t/warning_is.t
-+++ b/t/warning_is.t
-@@ -77,7 +77,7 @@
- __FILE__,
- "line",
- WARN_LINE . ".") )
-- : "didn't found a warning";
-+ : "didn't find a warning";
- }
-
- sub _exp_warn_msg {
-@@ -94,7 +94,7 @@
- __FILE__,
- "line",
- CARP_LINE) ) # Note the difference, that carp msg
-- : "didn't found a warning"; # aren't finished by '.'
-+ : "didn't find a warning"; # aren't finished by '.'
- }
-
- sub _exp_carp_msg {
---- a/t/warning_like.t
-+++ b/t/warning_like.t
-@@ -79,7 +79,7 @@
- __FILE__,
- "line",
- WARN_LINE . ".") )
-- : "didn't found a warning";
-+ : "didn't find a warning";
- }
-
- sub _exp_warn_msg {
-@@ -96,7 +96,7 @@
- __FILE__,
- "line",
- CARP_LINE) ) # Note the difference, that carp msg
-- : "didn't found a warning"; # aren't finished by '.'
-+ : "didn't find a warning"; # aren't finished by '.'
- }
-
- sub _exp_carp_msg {
---- a/t/warnings_are.t
-+++ b/t/warnings_are.t
-@@ -81,12 +81,12 @@
-
- sub _found_warn_msg {
- @_ ? map({"found warning: $_ at ". __FILE__ . " line " . WARN_LINE . "." } @_)
-- : "didn't found a warning";
-+ : "didn't find a warning";
- }
-
- sub _found_carp_msg {
- @_ ? map({"found carped warning: $_ at ". __FILE__ . " line " . CARP_LINE} @_)
-- : "didn't found a warning";
-+ : "didn't find a warning";
- }
-
-
---- a/t/warnings_like.t
-+++ b/t/warnings_like.t
-@@ -83,12 +83,12 @@
-
- sub _found_warn_msg {
- @_ ? map({"found warning: $_ at ". __FILE__ . " line " . WARN_LINE . "." } @_)
-- : "didn't found a warning";
-+ : "didn't find a warning";
- }
-
- sub _found_carp_msg {
- @_ ? map({"found carped warning: $_ at ". __FILE__ . " line " . CARP_LINE} @_)
-- : "didn't found a warning";
-+ : "didn't find a warning";
- }
-
-
+++ /dev/null
-language.patch
+++ /dev/null
-#!/usr/bin/make -f
-# This debian/rules file is provided as a template for normal perl
-# packages. It was created by Marc Brockschmidt <marc@dch-faq.de> for
-# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
-# be used freely wherever it is useful.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-# If set to a true value then MakeMaker's prompt function will
-# always return the default without waiting for user input.
-export PERL_MM_USE_DEFAULT=1
-
-include /usr/share/quilt/quilt.make
-
-PERL ?= /usr/bin/perl
-PACKAGE = $(shell dh_listpackages)
-TMP = $(CURDIR)/debian/$(PACKAGE)
-
-build: build-stamp
-build-stamp: $(QUILT_STAMPFN)
- dh_testdir
- $(PERL) Makefile.PL INSTALLDIRS=vendor
- $(MAKE)
- $(MAKE) test
- touch $@
-
-clean: unpatch
- dh_testdir
- dh_testroot
- dh_clean build-stamp install-stamp
- [ ! -f Makefile ] || $(MAKE) realclean
-
-install: install-stamp
-install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
- $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
- [ ! -d $(TMP)/usr/lib/perl5 ] || \
- rmdir --ignore-fail-on-non-empty --parents --verbose \
- $(TMP)/usr/lib/perl5
- touch $@
-
-binary-arch:
-# We have nothing to do here for an architecture-independent package
-
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installdocs
- dh_installchangelogs Changes
- dh_perl
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+++ /dev/null
-version=3
-http://search.cpan.org/dist/Test-Warn/ .*/Test-Warn-([[:digit:]].*)\.tar\.gz
+++ /dev/null
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl 1.t'
-
-#########################
-
-# change 'tests => 1' to 'tests => last_test_to_print';
-
-use Test;
-BEGIN { plan tests => 1 };
-use Test::Warn;
-ok(1); # If we made it this far, we're ok.
-
-#########################
-
-# Insert your test code below, the Test::More module is use()ed here so read
-# its man page ( perldoc Test::More ) for help writing this test script.
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Carp;
-
-use Test::Builder::Tester tests => 6;
-Test::Builder::Tester::color 'on';
-use Test::Warn;
-
-sub foo {
- warn "Warning 1";
- carp "Carping 2";
- carp "Carping 3";
- warn "Warning 4";
-}
-
-use File::Spec;
-my $tcarped = File::Spec->catfile('t','carped.t');
-$tcarped =~ s/\\/\//g if $^O eq 'MSWin32';
-
-test_out "ok 1";
-warnings_like {foo()} [map {qr/$_/} (1 .. 4)];
-test_test "Warnings and Carpings mixed, asked only for like warnings";
-
-test_out "not ok 1";
-test_fail +10;
-test_diag
-"found warning: Warning 1 at $tcarped line 13.",
-"found carped warning: Carping 2 at $tcarped line 14",
-"found carped warning: Carping 3 at $tcarped line 15",
-"found warning: Warning 4 at $tcarped line 16.",
-"expected to find carped warning: (?-xism:1)",
-"expected to find carped warning: (?-xism:2)",
-"expected to find carped warning: (?-xism:3)",
-"expected to find carped warning: (?-xism:4)";
-warnings_like {foo()} [{carped => [map {qr/$_/} (1 .. 4)]}];
-test_test "Warnings and Carpings mixed, asked only for like carpings";
-
-test_out "ok 1";
-warnings_like {foo()} [qr/1/, {carped => [qr/2/, qr/3/]}, qr/4/];
-test_test "Warnings and Carpings mixed, asked for the right likes";
-
-my @msg = ("Warning 1", "Carping 2", "Carping 3", "Warning 4");
-test_out "ok 1";
-warnings_are {foo()} \@msg;
-test_test "Warnings and Carpings mixed, asked only for warnings";
-
-test_out "not ok 1";
-test_fail +10;
-test_diag
-"found warning: Warning 1 at $tcarped line 13.",
-"found carped warning: Carping 2 at $tcarped line 14",
-"found carped warning: Carping 3 at $tcarped line 15",
-"found warning: Warning 4 at $tcarped line 16.",
-"expected to find carped warning: Warning 1",
-"expected to find carped warning: Carping 2",
-"expected to find carped warning: Carping 3",
-"expected to find carped warning: Warning 4";
-warnings_are {foo()} {carped => \@msg};
-test_test "Warnings and Carpings mixed, asked only for carpings";
-
-test_out "ok 1";
-warnings_are {foo()} [$msg[0], {carped => [@msg[1..2]]}, $msg[3]];
-test_test "Warnings and Carpings mixed, asked for the right ones";
+++ /dev/null
-#!perl -T\r
-\r
-use Test::More;\r
-eval "use Test::Pod 1.14";\r
-plan skip_all => "Test::Pod 1.14 required for testing POD" if $@;\r
-all_pod_files_ok();\r
+++ /dev/null
-#!/usr/bin/perl
-
-BEGIN {
- chdir 't' if -d 't';
- unshift @INC, '../blib/lib';
-}
-
-use strict;
-use warnings;
-
-use Carp;
-
-use constant SUBTESTS_PER_TESTS => 6;
-
-use constant TESTS =>(
- ["ok", "my warning", "my warning", "standard warning to find"],
- ["not ok", "my warning", "another warning", "another warning instead of my warning"],
- ["not ok", "warning general not", "warning general", "quite only a sub warning"],
- ["not ok", undef, "a warning", "no warning, but expected one"],
- ["not ok", "a warning", undef, "warning, but didn't expect one"],
- ["ok", undef, undef, "no warning"],
- ["ok", '$!"%&/()=', '$!"%&/()=', "warning with crazy letters"],
- ["not ok", "warning 1|warning 2", "warning1", "more than one warning"]
-);
-
-use Test::Builder::Tester tests => TESTS() * SUBTESTS_PER_TESTS;
-use Test::Warn;
-use Test::Exception;
-
-Test::Builder::Tester::color 'on';
-
-use constant WARN_LINE => line_num +2;
-sub _make_warn {
- warn $_ for grep $_, split m:\|:, (shift() || "");
-}
-
-use constant CARP_LINE => line_num +2;
-sub _make_carp {
- carp $_ for grep $_, split m:\|:, (shift() || "");
-}
-
-use constant CARP_LEVELS => (0 .. 2);
-sub _create_exp_warning {
- my ($carplevel, $warning) = @_;
- return $warning if $carplevel == 0;
- return {carped => $warning} if $carplevel == 1;
- return {carped => [$warning]} if $carplevel == 2;
-}
-
-test_warning_is(@$_) foreach TESTS();
-
-sub test_warning_is {
- my ($ok, $msg, $exp_warning, $testname) = @_;
- for my $carp (CARP_LEVELS) {
- *_found_msg = $carp ? *_found_carp_msg : *_found_warn_msg;
- *_exp_msg = $carp ? *_exp_carp_msg : *_exp_warn_msg;
- *_make_warn_or_carp = $carp ? *_make_carp : *_make_warn;
- for my $t (undef, $testname) {
- test_out "$ok 1" . ($t ? " - $t" : "");
- if ($ok =~ /not/) {
- test_fail +4;
- test_diag _found_msg($_) for ($msg ? (split m-\|-, $msg) : $msg);
- test_diag _exp_msg($exp_warning);
- }
- warning_is {_make_warn_or_carp($msg)} _create_exp_warning($carp, $exp_warning), $t;
- test_test "$testname (with" . ($_ ? "" : "out") . " a testname)";
- }
- }
-}
-
-
-sub _found_warn_msg {
- defined($_[0])
- ? ( join " " => ("found warning:",
- $_[0],
- "at",
- __FILE__,
- "line",
- WARN_LINE . ".") )
- : "didn't found a warning";
-}
-
-sub _exp_warn_msg {
- defined($_[0])
- ? "expected to find warning: $_[0]"
- : "didn't expect to find a warning";
-}
-
-sub _found_carp_msg {
- defined($_[0])
- ? ( join " " => ("found carped warning:",
- $_[0],
- "at",
- __FILE__,
- "line",
- CARP_LINE) ) # Note the difference, that carp msg
- : "didn't found a warning"; # aren't finished by '.'
-}
-
-sub _exp_carp_msg {
- defined($_[0])
- ? "expected to find carped warning: $_[0]"
- : "didn't expect to find a warning";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-BEGIN {
- chdir 't' if -d 't';
- unshift @INC, '../blib/lib';
-}
-
-use strict;
-use warnings;
-
-use Carp;
-
-use constant TESTS =>(
- ["ok", "my warning", "my", "standard warning to find"],
- ["not ok", "my warning", "another", "another warning instead of my warning"],
- ["not ok", "warning general not", "^(?!warning general)", "quite only a sub warning"],
- ["not ok", undef, "a warning", "no warning, but expected one"],
- ["not ok", "a warning", undef, "warning, but didn't expect one"],
- ["ok", undef, undef, "no warning"],
- ["ok", '$!"%&/()=', '\$\!\"\%\&\/\(\)\=', "warning with crazy letters"],
- ["not ok", "warning 1|warning 2", "warning1", "more than one warning"]
-);
-use constant SUBTESTS_PER_TESTS => 12;
-
-use Test::Builder::Tester tests => TESTS() * SUBTESTS_PER_TESTS;
-use Test::Exception;
-use Test::Warn;
-
-Test::Builder::Tester::color 'on';
-
-use constant WARN_LINE => line_num +2;
-sub _make_warn {
- warn $_ for grep $_, split m:\|:, (shift() || "");
-}
-
-use constant CARP_LINE => line_num +2;
-sub _make_carp {
- carp $_ for grep $_, split m:\|:, (shift() || "");
-}
-
-use constant CARP_LEVELS => (0 .. 2);
-sub _create_exp_warning {
- my ($carplevel, $warning) = @_;
- return $warning if $carplevel == 0;
- return {carped => $warning} if $carplevel == 1;
- return {carped => [$warning]} if $carplevel == 2;
-}
-
-test_warning_like(@$_) foreach TESTS();
-
-sub test_warning_like {
- my ($ok, $msg, $exp_warning, $testname) = @_;
- for my $carp (CARP_LEVELS) {
- *_found_msg = $carp ? *_found_carp_msg : *_found_warn_msg;
- *_exp_msg = $carp ? *_exp_carp_msg : *_exp_warn_msg;
- *_make_warn_or_carp = $carp ? *_make_carp : *_make_warn;
- for my $t (undef, $testname) {
- my @regexes = $exp_warning ? (qr/$exp_warning/, "/$exp_warning/")
- : (undef, undef); # simpler to count the tests
- for my $regex (@regexes) {
- test_out "$ok 1" . ($t ? " - $t" : "");
- if ($ok =~ /not/) {
- test_fail +4;
- test_diag _found_msg($_) for ($msg ? (split m-\|-, $msg) : $msg);
- test_diag _exp_msg($regex);
- }
- warning_like {_make_warn_or_carp($msg)} _create_exp_warning($carp, $regex), $t;
- test_test "$testname (with" . ($_ ? "" : "out") . " a testname)";
- }
- }
- }
-}
-
-sub _found_warn_msg {
- defined($_[0])
- ? ( join " " => ("found warning:",
- $_[0],
- "at",
- __FILE__,
- "line",
- WARN_LINE . ".") )
- : "didn't found a warning";
-}
-
-sub _exp_warn_msg {
- defined($_[0])
- ? "expected to find warning: $_[0]"
- : "didn't expect to find a warning";
-}
-
-sub _found_carp_msg {
- defined($_[0])
- ? ( join " " => ("found carped warning:",
- $_[0],
- "at",
- __FILE__,
- "line",
- CARP_LINE) ) # Note the difference, that carp msg
- : "didn't found a warning"; # aren't finished by '.'
-}
-
-sub _exp_carp_msg {
- defined($_[0])
- ? "expected to find carped warning: $_[0]"
- : "didn't expect to find a warning";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-BEGIN {
- chdir 't' if -d 't';
- unshift @INC, '../blib/lib';
-}
-
-use strict;
-use warnings;
-
-use Carp;
-
-use constant SUBTESTS_PER_TESTS => 16;
-
-use constant TESTS =>(
- [ "ok", ["my warning"], ["my warning"], "standard warning to find"],
- ["not ok", ["my warning"], ["another warning"], "another warning instead of my warning"],
- ["not ok", ["warning general not"], ["warning general"], "quite only a sub warning"],
- ["not ok", [], ["a warning"], "no warning, but expected one"],
- ["not ok", ["a warning"], [], "warning, but didn't expect one"],
- [ "ok", [], [], "no warning"],
- [ "ok", ['$!"%&/()='], ['$!"%&/()='], "warning with crazy letters"],
- ["not ok", ["warning 1","warning 2"], ["warning 1"], "more than one warning (1)"],
- ["not ok", ["warning 1","warning 2"], ["warning 2"], "more than one warning (2)"],
- [ "ok", ["warning 1","warning 2"], ["warning 1", "warning 2"], "more than one warning (standard ok)"],
- [ "ok", ["warning 1","warning 1"], ["warning 1", "warning 1"], "more than one warning (two similar warnings)"],
- ["not ok", ["warning 1","warning 2"], ["warning 2", "warning 1"], "more than one warning (different order)"],
- [ "ok", [('01' .. '99')], [('01' .. '99')], "many warnings ok"],
- ["not ok", [('01' .. '99')], [('01' .. '99'), '100'], "many, but diff. warnings"]
-);
-
-use Test::Builder::Tester tests => TESTS() * SUBTESTS_PER_TESTS;
-use Test::Warn;
-
-Test::Builder::Tester::color 'on';
-
-use constant WARN_LINE => line_num +2;
-sub _make_warn {
- warn $_ for @_;
-}
-
-use constant CARP_LINE => line_num +2;
-sub _make_carp {
- carp $_ for @_;
-}
-
-use constant CARP_LEVELS => (0 .. 3);
-sub _create_exp_warning {
- my ($carplevel, $warning) = @_;
- # ['x', 'y', 'z']
- return $warning if $carplevel == 0;
- return [map { {carped => $_} } @$warning] if $carplevel == 1;
- return {carped => $warning} if $carplevel == 2;
- return [{carped => $warning}] if $carplevel == 3;
-}
-
-my $i = 0;
-test_warnings_are(@$_) foreach TESTS();
-
-sub test_warnings_are {
- my ($ok, $msg, $exp_warning, $testname) = @_;
- for my $carp (CARP_LEVELS) {
- *_found_msg = $carp ? *_found_carp_msg : *_found_warn_msg;
- *_exp_msg = $carp ? *_exp_carp_msg : *_exp_warn_msg;
- *_make_warn_or_carp = $carp ? *_make_carp : *_make_warn;
- for my $t (undef, $testname) {
- for my $is_or_are (qw/is are/) {
- test_out "$ok 1" . ($t ? " - $t" : "");
- if ($ok =~ /not/) {
- test_fail +5;
- test_diag _found_msg(@$msg);
- test_diag _exp_msg(@$exp_warning);
- }
- my $ew = _create_exp_warning($carp, $exp_warning);
- $is_or_are eq 'is' ? warning_is {_make_warn_or_carp(@$msg)} $ew, $t : warnings_are {_make_warn_or_carp(@$msg)} $ew, $t;
- test_test "$testname (with" . ($_ ? "" : "out") . " a testname)";
- }
- }
- }
-}
-
-sub _found_warn_msg {
- @_ ? map({"found warning: $_ at ". __FILE__ . " line " . WARN_LINE . "." } @_)
- : "didn't found a warning";
-}
-
-sub _found_carp_msg {
- @_ ? map({"found carped warning: $_ at ". __FILE__ . " line " . CARP_LINE} @_)
- : "didn't found a warning";
-}
-
-
-sub _exp_warn_msg {
- @_ ? map({"expected to find warning: $_" } @_)
- : "didn't expect to find a warning";
-}
-
-sub _exp_carp_msg {
- @_ ? map({"expected to find carped warning: $_" } @_)
- : "didn't expect to find a warning";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-BEGIN {
- chdir 't' if -d 't';
- unshift @INC, '../blib/lib';
-}
-
-use strict;
-use warnings;
-
-use Test::Exception;
-use Carp;
-
-use constant TESTS =>(
- [ "ok", ["my warning"], ["my"], "standard warning to find"],
- ["not ok", ["my warning"], ["another"], "another warning instead of my warning"],
- ["not ok", ["warning general not"], ["^(?!warning general)"], "quite only a sub warning"],
- ["not ok", [], ["a warning"], "no warning, but expected one"],
- ["not ok", ["a warning"], [], "warning, but didn't expect one"],
- [ "ok", [], [], "no warning"],
- [ "ok", ['$!"%&/()='], ['\$\!\"\%\&\/\(\)\='], "warning with crazy letters"],
- ["not ok", ["warning 1","warning 2"], ["warning 1"], "more than one warning (1)"],
- ["not ok", ["warning 1","warning 2"], ["warning 2"], "more than one warning (2)"],
- [ "ok", ["warning 1","warning 2"], ["warning 1", "warning 2"], "more than one warning (standard ok)"],
- [ "ok", ["warning 1","warning 1"], ["warning 1", "warning 1"], "more than one warning (two similar warnings)"],
- ["not ok", ["warning 1","warning 2"], ["warning 2", "warning 1"], "more than one warning (different order)"],
- [ "ok", [('01' .. '99')], [('01' .. '99')], "many warnings ok"],
- ["not ok", [('01' .. '99')], [('01' .. '99'), '100'], "many, but diff. warnings"]
-);
-use constant SUBTESTS_PER_TESTS => 32;
-
-use Test::Builder::Tester tests => TESTS() * SUBTESTS_PER_TESTS;
-use Test::Warn;
-
-Test::Builder::Tester::color 'on';
-
-use constant WARN_LINE => line_num +2;
-sub _make_warn {
- warn $_ for @_;
-}
-
-use constant CARP_LINE => line_num +2;
-sub _make_carp {
- carp $_ for @_;
-}
-
-use constant CARP_LEVELS => (0 .. 3);
-sub _create_exp_warning {
- my ($carplevel, $warning) = @_;
- # ['x', 'y', 'z']
- return $warning if $carplevel == 0;
- return [map { {carped => $_} } @$warning] if $carplevel == 1;
- return {carped => $warning} if $carplevel == 2;
- return [{carped => $warning}] if $carplevel == 3;
-}
-
-my $i = 0;
-test_warnings_like(@$_) foreach TESTS();
-
-sub test_warnings_like {
- my ($ok, $msg, $exp_warning, $testname) = @_;
- for my $regexes ([map {qr/$_/} @$exp_warning], [map {"/$_/"} @$exp_warning]) {
- for my $carp (CARP_LEVELS) {
- *_found_msg = $carp ? *_found_carp_msg : *_found_warn_msg;
- *_exp_msg = $carp ? *_exp_carp_msg : *_exp_warn_msg;
- *_make_warn_or_carp = $carp ? *_make_carp : *_make_warn;
- for my $t (undef, $testname) {
- for my $is_or_are (qw/is are/) {
- test_out "$ok 1" . ($t ? " - $t" : "");
- if ($ok =~ /not/) {
- test_fail +5;
- test_diag _found_msg(@$msg);
- test_diag _exp_msg(@$regexes);
- }
- my $ew = _create_exp_warning($carp, $regexes);
- $is_or_are eq 'is' ? warning_like {_make_warn_or_carp(@$msg)} $ew, $t : warnings_like {_make_warn_or_carp(@$msg)} $ew, $t;
- test_test "$testname (with" . ($t ? "" : "out") . " a testname)";
- }
- }
- }
- }
-}
-
-sub _found_warn_msg {
- @_ ? map({"found warning: $_ at ". __FILE__ . " line " . WARN_LINE . "." } @_)
- : "didn't found a warning";
-}
-
-sub _found_carp_msg {
- @_ ? map({"found carped warning: $_ at ". __FILE__ . " line " . CARP_LINE} @_)
- : "didn't found a warning";
-}
-
-
-sub _exp_warn_msg {
- @_ ? map({"expected to find warning: $_" } @_)
- : "didn't expect to find a warning";
-}
-
-sub _exp_carp_msg {
- @_ ? map({"expected to find carped warning: $_" } @_)
- : "didn't expect to find a warning";
-}
+++ /dev/null
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-Format: 1.0
-Source: libtest-warn-perl
-Binary: libtest-warn-perl
-Architecture: all
-Version: 0.11-1
-Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
-Uploaders: Jay Bonci <jaybonci@debian.org>, gregor herrmann <gregoa@debian.org>
-Homepage: http://search.cpan.org/dist/Test-Warn/
-Standards-Version: 3.8.0
-Vcs-Browser: http://svn.debian.org/wsvn/pkg-perl/trunk/libtest-warn-perl/
-Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libtest-warn-perl/
-Build-Depends: debhelper (>= 5), quilt (>= 0.40)
-Build-Depends-Indep: perl (>= 5.6.0-16), libsub-uplevel-perl (>= 0.12), libtest-exception-perl, libarray-compare-perl, libtest-simple-perl, libtree-dagnode-perl, libtest-pod-perl
-Checksums-Sha1:
- 3cad88de96528d9c0154fbd3a23540d115f383d6 9661 libtest-warn-perl_0.11.orig.tar.gz
- b3b6b050ae746b6d5bea2a13720280ffbc11db30 6133 libtest-warn-perl_0.11-1.diff.gz
-Checksums-Sha256:
- d1afcee7021a9d39d823dac1431420581604f8a1f99752767955cbfdd7082ff9 9661 libtest-warn-perl_0.11.orig.tar.gz
- 42f3a0b2ff822b3b0c9e0ac7cb0fe8be53f2239ba5ecaa13ede69474067e796a 6133 libtest-warn-perl_0.11-1.diff.gz
-Files:
- 1000ef6d94b54ca9eb75fb994a7e8bec 9661 libtest-warn-perl_0.11.orig.tar.gz
- 1950b831eb98ed952f2bbd71065fac9c 6133 libtest-warn-perl_0.11-1.diff.gz
-
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.9 (GNU/Linux)
-
-iEYEARECAAYFAkh2V/EACgkQOzKYnQDzz+SodwCfTLwxxFNQDSiQsLXOhNAGyeM7
-c4oAoIkwzj4zVjkWhamSAARoKgqMQ7Sw
-=V+jK
------END PGP SIGNATURE-----