Changeset 110 for trunk


Ignore:
Timestamp:
07/05/07 12:49:06 (17 years ago)
Author:
kdeugau
Message:

/trunk

Enhance %files processing: %doc support (mostly)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r109 r110  
    151151# Files listing.  Embedding this in %pkgdata would be, um, messy.
    152152my %filelist;
     153my %doclist;
    153154my $buildreq = '';
    154155
     
    742743        next LINE;
    743744      }
    744       # %doc needs extra processing, because it can be a space-separated list.
     745      # %doc needs extra processing, because it can be a space-separated list, and may
     746      # include both full and partial pathnames.  The partial pathnames must be fiddled
     747      # into place in the %install script, because Debian doesn't really have the concept
     748      # of "documentation file" that rpm does.  (Debian "documentation files" are files
     749      # in /usr/share/doc/<packagename>.)
    745750      if (/^\%doc/) {
    746751        s/^\%doc\s+//;
    747752        foreach (split()) {
    748           $filelist{$subname} .= " %{_docdir}/$_";
     753          if (m|^/|) {
     754            $filelist{$subname} .= " $_";       # and we process this in the processing of the install script
     755          } else {
     756            my $pkgname = $pkgdata{$subname}{name};
     757            $pkgname =~ tr/_/-/;
     758
     759            $doclist{$subname} .= " $_";
     760            s|^[^/]+/||g;       # Gotta strip leading blah/ bits.  Won't handle * (well) yet...  (glob()?)
     761            $filelist{$subname} .= " \%{_docdir}/$pkgname/$_";
     762          }
    749763        }
    750764        next LINE;
     
    894908# Writes and executes the %install script (mostly) built while reading the spec file.
    895909sub install {
     910
     911  # munge %doc entries into place
     912  # rpm handles this with a separate executed %doc script, we're not going to bother.
     913  foreach my $docpkg (keys %doclist) {
     914    my $pkgname = $pkgdata{$docpkg}{name};
     915    $pkgname =~ s/_/-/g;
     916
     917    $installscript .= "DOCDIR=\$RPM_BUILD_ROOT\%{_docdir}/$pkgname\nexport DOCDIR\n";
     918    $installscript .= "mkdir -p \$DOCDIR\n";
     919    $doclist{$docpkg} =~ s/^\s*//;
     920    foreach (split(' ',$doclist{$docpkg})) {
     921      $installscript .= "cp -pr $_ \$DOCDIR/\n";
     922    }
     923  }
     924
    896925  # Expand the macros
    897926  $installscript = expandmacros($installscript,'igbp');
Note: See TracChangeset for help on using the changeset viewer.