From 585759875f7d225b6fc8f3e76cdffe955825dab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Wed, 15 Sep 2010 16:45:57 +0200 Subject: [PATCH] make debtransform support packages with .tar.bz2 and .zip tarballs http://lists.opensuse.org/opensuse-buildservice/2009-06/msg00193.html --- Makefile | 2 ++ debtransform | 24 +++++++++++++++++++++++- debtransformbz2 | 11 +++++++++++ debtransformzip | 14 ++++++++++++++ 4 files changed, 50 insertions(+), 1 deletion(-) create mode 100755 debtransformbz2 create mode 100755 debtransformzip diff --git a/Makefile b/Makefile index e97764b70..6c05a47b0 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,8 @@ install: initscript_qemu_vm \ substitutedeps \ debtransform \ + debtransformbz2 \ + debtransformzip \ mkbaselibs \ mkdrpms \ createrepomddeps \ diff --git a/debtransform b/debtransform index 44b55b90b..8f6e862f6 100755 --- a/debtransform +++ b/debtransform @@ -214,6 +214,23 @@ my $version = $tags->{'VERSION'}; die("dsc file contains no version\n") unless defined($version); $version =~ s/^\d+://; # no epoch in version, please +# transform +my $tmptar; +if ($tarfile =~ /\.tar\.bz2/) { + my $old = $tarfile; + $tarfile =~ s/\.tar\.bz2/\.tar\.gz/; + $tmptar = "$out/$tarfile"; + print "converting $old to $tarfile\n"; + system( ( "debtransformbz2", "$old", "$tmptar" )) == 0 || die("cannot transform .tar.bz2 to .tar.gz"); +} +if ($tarfile =~ /\.zip/) { + my $old = $tarfile; + $tarfile =~ s/\.zip/\.tar\.gz/; + $tmptar = "$out/$tarfile"; + print "converting $old to $tarfile\n"; + system( ( "debtransformzip", "$old", "$tmptar" )) == 0 || die("cannot transform .zip to .tar.gz"); +} + my $tardir = $tarfile; $tardir =~ s/\.orig\.tar/\.tar/; $tardir =~ s/\.tar.*?$//; @@ -223,7 +240,12 @@ my $v = $version; $v =~ s/-[^-]*$//; $tarfile =~ /.*(\.tar.*?)$/; my $ntarfile = "${name}_$v.orig$1"; -link("$dir/$tarfile", "$out/$ntarfile") || die("link $dir/$tarfile $out/$ntarfile: $!\n"); +if( $tmptar ) { + link("$tmptar", "$out/$ntarfile") || die("link $dir/$tarfile $out/$ntarfile: $!\n"); + unlink("$tmptar"); +} else { + link("$dir/$tarfile", "$out/$ntarfile") || die("link $dir/$tarfile $out/$ntarfile: $!\n"); +} push @files, addfile("$out/$ntarfile"); open(DIFF, '>', "$out/${name}_$version.diff") || die("$out/${name}_$version.diff: $!\n"); diff --git a/debtransformbz2 b/debtransformbz2 new file mode 100755 index 000000000..01c1e9daf --- /dev/null +++ b/debtransformbz2 @@ -0,0 +1,11 @@ +#! /bin/bash + +if test $# -ne 2; then + exit 1 +fi + +bz="$1" +tar="$2" + +bzcat "$bz" | gzip -f - >"$tar" || exit 1 +exit 0 diff --git a/debtransformzip b/debtransformzip new file mode 100755 index 000000000..2054c1288 --- /dev/null +++ b/debtransformzip @@ -0,0 +1,14 @@ +#! /bin/bash + +if test $# -ne 2; then + exit 1 +fi + +zip="$1" +tar="$2" + +tmp=$(mktemp -d) +unzip -q -d "$tmp" -- "$zip" || exit 1 +( cd "$tmp" && tar czO * ) >"$tar" || exit 1 +rm -r "$tmp" +exit 0