Changeset 174 for trunk


Ignore:
Timestamp:
10/16/12 16:53:33 (12 years ago)
Author:
kdeugau
Message:

/trunk

Teach debbuild about xz compression for %source and %patch

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Makefile

    r173 r174  
    66
    77PKGNAME=debbuild
    8 VERSION=0.9.7
     8VERSION=0.9.8
    99
    1010MANDIR=/usr/share/man
  • trunk/debbuild

    r172 r174  
    268268  $specfile = "$topdir/BUILD/". qx { zcat $tarball |tar -t |grep -e '[\.]spec\$' };
    269269  chomp $specfile;
    270   my ($fileonly, $dirname) = ($tarball =~ /(([a-zA-Z0-9._-]+)\.tar\.(?:gz|bz2))$/);
     270  my ($fileonly, $dirname) = ($tarball =~ /(([a-zA-Z0-9._-]+)\.tar\.(?:gz|bz2|xz))$/);
    271271
    272272  $tarball = abs_path($tarball);
    273   my $unpackcmd = "cd $topdir/BUILD; tar -".
    274         ( $tarball =~ /\.tar\.gz$/ ? "z" : "" ).
    275         ( $tarball =~ /\.tar\.bz2$/ ? "j" : "" ). "xf $tarball";
     273##fixme:  use macro expansions for the executables
     274  my $unpackcmd = "cd $topdir/BUILD; ".
     275        ( $tarball =~ /\.tar\.gz$/       ? "/bin/gzip"   : "" ).
     276        ( $tarball =~ /\.tar\.bz2$/      ? "/bin/bzip2"  : "" ).
     277        ( $tarball =~ /\.tar\.(?:gz|Z)$/ ? "/usr/bin/xz" : "" ).
     278        " -dc $tarball |/bin/tar -xf -";
     279
    276280  system "$unpackcmd";
    277281  system "cp $tarball $topdir/SOURCES/$fileonly";
     
    765769          $prepscript .= "mkdir $tarballdir\ncd $tarballdir\n";
    766770        }
    767         $prepscript .= "tar -".
    768                 ( $pkgdata{main}{source} =~ /\.tar\.gz$/ ? "z" : "" ).
    769                 ( $pkgdata{main}{source} =~ /\.tar\.bz2$/ ? "j" : "" ).
    770                 ( /\s+-q\s+/ ? '' : 'vv' )."xf ".
    771                 "$topdir/SOURCES/$pkgdata{main}{source}\n".
     771        $prepscript .=
     772                ( $pkgdata{main}{source} =~ /\.tar\.gz$/  ? "/bin/gzip"   : "" ).
     773                ( $pkgdata{main}{source} =~ /\.tar\.bz2$/ ? "/bin/bzip2"  : "" ).
     774                ( $pkgdata{main}{source} =~ /\.tar\.xz$/  ? "/usr/bin/xz" : "" ).
     775                " -dc $topdir/SOURCES/$pkgdata{main}{source} | /bin/tar -".
     776                ( /\s+-q\s+/ ? '' : 'vv' )."xf -\n".
    772777                qq(STATUS=\$?\nif [ \$STATUS -ne 0 ]; then\n  exit \$STATUS\nfi\n).
    773778                "cd $topdir/BUILD/$tarballdir\n".
     
    784789        # would ever have such things, but there they are...  and rpmbuild supports 'em
    785790        # patch originally suggested by Lucian Cristian for .bz2
    786         # reworked and expanded to support .Z/.gz as well
    787         if ( $pkgdata{main}{"patch$patchnum"} =~ /\.(?:Z|gz|bz2)$/ ) {
     791        # reworked and expanded to support .Z/.gz/.xz as well
     792        if ( $pkgdata{main}{"patch$patchnum"} =~ /\.(?:Z|gz|bz2|xz)$/ ) {
    788793          my $decompressor;
    789           $decompressor = 'gzip' if $pkgdata{main}{"patch$patchnum"} =~ /\.(?:Z|gz)$/;
     794          $decompressor = 'gzip'  if $pkgdata{main}{"patch$patchnum"} =~ /\.(?:Z|gz)$/;
    790795          $decompressor = 'bzip2' if $pkgdata{main}{"patch$patchnum"} =~ /\.bz2$/;
     796          $decompressor = 'xz'    if $pkgdata{main}{"patch$patchnum"} =~ /\.xz$/;
    791797          $prepscript .= qq(/bin/$decompressor -d < $topdir/SOURCES/$pkgdata{main}{"patch$patchnum"} | patch );
    792798          $prepscript .= $patchopts if $patchopts;
     
    955961        # Do this here since we don't use any URL forms elsewhere (maybe some other time)
    956962        $pkgdata{main}{source} =~ s|^.+/([^/]+)$|$1|;
    957         # .tar, .tar.gz, .tar.bz2, .tgz
    958         die "Unknown tarball format $1\n" if $1 !~ /\.(?:tar(?:\.(?:gz|bz2))?|tgz)$/;
     963        # .tar, .tar.gz, .tar.bz2, .tgz, .xz
     964        die "Unknown tarball format $1\n" if $1 !~ /\.(?:tar(?:\.(?:gz|bz2|xz))?|tgz)$/;
    959965      } elsif (my ($srcnum, $src) = (/^source([0-9]+):\s*(.+)/i)) {
    960966        $pkgdata{sources}{$srcnum} = $src;
     
    18361842 debbuild {-ba|-bb|-bp|-bc|-bi|-bl|-bs} [build-options] file.spec
    18371843
    1838  debbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts} [build-options] file.tar.{gz|bz2}
     1844 debbuild {-ta|-tb|-tp|-tc|-ti|-tl|-ts} [build-options] file.tar.{gz|bz2|xz}
    18391845
    18401846 debbuild --rebuild file.{src.rpm|sdeb}
Note: See TracChangeset for help on using the changeset viewer.