Changeset 155


Ignore:
Timestamp:
06/16/10 17:18:04 (14 years ago)
Author:
kdeugau
Message:

/trunk

Add support for compressed patches.
Patch provided by Lucian Cristian for .bz2 almost two years ago (!!);

reworked to support .Z and .gz too

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r154 r155  
    726726      } elsif ( my ($patchnum,$patchopts) = (/^\%patch([^\s]+)(\s+.+)?$/) ) {
    727727        chomp $patchnum;
    728         $prepscript .= qq(echo "Patch #$patchnum ($pkgdata{main}{"patch$patchnum"}):"\n).
    729                 "patch ";
    730         # If there are options passed, use'em.
    731         # Otherwise, catch a bare %patch and ASS-U-ME it's '-p0'-able.
    732         # Will break on options that don't provide -pnn, but what the hell.
    733         $prepscript .= $patchopts if $patchopts;
    734         $prepscript .= "-p0" if !$patchopts;
    735         $prepscript .= " -s <$topdir/SOURCES/".$pkgdata{main}{"patch$patchnum"}."\n";
     728        $prepscript .= qq(echo "Patch #$patchnum ($pkgdata{main}{"patch$patchnum"}):"\n);
     729        # If there are options passed, use'em.
     730        # Otherwise, catch a bare %patch and ASS-U-ME it's '-p0'-able.
     731        # Will break on options that don't provide -pnn, but what the hell.
     732        # Need to decompress .bz2 and .gz patches on the fly.  Not sure why one
     733        # would ever have such things, but there they are...  and rpmbuild supports 'em
     734        # patch originally suggested by Lucian Cristian for .bz2
     735        # reworked and expanded to support .Z/.gz as well
     736        if ( $pkgdata{main}{"patch$patchnum"} =~ /\.(?:Z|gz|bz2)$/ ) {
     737          my $decompressor;
     738          $decompressor = 'gzip' if $pkgdata{main}{"patch$patchnum"} =~ /\.(?:Z|gz)$/;
     739          $decompressor = 'bzip2' if $pkgdata{main}{"patch$patchnum"} =~ /\.bz2$/;
     740          $prepscript .= qq(/bin/$decompressor -d < $topdir/SOURCES/$pkgdata{main}{"patch$patchnum"} | patch );
     741          $prepscript .= $patchopts if $patchopts;
     742          $prepscript .= "-p0" if !$patchopts;
     743          $prepscript .= qq( -s\nSTATUS=\$?\nif [ \$STATUS -ne 0 ]; then\n  exit \$STATUS\nfi\n);
     744        } else {
     745          $prepscript .= "patch ";
     746          $prepscript .= $patchopts if $patchopts;
     747          $prepscript .= "-p0" if !$patchopts;
     748          $prepscript .= " -s <$topdir/SOURCES/".$pkgdata{main}{"patch$patchnum"}."\n";
     749        }
    736750      } else {
    737751        $prepscript .= expandmacros($_,'gp');
Note: See TracChangeset for help on using the changeset viewer.