/usr/bin/dh_gnome_clean is in gnome-pkg-tools 0.20.2ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #!/usr/bin/perl -w
=head1 NAME
dh_gnome - tools for the Debian GNOME Packaging Team
=cut
use strict;
use Debian::Debhelper::Dh_Lib;
=head1 SYNOPSIS
B<dh_gnome_clean> [I<debhelper options>] [--no-control] [--check-dist]
=head1 DESCRIPTION
gnome-pkg-tools contains some useful tools for the Debian GNOME Packaging Team.
dh_gnome_clean is a tool designed to provide useful functions to GNOME packages
which do use of debhelper as preferred build system, similar to the CDBS
routines provided by gnome-pkg-tools.
dh_gnome_clean handles some routines to be run during clean phase.
=head1 OPTIONS
=over 4
=item B<--no-control>
Use this flag if you do not want to recreate debian/control file on top of
debian/control.in, or if you do not provide the latter.
=item B<--check-dist>
Use this flag if you want to avoid unwanted uploads to unstable.
=back
=cut
init(options => { "no-control" => \$dh{MANGLE_CONTROL},
"check-dist" => \$dh{CHECK_DIST} });
# Members list of Debian GNOME Maintainers
my $team_list = "/usr/share/gnome-pkg-tools/pkg-gnome.team";
# Uploaders which should always be listed in UPLOADERS;
# the Maintainer is still excluded
my $always_uploads = "Debian GNOME Maintainers <pkg-gnome-maintainers\@lists.alioth.debian.org>";
# Number of uploads to be considered recent for the list of recent uploaders
my $recent_uploads = 10;
# Header for debian/control
my $control_header = "/usr/share/gnome-pkg-tools/control.header";
# Allowed distributions in changelog
my @allowed_dists = ("experimental");
# Disallowed distributions in changelog
my @disallowed_dists = ("unstable");
sub mangle_control {
my @team_list;
my @uploaders;
my $maintainer;
# Save control.in content
open FILE, "debian/control.in" or die $!;
my @control = <FILE>;
close FILE;
# Save control_header content
open FILE, $control_header or die $!;
my @header = <FILE>;
close FILE;
# Determine pkg-gnome team members
open FILE, $team_list or die $!;
foreach my $line (<FILE>) {
if ($line =~ s/,//) {
push (@team_list, $line);
}
}
close FILE;
# Determine who uploaded package so far
open FILE, "debian/changelog" or die $!;
foreach my $line (<FILE>) {
if ($line =~ m/^ -- (.*>) /) {
my $uploader = $1;
if (grep { $_ =~ $uploader } @team_list) {
push (@uploaders, $uploader);
}
}
}
close FILE;
# Determine Maintainer
foreach (@control) {
$_ =~ m/^Maintainer: (.*)$/;
if ($1) {
$maintainer = $1;
}
}
$maintainer or die "Unable to determine Maintainer";
# Maintainer must not be listed in Uploaders
if (my ($index) = grep { $team_list[$_] =~ $maintainer } 0..$#team_list) {
delete $team_list[$index];
}
# Only consider a limited number of uploads
delete @uploaders[$recent_uploads..$#uploaders];
# Fill debian/control with collected data
open FILE, ">", "debian/control" or die $!;
print FILE @header;
my %hash = map { $_, 1 } @uploaders;
my $uploaders = join (", ", sort (keys %hash) );
foreach (@control) {
$_ =~ s/\@GNOME_TEAM\@/$uploaders/;
print FILE $_;
}
close FILE;
}
sub check_dist {
`dpkg-parsechangelog` =~ m/Distribution: (\S+)/;
my $distribution = $1;
foreach (@allowed_dists) {
return if $distribution eq $_;
}
foreach (@disallowed_dists) {
die "Disallowed distribution: $distribution" if $distribution eq $_;
}
print "Unknown distribution: $distribution\n";
}
unless ($dh{MANGLE_CONTROL}) { mangle_control(); }
if ($dh{CHECK_DIST}) { check_dist(); }
=head1 SEE ALSO
L<debhelper(7)>
This program is a part of gnome-pkg-tools but is made to work with debhelper.
=head1 AUTHORS
Luca Falavigna <dktrkranz@debian.org>
=cut
|