-
Notifications
You must be signed in to change notification settings - Fork 5
/
dh_dist_zilla_origtar
executable file
·61 lines (43 loc) · 1.64 KB
/
dh_dist_zilla_origtar
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
#!/usr/bin/perl
use strict;
use warnings;
use Debian::Debhelper::Dh_Lib;
init(options => { 'pristine-tar' => \$dh{PRISTINE_TAR},
'no-clean' => \$dh{NO_CLEAN} } );
my $source_pkg = sourcepackage();
my $is_native = isnative($source_pkg);
my $verbose = $dh{VERBOSE};
my $pristine_tar = $dh{PRISTINE_TAR};
my $no_clean = $dh{NO_CLEAN};
my $upstream_version = $dh{VERSION};
# Strip Debian revision
$upstream_version =~ s/-[^-]+$//x;
# First clean artifacts from previous, potentially manual builds
doit(qw(dzil clean)) unless $no_clean;
my $orig_tar = "../${source_pkg}_${upstream_version}.orig.tar";
doit('tar',
($verbose ? 'cvf' : 'cf'),
$orig_tar,
($is_native ? '' : '--exclude=debian'),
qw(--exclude=.git --exclude=.svn --exclude=.hg .),
@ARGV);
doit('xz', '-7f'.($verbose ? 'v' : ''), $orig_tar);
if ($pristine_tar) {
doit(qw(pristine-tar commit), ($verbose ? '-v' : ()), "${orig_tar}.xz");
}
=head1 NAME
dh_dist_zilla_origtar - debhelper add-on to generate an upstream tar ball
=head1 DESCRIPTION
dh_dist_zilla_origtar is the backend for the dh-dist-zilla's C<dh
get-orig-source> target to generate minimal upstream tar-balls
suitable for use with dh-dist-zilla.
It runs C<dzil clean> by default before creating the tar ball.
=head1 OPTIONS
C<--pristine-tar>: Also commit generated upstream tar ball to
pristine-tar branch using pristine-tar.
C<--no-clean>: Don't run C<dzil clean> before creating the tar ball.
Options before C<--> are used by debhelper. Options after C<--> are passed on to C<tar>.
=head1 SEE ALSO
L<dh(1)>, L<debhelper(7)>, L<dh-dist-zilla(7)>
=head1 AUTHOR
Axel Beckert <[email protected]>