summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdh_illumos_gate113
1 files changed, 69 insertions, 44 deletions
diff --git a/dh_illumos_gate b/dh_illumos_gate
index 1d9a923..f63fc17 100755
--- a/dh_illumos_gate
+++ b/dh_illumos_gate
@@ -60,6 +60,10 @@ as is to L<tar(1)> via I<--exclude=PATTERN>.
Copy all extracted files into this directory, and
make any changes in there instead of the current directory.
+=item B<--create-orig>
+
+Create I<.orig> tarball.
+
=back
=head1 EXAMPLES
@@ -88,6 +92,10 @@ then add F<usr/src/uts/common/sys/>
dh_illumos_gate -- --wildcards-match-slash usr/src/uts/*.h
+=item Create source tarball out of F<usr/src/cmd> excluding F<*.mf> files
+
+ dh_illumos_gate --create-orig usr/src/cmd -X*.mf
+
=back
=head1 FILES
@@ -116,28 +124,18 @@ Here are things which this helper does after unpacking illumos sources.
$dh{DESTDIR} = '.';
-init( options => { 'build|B' => \$dh{BUILD}, 'destdir|D=s' => \$dh{DESTDIR} } );
+init(
+ options => {
+ 'build|B' => \$dh{BUILD},
+ 'destdir|D=s' => \$dh{DESTDIR},
+ 'create-orig' => \$dh{CREATE_ORIG},
+ }
+);
my %options = ( file => 'debian/changelog' );
my $changelog = changelog_parse(%options);
my $version = $changelog->{'Version'};
-my $VER;
-if ( $version =~ /^(\d+(\.\d+)+(\.git\w+)?).*$/ ) {
- $VER = $1;
-}
-else {
- error( "Could not determine illumos source version from changelog. "
- . "It should be like 5.10.6.gitXYZ+1, but it is '$version'" );
-}
-my $tarball = "/usr/src/illumos-gate/illumos-gate-$VER.tar.xz";
-
-if ( !-f $tarball ) {
- error(
-"$tarball does not exist. You might not have package illumos-source-$VER "
- . "installed or have a typo in debian/changelog" );
-}
-
my @tar_X = ();
if ( defined( $dh{'EXCLUDE'} ) && $dh{'EXCLUDE'} ) {
foreach my $x ( @{ $dh{'EXCLUDE'} } ) {
@@ -146,40 +144,67 @@ if ( defined( $dh{'EXCLUDE'} ) && $dh{'EXCLUDE'} ) {
}
}
-my @to_extract = ();
-if (@ARGV) {
- if ( $dh{'BUILD'} ) {
- push @to_extract,
- (
- 'usr/src/Makefile*', 'usr/src/common/mapfiles',
- 'usr/src/tools/scripts/bldenv.sh',
- );
- if ( grep { m|.*usr/src/lib/.*| } @ARGV ) {
- push @to_extract, 'usr/src/lib/Makefile*';
- }
- if ( grep { m|.*usr/src/cmd/.*| } @ARGV ) {
- push @to_extract, 'usr/src/cmd/Makefile*';
- }
- }
- push @to_extract, map { m,(?:illumos-gate/)?(.*),; $1 } @ARGV;
+if ( $dh{CREATE_ORIG} ) {
+ my $source = $changelog->{'Source'};
+ my $source_version = $version =~ s!^(.*)-[^-]+$!$1!r;
+ my $tarball = "../${source}_${source_version}.orig.tar.xz";
+ doit( 'tar', '-c', '-J', '--owner=0', '--group=0', '--mode=u=rwX,go=rX',
+ '-f', $tarball, @tar_X, @ARGV );
+ exit;
}
else {
- push @to_extract, 'usr';
-}
-my @to_extract_real = ();
-foreach my $p (@to_extract) {
- if ( $p =~ /^-/ ) {
- push @to_extract_real, $p; #XXX: tar option
+ my $VER;
+ if ( $version =~ /^(\d+(\.\d+)+(\.git\w+)?).*$/ ) {
+ $VER = $1;
}
else {
- push @to_extract_real, 'illumos-gate/' . $p; #XXX: path
+ error( "Could not determine illumos source version from changelog. "
+ . "It should be like 5.10.6.gitXYZ+1, but it is '$version'" );
+ }
+ my $tarball = "/usr/src/illumos-gate/illumos-gate-$VER.tar.xz";
+
+ if ( !-f $tarball ) {
+ error(
+"$tarball does not exist. You might not have package illumos-source-$VER "
+ . "installed or have a typo in debian/changelog" );
}
-}
-doit( 'mkdir', '-p', $dh{DESTDIR} );
-doit( 'tar', '-C', $dh{DESTDIR}, '-x', '-f', $tarball, @tar_X, '--wildcards',
- '--strip-components=1', @to_extract_real );
+ my @to_extract = ();
+ if (@ARGV) {
+ if ( $dh{'BUILD'} ) {
+ push @to_extract,
+ (
+ 'usr/src/Makefile*', 'usr/src/common/mapfiles',
+ 'usr/src/tools/scripts/bldenv.sh',
+ );
+ if ( grep { m|.*usr/src/lib/.*| } @ARGV ) {
+ push @to_extract, 'usr/src/lib/Makefile*';
+ }
+ if ( grep { m|.*usr/src/cmd/.*| } @ARGV ) {
+ push @to_extract, 'usr/src/cmd/Makefile*';
+ }
+ }
+ push @to_extract, map { m,(?:illumos-gate/)?(.*),; $1 } @ARGV;
+ }
+ else {
+ push @to_extract, 'usr';
+ }
+
+ my @to_extract_real = ();
+ foreach my $p (@to_extract) {
+ if ( $p =~ /^-/ ) {
+ push @to_extract_real, $p; #XXX: tar option
+ }
+ else {
+ push @to_extract_real, 'illumos-gate/' . $p; #XXX: path
+ }
+ }
+
+ doit( 'mkdir', '-p', $dh{DESTDIR} );
+ doit( 'tar', '-C', $dh{DESTDIR}, '-x', '-f', $tarball, @tar_X,
+ '--wildcards', '--strip-components=1', @to_extract_real );
+}
=item Saving original files