Skip to content

Commit

Permalink
make debtransform support packages with .tar.bz2 and .zip tarballs
Browse files Browse the repository at this point in the history
  • Loading branch information
Luboš Luňák authored and adrianschroeter committed Jan 11, 2011
1 parent e907216 commit 5857598
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ install:
initscript_qemu_vm \
substitutedeps \
debtransform \
debtransformbz2 \
debtransformzip \
mkbaselibs \
mkdrpms \
createrepomddeps \
Expand Down
24 changes: 23 additions & 1 deletion debtransform
Original file line number Diff line number Diff line change
Expand Up @@ -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.*?$//;
Expand All @@ -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");
Expand Down
11 changes: 11 additions & 0 deletions debtransformbz2
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions debtransformzip
Original file line number Diff line number Diff line change
@@ -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.