diff options
author | Guillaume Rousse <guillomovitch@mandriva.org> | 2007-09-04 21:44:29 +0000 |
---|---|---|
committer | Guillaume Rousse <guillomovitch@mandriva.org> | 2007-09-04 21:44:29 +0000 |
commit | 2441c252ec10ce43f3c7b1dd6099722517e447e2 (patch) | |
tree | dbb810b1402189e7c4598062a72012544b9f7480 | |
parent | e9c6b77b9255aa3f9787e47916e203e5412f0f0d (diff) | |
download | spec-helper-0.27.1.tar spec-helper-0.27.1.tar.gz spec-helper-0.27.1.tar.bz2 spec-helper-0.27.1.tar.xz spec-helper-0.27.1.zip |
pass compression format as an argument to compress_file, and bump releasev0.27.1
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | NEWS | 8 | ||||
-rwxr-xr-x | compress_files | 34 | ||||
-rw-r--r-- | spec-helper.macros.in | 4 |
4 files changed, 33 insertions, 15 deletions
@@ -1,5 +1,5 @@ PACKAGE = spec-helper -VERSION = 0.27 +VERSION = 0.27.1 SVNPATH = svn+ssh://svn.mandriva.com/svn/soft/rpm/$(PACKAGE) SCRIPT_FILES = clean_files clean_perl compress_files strip_files \ @@ -1,5 +1,9 @@ -2007-07-12 Olivier Thauvin <nanardon@mandriva.org> - * use lzma by default for man and info pages +2007-08-04 Guillaume Rousse <guillomovitch@mandriva.org> 0.27.1 + * pass compression format as argument to compress_files + (make spec-helper backportable again) + +2007-07-12 Olivier Thauvin <nanardon@mandriva.org> 0.27 + * use lzma by default for man and info pages 2007-06-30 Guillaume Rousse <guillomovitch@mandriva.org> 0.26.1 * rename ChangeLog to NEWS diff --git a/compress_files b/compress_files index b9e15aa..bc2d7d2 100755 --- a/compress_files +++ b/compress_files @@ -97,6 +97,9 @@ sub find_so_man() { } ################################################################################ +my $ext = $ARGV[0] ||= '.gz'; +die "Unknown extension $ext" unless $ext =~ /^\.(?:gz|bz2|lzma)$/; + my $RPM_BUILD_ROOT = $ENV{RPM_BUILD_ROOT}; chdir($RPM_BUILD_ROOT) or die "Can't cd to $ENV{RPM_BUILD_ROOT}: $!"; @@ -113,10 +116,18 @@ foreach my $sofile (@sofiles) { my @files = split(/\n/, `find usr/info usr/share/info usr/man usr/share/man usr/X11*/man usr/lib/perl5/man -type f ! -name "*.gz" -a ! -name "*.bz2" -a ! -name "*.lzma" ! -name 'dir' ! -name 'whatis' 2>/dev/null || true`); -my @gz_files = split(/\n/, `find usr/info usr/share/info usr/man usr/share/man usr/X11*/man usr/lib/perl5/man -type f -name "*.gz" 2>/dev/null || true`); -if (@gz_files) { xargs(\@gz_files, "gzip", "-d"); $? ? die "Something wrong with the decompression of the gzip man/info file, fix this ASAP" : exec($0) } -my @bz_files = split(/\n/, `find usr/info usr/share/info usr/man usr/share/man usr/X11*/man usr/lib/perl5/man -type f -name "*.bz2" 2>/dev/null || true`); -if (@bz_files) { xargs(\@bz_files, "bzip2", "-d"); $? ? die "Something wrong with the decompression of the gzip man/info file, fix this ASAP" : exec($0) } +if ($ext ne '.gz') { + my @gz_files = split(/\n/, `find usr/info usr/share/info usr/man usr/share/man usr/X11*/man usr/lib/perl5/man -type f -name "*.gz" 2>/dev/null || true`); + if (@gz_files) { xargs(\@gz_files, "gzip", "-d"); $? ? die "Something wrong with the decompression of the gzip man/info file, fix this ASAP" : exec($0) } +} +if ($ext ne '.bz2') { + my @bz_files = split(/\n/, `find usr/info usr/share/info usr/man usr/share/man usr/X11*/man usr/lib/perl5/man -type f -name "*.bz2" 2>/dev/null || true`); + if (@bz_files) { xargs(\@bz_files, "bzip2", "-d"); $? ? die "Something wrong with the decompression of the bzip2 man/info file, fix this ASAP" : exec($0) } +} +if ($ext ne '.lzma') { + my @lzma_files = split(/\n/, `find usr/info usr/share/info usr/man usr/share/man usr/X11*/man usr/lib/perl5/man -type f -name "*.lzma" 2>/dev/null || true`); + if (@lzma_files) { xargs(\@lzma_files, "lzmash", "-d"); $? ? die "Something wrong with the decompression of the lzma man/info file, fix this ASAP" : exec($0) } +} # Exclude files from compression. if (@files && defined($ENV{EXCLUDE_FROM_COMPRESS})) { @@ -160,7 +171,12 @@ if (@f) { # Make executables not be anymore. xargs(\@f, "chmod", "a-x"); - xargs(\@f, "lzma", "-9f", "--text"); + my @command = $ext eq '.gz' ? qw/gzip -9f/ + : $ext eq '.bz2' ? qw/bzip2 -9f/ + : $ext eq '.lzma' ? qw/lzma -9f --text/ + : qw// + ; + xargs(\@f, @command); } @@ -170,7 +186,7 @@ foreach (keys %hardlinks) { # Remove old file. system("rm", "-f", $_); # Make new hardlink. - system("ln", "$hardlinks{$_}.lzma", "$_.lzma"); + system("ln", "$hardlinks{$_}$ext", "$_$ext"); } # Fix up symlinks that were pointing to the uncompressed files. @@ -181,10 +197,10 @@ while (<$FIND>) { chomp; my ($directory) = m!(.*)/!; my $linkval = readlink($_); - if (! -e "$directory/$linkval" && -e "$directory/$linkval.lzma") { + if (! -e "$directory/$linkval" && -e "$directory/$linkval$ext") { system("rm", "-f", $_); - system("ln", "-sf", "$linkval.lzma", "$_.lzma"); - } elsif (! -e "$directory/$linkval" && ! -e "$directory/$linkval.lzma" && $directory =~ m|man/|) { + system("ln", "-sf", "$linkval$ext", "$_$ext"); + } elsif (! -e "$directory/$linkval" && ! -e "$directory/$linkval$ext" && $directory =~ m|man/|) { #Bad link go on nowhere (any better idea) ? unlink($_); } diff --git a/spec-helper.macros.in b/spec-helper.macros.in index 1962448..3182852 100644 --- a/spec-helper.macros.in +++ b/spec-helper.macros.in @@ -1,12 +1,10 @@ # $Id$ -%_extension .lzma - %_spec_helper_dir @pkgdatadir@ %__spec_helper_post \ %{?!dont_clean_files: [ -n "$DONT_CLEANUP" ] || %_spec_helper_dir/clean_files} \ - %{?!dont_compress: [ -n "$DONT_COMPRESS" ] || %_spec_helper_dir/compress_files} \ + %{?!dont_compress: [ -n "$DONT_COMPRESS" ] || %_spec_helper_dir/compress_files %{?_extension}%{?!_extension:.gz}} \ %{?!dont_strip: [ -n "$DONT_STRIP" ] || %_spec_helper_dir/strip_files} \ %{?!dont_relink: [ -n "$DONT_RELINK" ] || %_spec_helper_dir/relink_symlinks} \ %{?!dont_cleanup_perl: [ -n "$DONT_CLEAN_PERL" ] || %_spec_helper_dir/clean_perl} \ |