- Timestamp:
- 12/01/05 17:58:24 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/debbuild
r22 r23 39 39 my $cmdbuildroot; 40 40 my $tarballdir; # This should really be initialized, but the coding makes it, um, ugly. 41 my %specglobals; # For %define's in specfile, among other things. 41 42 42 43 # Initialized globals … … 93 94 # 10/31/2005 Maybe this should be flatter? -kgd 94 95 my %pkgdata; 96 # Files listing. Embedding this in %pkgdata would be, um, messy. 97 my %filelist; 95 98 96 99 # Scriptlets 97 100 my $prepscript; 98 101 my $buildscript; 99 my $installscript; 102 # %install doesn't need the full treatment from %clean; just an empty place to install to. 103 # NB - rpm doesn't do this; is it really necessary? 104 my $installscript = '[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT'."\n"; 100 105 my $cleanscript; 101 106 # pre/post (un)install scripts. Note that these will likely barf as-is. :/ … … 302 307 if (/^\%/) { 303 308 # A macro that needs further processing. 309 310 if (/^\%define\s+([^\s]+)\s+([^\s]+)/) { 311 $specglobals{$1} = expandmacros($2,'g'); 312 } 304 313 305 314 if (/^\%description/) { … … 384 393 $cleanscript .= $_; 385 394 } 395 print "before:\n$cleanscript\n"; 386 396 $cleanscript = expandmacros($cleanscript,'gp'); 397 print "\nafter:\n$cleanscript\n"; 398 exit 0; 387 399 } 388 400 # pre/post (un)install scripts … … 411 423 } 412 424 } 413 if (/^\%files/) { 425 if (/^\%files(?:\s+(?:-n\s+)?([a-zA-z0-9]+))?/) { 426 my $pkgname = 'main'; 427 if ($1) { 428 if (/-n/) { $pkgname = $1; } else { $pkgname = "$name-$1"; } 429 # subpackage not based on "main" package 430 while (<SPECFILE>) { 431 # need to update this to deal with %dir, %attr, etc 432 redo LINE if /^\%/; 433 $filelist{$pkgname} .= $_; 434 } 435 } 436 # do we replace \n's with \s in $filelist{$pkgname}? 414 437 # Danger! Danger! 415 438 } … … 482 505 $prepscript = expandmacros($prepscript,'gp'); 483 506 507 print $prepscript; exit 0; 508 484 509 # create script filename 485 510 my $prepscriptfile = "$tmpdir/deb-tmp.prep.".int(rand(99998)+1); … … 535 560 or die $!; 536 561 print INSTSCRIPT $scriptletbase; 537 print INSTSCRIPT $cleanscript; # Clean up our install target before installing into it.562 # print INSTSCRIPT $cleanscript; # Clean up our install target before installing into it. 538 563 print INSTSCRIPT $installscript; 539 564 close INSTSCRIPT; … … 750 775 $macrostring =~ s|%{_tmppath}|$tmpdir|g; 751 776 $macrostring =~ s'%{_docdir}'/usr/share/doc'g; 777 778 # %define's 779 foreach my $key (keys %specglobals) { 780 $macrostring =~ s|%{$key}|$specglobals{$key}|g; 781 } 782 783 # system programs. RPM uses a global config file for these; we'll just 784 # ASS-U-ME and make life a little simpler. 785 if ($macrostring =~ /\%\{\_\_([a-z0-9_-]+)\}/) { 786 $macrostring =~ s|%{__([a-z0-9_-]+)}|$1|g; 787 } 752 788 } # done with globals section 753 789
Note:
See TracChangeset
for help on using the changeset viewer.