Changeset 37 for trunk


Ignore:
Timestamp:
02/16/06 18:05:11 (19 years ago)
Author:
kdeugau
Message:

/trunk

Tweaked %files handling further to not choke on %config (make
conffile) and %docdir (ignored in Debian) directives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/debbuild

    r36 r37  
    456456          if (/-n/) { $pkgname = $1; } else { $pkgname = "$pkgdata{main}{name}-$1"; }
    457457        }
     458
     459        # Set this now, so it can be flipped a bit later, and used much later.
     460        #$pkgdata{$pkgname}{conffiles} = 0;
     461
    458462        while (<SPECFILE>) {
    459463          chomp;
     
    462466          next if /^\%attr/;
    463467          next if /^\%defattr/;
     468
     469          # Debian dpkg doesn't speak "%docdir".  Meh.
     470          next if /^\%docdir/;
     471
     472          # Conffiles.  Note that Debian and RH have similar, but not
     473          # *quite* identical ideas of what constitutes a conffile.  Nrgh.
     474          if (/^\%config\s+(.+)$/) {
     475            $pkgdata{$pkgname}{conffiles} = 1;  # Flag it for later
     476            my $tmp = $1;       # Now we can mangleificationate it.  And we probably need to.  :/
     477            if ($tmp !~ /\s+/) {
     478              # Simplest case, just a file.  Whew.
     479              push @{$pkgdata{$pkgname}{conflist}}, $tmp;
     480              $filelist{$pkgname} .= " $tmp";
     481            } else {
     482              # Wot?  Spaces?  That means extra %-macros.  Which, for the most part, can be ignored.
     483              ($tmp) = ($tmp =~ /.+\s([^\s]+)/);  # Strip everything before the last space
     484              $tmp = expandmacros($tmp, 'gp');  # Expand common macros
     485              push @{$pkgdata{$pkgname}{conflist}}, $tmp;
     486              $filelist{$pkgname} .= " $tmp";
     487            }
     488            next;
     489          }
    464490
    465491          # and finally we can fall through %{_<FHS>}-prefixed locations...
     
    645671    my @pkgfilelist = split ' ', $filelist{$pkg};
    646672    foreach my $pkgfile (@pkgfilelist) {
     673      $pkgfile = expandmacros($pkgfile, 'gp');
    647674      my @filepath = ($pkgfile =~ m|(.+)/([^/]+)$|);
    648675      qx { mkdir -p $buildroot/$pkg$filepath[0] }
     
    680707    print CONTROL $control;
    681708    close CONTROL;
     709
     710    # Iff there are conffiles (as specified in the %files list(s), add'em
     711    # in so dpkg-deb can tag them.
     712    if ($pkgdata{$pkg}{conffiles}) {
     713      open CONFLIST, ">$buildroot/$pkg/DEBIAN/conffiles";
     714      foreach my $conffile (@{$pkgdata{$pkg}{conflist}}) {
     715        print CONFLIST "$conffile\n";
     716      }
     717      close CONFLIST;
     718    }
    682719
    683720    # Can't see much point in scripts on subpackages... although since
Note: See TracChangeset for help on using the changeset viewer.