--- loncom/build/make_rpm.pl 2000/10/02 14:07:53 1.1 +++ loncom/build/make_rpm.pl 2000/12/21 19:26:01 1.6 @@ -7,11 +7,9 @@ # GNU General Public License, Version 2, June 1991 # See http://www.gnu.org/copyleft/gpl.html. -# This file currently does not actually "build" the RPM. -# This has to be done with an RPM build environment and -# commands like 'rpm -ba'. +# This script does actually "build" the RPM. -# What this file DOES do is generate all the needed +# This script also generates and then deletes temporary # files (and binary root directory tree) to build an RPM with. # I still need to implement the CONFIGURATION_FILES and @@ -20,11 +18,13 @@ # Take in a file list (from standard input), # a description tag and version tag from command line argument -# and generate a: +# and temporarily generate a: # RPM .spec file # RPM Makefile # SourceRoot +# A resulting .rpm file is generated. + unless (-e "/usr/lib/rpm/rpmrc") { print < [CONFIGURATION_FILES] [DOCUMENTATION] [PATHPREFIX]\n"; print "Standard input provides the list of files to work with.\n"; @@ -143,6 +144,15 @@ END foreach $file (<>) { chop $file; + my $comment=""; + if ($file=~/\s+\#(.*)$/) { + $file=~s/\s+\#(.*)$//; + $comment=$1; + } + my $config=""; + if ($comment=~/config/i) { + $config="\%config "; + } if (($type,$size,$octalmode,$user,$group)=find_info($file)) { $octalmode="0" . $octalmode if length($octalmode)<4; if ($pathprefix) { @@ -151,7 +161,7 @@ foreach $file (<>) { if ($type eq "files") { push @{$BinaryRootMakefile{$type}},"\tinstall -D -m $octalmode $pathprefix$file $binaryroot$file\n"; push @{$Makefile{$type}},"\tinstall -D -m $octalmode \$(SOURCE)$file \$(ROOT)$file\n"; - push @{$dotspecfile{$type}},"\%attr($octalmode,$user,$group) $file\n"; + push @{$dotspecfile{$type}},"$config\%attr($octalmode,$user,$group) $file\n"; } elsif ($type eq "directories") { push @{$BinaryRootMakefile{$type}},"\tinstall -m $octalmode -d $binaryroot$file\n"; @@ -206,7 +216,7 @@ sub find_info { return ("directories",split(/\t/,$line)); } elsif (($line=`find $file -type l -prune`)=~/^$file\n/) { - $line=`find $file -type l -prune -printf "\%h/\%l\t\%m\t\%u\t\%g"`; + $line=`find $file -type l -prune -printf "\%l\t\%m\t\%u\t\%g"`; return ("links",split(/\t/,$line)); }