summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2015-10-11 21:45:11 +0300
committerIgor Pashev <pashev.igor@gmail.com>2015-10-11 22:14:15 +0300
commit5d84ea61efff09a0a4263389bf41e3a6015041c4 (patch)
tree9b5a7a1533329a24b60282a39f9f2f5800bd31ca
parent34efdfc56fe3cbbd5144933ff6b4567a080659aa (diff)
downloaddh-illumos-5d84ea61efff09a0a4263389bf41e3a6015041c4.tar.gz
dh_illumos_gate: --configure & --unpack-only
-rwxr-xr-xdh_illumos_gate68
1 files changed, 51 insertions, 17 deletions
diff --git a/dh_illumos_gate b/dh_illumos_gate
index c364b46..98ea6ef 100755
--- a/dh_illumos_gate
+++ b/dh_illumos_gate
@@ -14,17 +14,17 @@ use Cwd;
=head1 SYNOPSIS
B<dh_illumos_gate> [S<I<debhelper options>>] [options] [-- [tar options]]
-[files and/or directories to extract]
+[files and/or directories to pack/unpack]
=head1 DESCRIPTION
C<dh_illumos_gate> is responsible for unpacking illumos sources and adjusting the sources
for Debian build environment (paths to programs, command options, linker and compiler flags, etc.).
-C<dh_illumos_gate> extracts given files or directories, if any.
-Otherwise it extracts entire F<illumos-gate/usr/>.
+C<dh_illumos_gate> unpacks specified files or directories, if any.
+Otherwise it unpacks the entire F<illumos-gate/usr/>.
In any case B<-X> option can be used to exclude some files or directories,
-and top directory F<illumos-gate> is always stripped..
+and top directory F<illumos-gate> is always stripped.
If files interested to C<dh_illumos_gate> are unpacked they will be configured.
See L</DETAILS>.
@@ -42,22 +42,22 @@ L<dh_illumos_make(1)> provides more convenient way to do this.
=item B<-B> B<--build>
-Extract or pack files known to be required for building illumos components.
+Unpack or pack (by B<--create-orig>) files known to be required for building illumos components.
These are F<usr/src/tools/scripts/bldenv.sh>, F<usr/src/Makefile*>,
F<usr/src/common/mapfiles/*>. If any file under F<usr/src/lib> is
-requested, F<usr/src/lib/Makefile*> are extracted too. Same for
+requested, F<usr/src/lib/Makefile*> are [un]packed too. Same for
F<usr/src/cmd>. This option is provided only for convenience.
-You are free to extract these files explicitly.
+You are free to pack and unpack these files explicitly.
=item B<-X>I<PATTERN> B<--exclude=>I<PATTERN>
-Do not extract files or directories matching I<PATTERN>.
+Do not pack or unpack files or directories matching I<PATTERN>.
This option can be used multiple times. I<PATTERN> is passed
as is to L<tar(1)> via I<--exclude=PATTERN>.
=item B<-D>I<destdir> B<--destdir=>I<destdir>
-Copy all extracted files into this directory, and
+Copy all unpacked files into this directory, and
make any changes in there instead of the current directory.
=item B<--create-orig>
@@ -65,6 +65,16 @@ make any changes in there instead of the current directory.
Create I<.orig> tarball out of the listed files and directories.
Note that part of path before F<usr/src> will be stripped.
+=item B<--configure>
+
+Copy existing sources (F<./usr>) into the build directory specified by
+B<--destdir> (instead of unpacking the illumos-gate tarball)
+and then configure it.
+
+=item B<--unpack-only>
+
+Only unpack illumos-gate tarball, do not configure.
+
=back
=head1 EXAMPLES
@@ -97,6 +107,16 @@ then add F<usr/src/uts/common/sys/>
dh_illumos_gate --create-orig [path/to/]usr/src/cmd -X*.xml
+=item Prepare for debug and non-debug builds
+
+ dh_illumos_gate --configure --destdir=workdir/debug
+ dh_illumos_gate --configure --destdir=workdir/non-debug
+
+=item Migrate to 3.0 (quilt) format
+
+ dh_illumos_gate --unpack-only files...
+ dh_illumos_gate --create-orig files...
+
=back
=head1 FILES
@@ -130,6 +150,8 @@ init(
'build|B' => \$dh{BUILD},
'destdir|D=s' => \$dh{DESTDIR},
'create-orig' => \$dh{CREATE_ORIG},
+ 'configure' => \$dh{CONFIGURE},
+ 'unpack-only' => \$dh{UNPACK_ONLY},
}
);
@@ -181,6 +203,13 @@ if ( $dh{CREATE_ORIG} ) {
complex_doit("@tar @ARGV @extra");
exit;
}
+elsif ( $dh{CONFIGURE} ) {
+ if ( -e $dh{DESTDIR} ) {
+ error("Destination path `$dh{DESTDIR}' exists.");
+ }
+ doit( 'mkdir', '-p', $dh{DESTDIR} );
+ doit( 'cp', '-a', 'usr', "$dh{DESTDIR}/usr" );
+}
else {
my $ver;
@@ -233,18 +262,22 @@ else {
doit( 'mkdir', '-p', $dh{DESTDIR} );
doit( 'tar', '-C', $dh{DESTDIR}, '-x', '-f', $tarball, @tar_X,
'--wildcards', '--strip-components=1', @to_extract_real );
+
+ if ( $dh{UNPACK_ONLY} ) {
+ exit;
+ }
}
=item Saving original files
Any files from illumos sources, changed by this helper,
-are saved with F<.orig> suffix, so you can investigate changes.
-For example, you can use C<diff -dub usr/src/Makefile.master.orig usr/src/Makefile.master>
+are saved with F<.orig> suffix, so you can investigate changes. For example,
+you can use C<diff -dub usr/src/Makefile.master.orig usr/src/Makefile.master>
to see all changes.
=cut
-=item Changes to F<usr/src/Makefile.master> (if extracted):
+=item Changes to F<usr/src/Makefile.master> (if exists):
Remove option C<-s> (strip) from install command for directories and files.
This options does not make sense for directories and GNU L<install(1)> is
@@ -317,7 +350,7 @@ if ( -f $Makefile_master ) {
);
}
-=item Changes to F<usr/src/lib/Makefile.lib> (if extracted):
+=item Changes to F<usr/src/lib/Makefile.lib> (if exists):
Append C<CFLAGS> to C<BUILD.SO> command, because C<BUILD.SO>
by default uses C compiler to create shared library.
@@ -351,7 +384,7 @@ if ( -f $Makefile_lib ) {
);
}
-=item Changes to F<usr/src/cmd/Makefile.cmd> (if extracted):
+=item Changes to F<usr/src/cmd/Makefile.cmd> (if exists):
Remove trailing spaces in the line C<TEXT_DOMAIN= SUNW_OST_OSCMD >
Maybe we should patch GNU make to do it for us in SunOS mode.
@@ -457,7 +490,7 @@ else {
error("Failed to write `$env': $!");
}
-=item Create F<usr/bldenv.sh> (if not exists and F<usr/src/tools/scripts/bldenv.sh> extracted)
+=item Create F<usr/bldenv.sh> (if F<usr/src/tools/scripts/bldenv.sh> exists)
Copy F<usr/src/tools/scripts/bldenv.sh>
to F<usr/bldenv.sh>.
@@ -485,12 +518,13 @@ if ( -f $bldenv_sh_orig ) {
=head1 NOTES
-To clean package (via C<./debian/rules clean>) you should just remove F<usr/> directory:
+To clean package (via C<./debian/rules clean>) you should just remove F<usr/> directory,
+or the directory you specified by B<--destdir>:
rm -rf usr
-C<dh_illumos_gate --build> will fail if extracting files which should be extracted
+C<dh_illumos_gate --build> will fail when it's unpacking files which should be unpacked
due to option C<--build>. This is a L<tar(1)> issue (tar: ...: Not found in archive).
For example, this will fail: