Changeset 188 for trunk


Ignore:
Timestamp:
07/11/15 22:31:45 (9 years ago)
Author:
kdeugau
Message:

/trunk

Fine-tune handling of %setup -c, -a, and -b to correctly handle a missed
edge case, as per a report from Andreas Scherer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r187 r188  
    695695    if (/^\%build/) {
    696696      $stage = 'build';
    697       $buildscript .= "cd $tarballdir\n" if $pkgdata{main}{hassetup};
     697      $buildscript .= "cd '$tarballdir'\n" if $pkgdata{main}{hassetup};
    698698      next LINE;
    699699    } # %build
     
    701701    if (/^\%install/) {
    702702      $stage = 'install';
    703       $installscript .= "cd $tarballdir\n" if $pkgdata{main}{hassetup};
     703      $installscript .= "cd '$tarballdir'\n" if $pkgdata{main}{hassetup};
    704704      next LINE;
    705705    } # %install
     
    707707    if (/^\%clean/) {
    708708      $stage = 'clean';
    709       $cleanscript .= "cd $tarballdir\n" if $pkgdata{main}{hassetup};
     709      $cleanscript .= "cd '$tarballdir'\n" if $pkgdata{main}{hassetup};
    710710      next LINE;
    711711    } # %clean
     
    787787        my $altsource = 0;
    788788
     789        # yes, really.  It's not clear how this cascades down to %build or %install, but evidence suggests ?
     790        my $thistarballdir = $tarballdir;
     791
    789792        my @sbits = split /\s+/;
    790793        shift @sbits;
    791794        while (my $sopt = shift @sbits) {
    792795          if ($sopt eq '-n') {
    793             $tarballdir = shift @sbits;
     796            $thistarballdir = shift @sbits;
    794797          } elsif ($sopt eq '-a') {
    795798            # shift, next opt must be numeric (which sourcenn:)
     
    830833        $prepscript .= "cd '$topdir/BUILD'\n";
    831834        $tarballdir = expandmacros($tarballdir,'gp');
    832         $prepscript .= "rm -rf '$tarballdir'\n" if $deldir;
    833         $prepscript .= "/bin/mkdir -p $tarballdir\n" if $changedir;
     835        $prepscript .= "rm -rf '$thistarballdir'\n" if $deldir;
     836        $prepscript .= "/bin/mkdir -p $thistarballdir\n" if $changedir;
    834837
    835838        if ($deftarball) {
     839          $prepscript .= "cd '$thistarballdir'\n" if $changedir;
    836840          $prepscript .=
    837841                ( $pkgdata{main}{source} =~ /\.tar\.gz$/  ? "/bin/gzip"   : "" ).
     
    845849        if ($altsource) {
    846850          if ($altsource == 1) { # -a
    847             $prepscript .= "cd '$tarballdir'\n";
     851            $prepscript .= "cd '$thistarballdir'\n";
    848852            $prepscript .=
    849853                ( $pkgdata{sources}{$snum} =~ /\.tar\.gz$/  ? "/bin/gzip"   : "" ).
     
    863867                ( $quietunpack ? '' : 'vv' )."f -\n".
    864868                qq(STATUS=\$?\nif [ \$STATUS -ne 0 ]; then\n  exit \$STATUS\nfi\n);
    865             $prepscript .= "cd '$tarballdir'\n";
     869            $prepscript .= "cd '$thistarballdir'\n";
    866870          } # $altsource == 2
    867         } else {
    868           $prepscript .= "cd '$tarballdir'\n" unless $changedir;
    869871        }
    870872
     
    21052107debbuild.  However, rpmbuild doesn't create these directories either.
    21062108
     2109debbuild's %setup -q is arguably less buggy than rpmbuild's implementation;  with rpmbuild
     2110it must appear before -a or -b at least to be effective.  debbuild does not care.
     2111
     2112%setup -c, -a, and -b should arguably throw errors if specified together;  otherwise the
     2113results are almost certainly not what you want to happen.
     2114
    21072115=head1 SEE ALSO
    21082116
Note: See TracChangeset for help on using the changeset viewer.