Permalink
Browse files

make debtransform support packages with .tar.bz2 and .zip tarballs

  • Loading branch information...
1 parent e907216 commit 585759875f7d225b6fc8f3e76cdffe955825dab4 Luboš Luňák committed with adrianschroeter Sep 15, 2010
Showing with 50 additions and 1 deletion.
  1. +2 −0 Makefile
  2. +23 −1 debtransform
  3. +11 −0 debtransformbz2
  4. +14 −0 debtransformzip
View
@@ -44,6 +44,8 @@ install:
initscript_qemu_vm \
substitutedeps \
debtransform \
+ debtransformbz2 \
+ debtransformzip \
mkbaselibs \
mkdrpms \
createrepomddeps \
View
@@ -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");
View
@@ -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
View
@@ -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

0 comments on commit 5857598

Please sign in to comment.