From 53166be8a55759be4fb1e88ef241000c3cf0b072 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Wed, 7 Oct 2015 17:35:04 +0300 Subject: perltidy --- dh_illumos_gate | 149 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 81 insertions(+), 68 deletions(-) diff --git a/dh_illumos_gate b/dh_illumos_gate index 76ee1b1..d9c1328 100755 --- a/dh_illumos_gate +++ b/dh_illumos_gate @@ -109,31 +109,31 @@ Here are things which this helper does after unpacking illumos sources. =cut -init(options => { - "build|B" => \$dh{BUILD}, - }); +init( options => { "build|B" => \$dh{BUILD}, } ); -my %options = (file => 'debian/changelog'); +my %options = ( file => 'debian/changelog' ); my $changelog = changelog_parse(%options); -my $version = $changelog->{'Version'}; +my $version = $changelog->{'Version'}; my $VER; -if ($version =~ /^(\d+(\.\d+)+(\.git\w+)?).*$/) { +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'"); +} +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"); +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'}}) { +if ( defined( $dh{'EXCLUDE'} ) && $dh{'EXCLUDE'} ) { + foreach my $x ( @{ $dh{'EXCLUDE'} } ) { push @tar_X, '--exclude'; push @tar_X, $x; } @@ -141,34 +141,37 @@ if (defined($dh{'EXCLUDE'}) && $dh{'EXCLUDE'}) { my @to_extract = (); if (@ARGV) { - if ($dh{'BUILD'}) { - push @to_extract, ( - 'usr/src/Makefile*', - 'usr/src/common/mapfiles', + 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/lib/.*| } @ARGV ) { + push @to_extract, 'usr/src/lib/Makefile*'; } - if (grep {m|.*usr/src/cmd/.*|} @ARGV) { - push @to_extract, 'usr/src/cmd/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, 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 + if ( $p =~ /^-/ ) { + push @to_extract_real, $p; #XXX: tar option + } + else { + push @to_extract_real, 'illumos-gate/' . $p; #XXX: path } } -doit('tar', '-x', '-f', $tarball, @tar_X, '--wildcards', '--strip-components=1', @to_extract_real); +doit( 'tar', '-x', '-f', $tarball, @tar_X, '--wildcards', + '--strip-components=1', @to_extract_real ); =item Saving original files @@ -213,34 +216,37 @@ my $bits = `dpkg-architecture -qDEB_HOST_ARCH_BITS`; chomp $bits; # In illumos source 32-bit binaries are default -my ($libdir32, $libdir64, $usrlibdir32, $usrlibdir64); +my ( $libdir32, $libdir64, $usrlibdir32, $usrlibdir64 ); -if ($bits == 64) { +if ( $bits == 64 ) { $libdir32 = "lib32"; $usrlibdir32 = "usr/$libdir32"; $libdir64 = "lib/$multiarch"; $usrlibdir64 = "usr/$libdir64"; -} else { +} +else { $libdir32 = "lib/$multiarch"; $usrlibdir32 = "usr/$libdir32"; $libdir64 = "lib64"; $usrlibdir64 = "usr/$libdir64"; } -my $Makefile_master = 'usr/src/Makefile.master'; +my $Makefile_master = 'usr/src/Makefile.master'; my $Makefile_master_orig = $Makefile_master . '.orig'; -if (-f $Makefile_master) { - if (! -e $Makefile_master_orig) { - doit('cp', '-f', $Makefile_master, $Makefile_master_orig); +if ( -f $Makefile_master ) { + if ( !-e $Makefile_master_orig ) { + doit( 'cp', '-f', $Makefile_master, $Makefile_master_orig ); } # Be careful with modern CPP: - my $i386_undef = '-Uamd64 -U__amd64 -U__amd64__ -U__x86_64__ -U__x86_64 -U_LP64'; - doit('sed', '-r', '-i', ' + my $i386_undef = + '-Uamd64 -U__amd64 -U__amd64__ -U__x86_64__ -U__x86_64 -U_LP64'; + doit( + 'sed', '-r', '-i', ' /^INS\.(file|dir)/ s, -s,,; /^INS\.file/ s, -f, -t,; /^i386_XARCH\s*=/s,$, -m32 ' . $i386_undef . ',; - /^i386_AS_XARCH\s*=/s,$, ' . $i386_undef . ',; + /^i386_AS_XARCH\s*=/s,$, ' . $i386_undef . ',; /^COMPILE\.s/s,$, $($(MACH)_AS_XARCH),; /^MAPFILE.LEX/d; /^OFFSETS_CREATE/ s,\$\(CTFSTABS\),ctfstabs,; @@ -249,7 +255,6 @@ if (-f $Makefile_master) { ); } - =item Changes to F (if extracted): Append C to C command, because C @@ -263,17 +268,19 @@ in some cases C will be overriden by C within makefil =cut -my $Makefile_lib = 'usr/src/lib/Makefile.lib'; +my $Makefile_lib = 'usr/src/lib/Makefile.lib'; my $Makefile_lib_orig = $Makefile_lib . '.orig'; -if (-f $Makefile_lib) { - if (! -e $Makefile_lib_orig) { - doit('cp', '-f', $Makefile_lib, $Makefile_lib_orig); +if ( -f $Makefile_lib ) { + if ( !-e $Makefile_lib_orig ) { + doit( 'cp', '-f', $Makefile_lib, $Makefile_lib_orig ); } - doit('sed', '-r', '-i', ' + doit( + 'sed', '-r', '-i', ' /^BUILD.SO/ s,\$\(CC\),$(CC) $(CFLAGS),; ', $Makefile_lib ); - doit('sed', '-r', '-i', " + doit( + 'sed', '-r', '-i', " s,^(ROOTFS_LIBDIR)\\s*=.*,\\1=\$(ROOT)/$libdir32,; s,^(ROOTFS_LIBDIR64)\\s*=.*,\\1=\$(ROOT)/$libdir64,; s,^(ROOTLIBDIR)\\s*=.*,\\1=\$(ROOT)/$usrlibdir32,; @@ -291,24 +298,24 @@ if (-f $Makefile_lib) { =cut -my $Makefile_cmd = 'usr/src/cmd/Makefile.cmd'; +my $Makefile_cmd = 'usr/src/cmd/Makefile.cmd'; my $Makefile_cmd_orig = $Makefile_cmd . '.orig'; -if (-f $Makefile_cmd) { - if (! -e $Makefile_cmd_orig) { - doit('cp', '-f', $Makefile_cmd, $Makefile_cmd_orig); +if ( -f $Makefile_cmd ) { + if ( !-e $Makefile_cmd_orig ) { + doit( 'cp', '-f', $Makefile_cmd, $Makefile_cmd_orig ); } - doit('sed', '-r', '-i', ' + doit( + 'sed', '-r', '-i', ' /^TEXT_DOMAIN/ s,\s+$,,g; ', $Makefile_cmd ); - doit('sed', '-r', '-i', ' + doit( + 'sed', '-r', '-i', ' /LDFLAGS\s*\+=\s*-Wl,-I\/lib\/ld\.so\.1/d; ', $Makefile_cmd ); } - - =item Create F (if F exists and F does not) Set C to the current directry. @@ -342,12 +349,12 @@ to make them available from makefiles. =cut - -if ( -d 'usr' && ! -f 'usr/env.sh') { - my $cwd = getcwd(); - my $env = 'usr/env.sh'; - my $mach = `uname -p`; chomp $mach; - if (open (ENV, '>', $env)) { +if ( -d 'usr' && !-f 'usr/env.sh' ) { + my $cwd = getcwd(); + my $env = 'usr/env.sh'; + my $mach = `uname -p`; + chomp $mach; + if ( open( ENV, '>', $env ) ) { print ENV "# This file was generated by dh_illumos_gate(1)\n"; print ENV "export VERSION='$version'\n"; print ENV "export CODEMGR_WS='$cwd'\n"; @@ -372,13 +379,17 @@ if ( -d 'usr' && ! -f 'usr/env.sh') { print ENV "export DEB_USRLIBDIR_32='/$usrlibdir32'\n"; print ENV "export DEB_LIBDIR_64='/$libdir64'\n"; print ENV "export DEB_USRLIBDIR_64='/$usrlibdir64'\n"; - print ENV "export LDLIBS32=\"-L\$ROOT/\$DEB_LIBDIR_32 -L\$ROOT/\$DEB_USRLIBDIR_32\"\n"; - print ENV "export LDLIBS64=\"-L\$ROOT/\$DEB_LIBDIR_64 -L\$ROOT/\$DEB_USRLIBDIR_64\"\n"; - print ENV 'export LDLIBS_NATIVE="', ($bits == 64) ? '$LDLIBS64' : '$LDLIBS32', "\"\n"; + print ENV +"export LDLIBS32=\"-L\$ROOT/\$DEB_LIBDIR_32 -L\$ROOT/\$DEB_USRLIBDIR_32\"\n"; + print ENV +"export LDLIBS64=\"-L\$ROOT/\$DEB_LIBDIR_64 -L\$ROOT/\$DEB_USRLIBDIR_64\"\n"; + print ENV 'export LDLIBS_NATIVE="', + ( $bits == 64 ) ? '$LDLIBS64' : '$LDLIBS32', "\"\n"; print ENV `dpkg-architecture -s`; close(ENV); - } else { + } + else { error("Failed to write `$env': $!"); } } @@ -396,14 +407,16 @@ with option C<--without-ctf>. =cut my $bldenv_sh = 'usr/src/tools/scripts/bldenv.sh'; -if (-f $bldenv_sh && ! -f 'usr/bldenv.sh') { - doit('cp', '-f', $bldenv_sh, 'usr/bldenv.sh'); - doit('sed', '-r', '-i', ' +if ( -f $bldenv_sh && !-f 'usr/bldenv.sh' ) { + doit( 'cp', '-f', $bldenv_sh, 'usr/bldenv.sh' ); + doit( + 'sed', '-r', '-i', ' s,export +(CTF.+)="(.+)",export \1="${\1:-\2}",; s,^PATH=".+",PATH="${PATH}:/opt/onbld/bin:/opt/onbld/bin/${MACH}:.",; ', 'usr/bldenv.sh' ); } + =back =head1 NOTES -- cgit v1.2.3