Mailinglist Archive: opensuse-buildservice (213 mails)

< Previous Next >
[opensuse-buildservice] debtransform patches
  • From: Lubos Lunak <l.lunak@xxxxxxx>
  • Date: Mon, 29 Jun 2009 15:16:02 +0200
  • Message-id: <200906291516.03030.l.lunak@xxxxxxx>

Hello,

I've used the debtransform functionality of the buildservice and I'll like to
propose the two attached patches:

1) Debian-based distros require the tarball to be .tar.gz , which is annoying
with cross-distro packaging. This patch adds support for using .tar.bz2
or .zip and debtransform converts the archive to .tar.gz , in addition to
renaming it as it does now. I've tested this locally with osc build and it
seems to work fine.

If this is accepted, can you give me an estimate for when it gets deployed?
It'd save me a bit of writing in a howto, but I don't insist :).

2) Applying patches using debian.series has a different default for the -p
argument of patch. While .spec defaults to -p0, debtransform defaults to -p1.
This is again annoying with cross-distro packaging. This is a
backwards-incompatible change, but I would consider this to be a bugfix and I
expect there aren't many packages that rely on the default in debtransform
now, because of it not being consistent with .spec .

--
Lubos Lunak
KDE developer
--------------------------------------------------------------
SUSE LINUX, s.r.o. e-mail: l.lunak@xxxxxxx , l.lunak@xxxxxxx
Lihovarska 1060/12 tel: +420 284 028 972
190 00 Prague 9 fax: +420 284 028 951
Czech Republic http://www.suse.cz
Index: src/build/debtransform
===================================================================
--- src/build/debtransform (revision 7628)
+++ src/build/debtransform (working copy)
@@ -214,6 +214,23 @@
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 @@
$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");
Index: src/build/debtransformzip
===================================================================
--- src/build/debtransformzip (revision 0)
+++ src/build/debtransformzip (revision 0)
@@ -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
Index: src/build/Makefile
===================================================================
--- src/build/Makefile (revision 7628)
+++ src/build/Makefile (working copy)
@@ -43,6 +43,8 @@
initscript_qemu_vm \
substitutedeps \
debtransform \
+ debtransformbz2 \
+ debtransformzip \
mkbaselibs \
createrepomddeps \
createyastdeps \
Index: src/build/debtransformbz2
===================================================================
--- src/build/debtransformbz2 (revision 0)
+++ src/build/debtransformbz2 (revision 0)
@@ -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
Index: src/build/debtransform
===================================================================
--- src/build/debtransform (revision 7628)
+++ src/build/debtransform (working copy)
@@ -121,7 +121,7 @@
for my $patch (@series) {
$patch =~ s/(^|\s+)#.*//;
next if $patch =~ /^\s*$/;
- my $level = 1;
+ my $level = 0;
$level = $1 if $patch =~ /\s.*-p\s*(\d+)/;
$patch =~ s/\s.*//;
open(F, '<', "$dir/$patch") || die("$dir/$patch: $!\n");
< Previous Next >