1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
#!/usr/bin/perl
# Copyright & Licensing at the end
use strict;
use 5.010;
# TODO: add support for debian/copyright files in the form that
# dh_make creates them, or at least handle debian/copyright not being
# machine parseable in a nicer way. (replacing the information
# gathered from there with FIXMEs instead of erroring out)
use Dpkg::Control::Info;
use Dpkg::Control;
use Config::Model ;
use Config::Model::Lister ;
use File::Slurp qw(read_file);
use Encode;
use Log::Log4perl qw(:easy) ;
Log::Log4perl->easy_init($WARN);
my $control = Dpkg::Control::Info->new();
my $source = $control->get_source;
my @pkgs = $control->get_packages;
my $pkg = $pkgs[0];
my @files;
my @licenses;
my @descriptions = split( "\n", $pkg->{Description} );
my $short_description = $descriptions[0];
# this snippet does not break when model class are changed
my ( $categories, $appli_info, $appli_map ) =
Config::Model::Lister::available_models;
my $root_model = $appli_map->{'dpkg-copyright'} ;
my $model = Config::Model->new() ;
my $copyright_obj = $model->instance(root_class_name => $root_model) ->config_root ;
my $changelog_file;
open $changelog_file, '-|', 'dpkg-parsechangelog';
binmode $changelog_file, ':utf8';
my $changelog = Dpkg::Control->new();
$changelog->parse( $changelog_file, 'debian/changelog' );
close $changelog_file;
my $lang;
if ( $source->{Source} =~ m/-perl$/ || $source->{Maintainer} =~ m/Debian Perl Group/ ) {
$lang = 'Perl';
}
elsif ( $source->{Source} =~ m/-ruby$/ ) {
$lang = 'Ruby';
}
else {
$lang = 'FIXME';
}
say 'From: ' . encode("MIME-Header", $changelog->{Maintainer});
if ( $ENV{SECRETLY_ITP} ) {
say "To: Debian Bug Tracking System <quiet\@bugs.debian.org>";
}
else {
say "To: Debian Bug Tracking System <submit\@bugs.debian.org>";
}
say 'Subject: ITP: ' . $source->{Source} . ' -- ' . $short_description;
say 'Date: ' . `date -R`;
# ^ that adds an extra newline ... bwahahahaha!
my $owner;
if ( $source->{Uploaders} ) {
$owner = $source->{Uploaders};
}
else {
$owner = $source->{Maintainer};
}
say 'Package: wnpp';
say 'Owner: ' . decode( 'UTF-8', $owner );
say 'Severity: wishlist';
if ( !$ENV{SECRETLY_ITP} ) {
if ( $lang eq 'Perl' ) {
say "X-Debbugs-CC: debian-devel\@lists.debian.org, debian-perl\@lists.debian.org";
}
else {
say "X-Debbugs-CC: debian-devel\@lists.debian.org";
}
}
say '';
say '* Package name : ' . $source->{Source};
my $version = $changelog->{Version};
$version =~ s/-1$//;
say ' Version : ' . $version;
my $maintainer = join(' ', $copyright_obj->fetch_element('Upstream-Contact')->fetch_all_values) || 'FIXME';
say " Upstream Author : " . $maintainer;
my $homepage = $source->{Homepage}
|| $copyright_obj->fetch_element_value('Source')
|| 'FIXME';
my $license = $copyright_obj->grab_value('Files:"*" License short_name') || 'FIXME' ;
say '* URL : ' . $homepage;
say '* License : ' . $license ;
say ' Programming Lang: ' . $lang;
my ( $short, $long ) = split( /\n/, $pkg->{Description}, 2 );
say ' Description : ' . $short;
say '';
say $long;
my $control_file_contents = read_file('debian/control');
if ($control_file_contents =~ /^Maintainer:.*pkg-perl-maintainers\@lists\.alioth\.debian\.org/m) {
say '';
say 'The package will be maintained under the umbrella of the Debian Perl Group.';
}
say '';
say '--';
say 'Generated with the help of dpt-gen-itp(1) from pkg-perl-tools.';
__END__
=head1 NAME
dpt-gen-itp - generate ITP trivia
=head1 SYNOPSIS
C<< dpt gen-itp > tmp && $EDITOR tmp && sendmail < tmp >>
=head1 DESCRIPTION
B<dpt gen-itp> can help in constructing the Intent To Package bug report which
is to be filed when one starts working on a package. The script itself doesn't
send the mail, but prepares the boiler-plate so that you don't have to worry
about the proper format or other trivia.
B<dpt gen-itp> gets the information from F<debian/control> and
F<debian/copyright>, so filling up these files with real data will help.
=head1 COPYRIGHT & LICENSE
Copyright 2009, Ryan Niebur
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
=cut
|