version 1.4, 2000/12/12 16:51:39
|
version 1.12, 2002/01/05 00:48:05
|
Line 1
|
Line 1
|
#!/usr/bin/perl |
#!/usr/bin/perl |
|
|
# Scott Harrison, September 30 |
# The LearningOnline Network with CAPA |
# Automatically generate RPM listing files |
# make_rpm.pl - make RedHat package manager file |
# from file listing. |
# |
|
# $Id$ |
|
# |
|
# Written by Scott Harrison, harris41@msu.edu |
|
# |
|
# Copyright Michigan State University Board of Trustees |
|
# |
|
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
|
# |
|
# LON-CAPA is free software; you can redistribute it and/or modify |
|
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; either version 2 of the License, or |
|
# (at your option) any later version. |
|
# |
|
# LON-CAPA is distributed in the hope that it will be useful, |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
# GNU General Public License for more details. |
|
# |
|
# You should have received a copy of the GNU General Public License |
|
# along with LON-CAPA; if not, write to the Free Software |
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
# |
|
# /home/httpd/html/adm/gpl.txt |
|
# |
|
# http://www.lon-capa.org/ |
|
# |
|
# YEAR=2000 |
|
# 9/30,10/2,12/11,12/12,12/21 - Scott Harrison |
|
# YEAR=2001 |
|
# 1/8,1/10,1/13,1/23,5/16 - Scott Harrison |
|
# YEAR=2002 |
|
# 1/4 - Scott Harrison |
|
# |
|
### |
|
|
# GNU General Public License, Version 2, June 1991 |
# Automatically generate RPM files |
# See http://www.gnu.org/copyleft/gpl.html. |
# from file listing. |
|
|
# This script does actually "build" the RPM. |
# This script does actually "build" the RPM. |
|
|
Line 27
|
Line 61
|
|
|
unless (-e "/usr/lib/rpm/rpmrc") { |
unless (-e "/usr/lib/rpm/rpmrc") { |
print <<END; |
print <<END; |
ERROR: This script only works with a properly installed RPM builder application. |
ERROR: This script only works with a properly installed RPM builder |
|
application. |
Cannot find /usr/lib/rpm/rpmrc, so cannot generate customized rpmrc file. |
Cannot find /usr/lib/rpm/rpmrc, so cannot generate customized rpmrc file. |
Script aborting. |
Script aborting. |
END |
END |
Line 37 my ($tag,$version,$configuration_files,$
|
Line 72 my ($tag,$version,$configuration_files,$
|
@ARGV=(); |
@ARGV=(); |
|
|
if (!$version) { |
if (!$version) { |
print "Usage: <TAG> <VERSION> [CONFIGURATION_FILES] [DOCUMENTATION] [PATHPREFIX]\n"; |
print "Usage: <TAG> <VERSION> [CONFIGURATION_FILES] [DOCUMENTATION] ". |
|
"[PATHPREFIX]\n"; |
print "Standard input provides the list of files to work with.\n"; |
print "Standard input provides the list of files to work with.\n"; |
print "TAG, required descriptive tag. For example, a kerberos software package might be tagged as \"krb4\".\n"; |
print "TAG, required descriptive tag. For example, a kerberos software ". |
print "VERSION, required version. Needed to generate version information for the RPM. This should be in the format N.M where N and M are integers.\n"; |
"package might be tagged as \"krb4\".\n"; |
print "CONFIGURATION_FILES, optional comma-separated listing of files to be treated as configuration files by RPM (and thus subject to saving during RPM upgrades).\n"; |
print "VERSION, required version. Needed to generate version information". |
print "DOCUMENTATION, optional comma-separated listing of files to be treated as documentation files by RPM (and thus subject to being placed in the /usr/doc/RPM-NAME directory during RPM installation).\n"; |
" for the RPM. This should be in the format N.M where N and M are ". |
print "PATHPREFIX, optional path to be removed from file listing. This is in case you are building an RPM from files elsewhere than root-level. Note, this still depends on a root directory hierarchy after PATHPREFIX.\n"; |
"integers.\n"; |
|
print "CONFIGURATION_FILES, optional comma-separated listing of files to ". |
|
"be treated as configuration files by RPM (and thus subject to saving". |
|
" during RPM upgrades).\n"; |
|
print "DOCUMENTATION, optional comma-separated listing of files to be ". |
|
"treated as documentation files by RPM (and thus subject to being ". |
|
"placed in the /usr/doc/RPM-NAME directory during RPM installation).". |
|
"\n"; |
|
print "PATHPREFIX, optional path to be removed from file listing. This ". |
|
"is in case you are building an RPM from files elsewhere than ". |
|
"root-level. Note, this still depends on a root directory hierarchy ". |
|
"after PATHPREFIX.\n"; |
exit; |
exit; |
} |
} |
|
|
Line 61 my $file;
|
Line 108 my $file;
|
my $binaryroot="$tag/BinaryRoot"; |
my $binaryroot="$tag/BinaryRoot"; |
my ($type,$size,$octalmode,$user,$group); |
my ($type,$size,$octalmode,$user,$group); |
|
|
$currentdir=`pwd`; chop $currentdir; $invokingdir=$currentdir; $currentdir.="/$tag"; |
$currentdir=`pwd`; chop $currentdir; $invokingdir=$currentdir; |
|
$currentdir.="/$tag"; |
|
|
open (IN,"</usr/lib/rpm/rpmrc") or die("Can't open /usr/lib/rpm/rpmrc"); |
open (IN,"</usr/lib/rpm/rpmrc") or die("Can't open /usr/lib/rpm/rpmrc"); |
@lines=<IN>; |
@lines=<IN>; |
Line 71 open (RPMRC,">$tag/SPECS/rpmrc");
|
Line 119 open (RPMRC,">$tag/SPECS/rpmrc");
|
foreach $line (@lines) { |
foreach $line (@lines) { |
if ($line=~/^macrofiles/) { |
if ($line=~/^macrofiles/) { |
chop $line; |
chop $line; |
$line.=":./rpmmacros\n"; |
$line.=":$currentdir/SPECS/rpmmacros\n"; |
} |
} |
print RPMRC $line; |
print RPMRC $line; |
} |
} |
Line 87 print RPMMACROS <<END;
|
Line 135 print RPMMACROS <<END;
|
END |
END |
close RPMMACROS; |
close RPMMACROS; |
|
|
|
# This needs to be dynamically based upon doc/otherfiles/rpm_list.txt |
|
# at some point. |
|
my $requires=""; |
|
if ($tag eq "setup") { |
|
$requires=<<END; |
|
PreReq: setup |
|
PreReq: passwd |
|
PreReq: util-linux |
|
END |
|
} |
|
elsif ($tag eq "base") { |
|
$requires=<<END; |
|
PreReq: LON-CAPA-setup |
|
PreReq: apache |
|
PreReq: /etc/httpd/conf/access.conf |
|
END |
|
$requires2=<<END; |
|
Requires: LON-CAPA-setup |
|
Requires: raidtools |
|
Requires: ncurses |
|
Requires: popt |
|
Requires: tcsh |
|
Requires: redhat-release |
|
Requires: diffutils |
|
Requires: ed |
|
Requires: dialog |
|
Requires: rmt |
|
Requires: sed |
|
Requires: which |
|
Requires: gawk |
|
Requires: mingetty |
|
Requires: info |
|
Requires: portmap |
|
Requires: openssh-clients |
|
Requires: openssh |
|
Requires: openssh-server |
|
Requires: openssl |
|
Requires: basesystem |
|
Requires: ldconfig |
|
Requires: filesystem |
|
Requires: mktemp |
|
Requires: termcap |
|
Requires: shadow-utils |
|
Requires: libtermcap |
|
Requires: MAKEDEV |
|
Requires: utempter |
|
Requires: bash |
|
Requires: logrotate |
|
Requires: SysVinit |
|
Requires: chkconfig |
|
Requires: textutils |
|
Requires: pwdb |
|
Requires: vixie-cron |
|
Requires: procps |
|
Requires: modutils |
|
Requires: psmisc |
|
Requires: sysklogd |
|
Requires: authconfig |
|
Requires: zlib |
|
Requires: sh-utils |
|
Requires: mailcap |
|
Requires: anacron |
|
Requires: bc |
|
Requires: bdflush |
|
Requires: bind-utils |
|
Requires: cpio |
|
Requires: crontabs |
|
Requires: etcskel |
|
Requires: e2fsprogs |
|
Requires: samba-client |
|
Requires: apache-devel |
|
Requires: autofs |
|
Requires: findutils |
|
Requires: gdbm |
|
Requires: getty_ps |
|
Requires: readline |
|
Requires: glib10 |
|
Requires: inetd |
|
Requires: losetup |
|
Requires: gnupg |
|
Requires: gpgp |
|
Requires: urw-fonts |
|
Requires: mailx |
|
Requires: gzip |
|
Requires: ld.so |
|
Requires: less |
|
Requires: passwd |
|
Requires: sysreport |
|
Requires: ncompress |
|
Requires: mount |
|
Requires: lilo |
|
Requires: bzip2 |
|
Requires: grep |
|
Requires: memprof |
|
Requires: mars-nwe |
|
Requires: pidentd |
|
Requires: procinfo |
|
Requires: units |
|
Requires: routed |
|
Requires: quota |
|
Requires: pam |
|
Requires: stat |
|
Requires: setserial |
|
Requires: mod_perl |
|
Requires: rootfiles |
|
Requires: nfs-utils |
|
Requires: sendmail |
|
Requires: sharutils |
|
Requires: tmpwatch |
|
Requires: shapecfg |
|
Requires: tcp_wrappers |
|
Requires: unzip |
|
Requires: tetex-dvips |
|
Requires: tetex-afm |
|
Requires: tetex-latex |
|
Requires: xntp3 |
|
Requires: rpm |
|
Requires: wu-ftpd |
|
Requires: setup |
|
Requires: glibc |
|
Requires: fileutils |
|
Requires: initscripts |
|
Requires: netatalk |
|
Requires: apache |
|
Requires: bash2 |
|
Requires: dev |
|
Requires: samba |
|
Requires: ghostscript |
|
Requires: kernel-headers |
|
Requires: kernel |
|
Requires: linuxconf |
|
Requires: tetex |
|
Requires: tetex-fonts |
|
Requires: util-linux |
|
Requires: vim-common |
|
Requires: perl |
|
Requires: cracklib |
|
Requires: cracklib-dicts |
|
Requires: cdrecord |
|
Requires: ghostscript-fonts |
|
Requires: libgr |
|
Requires: libjpeg |
|
Requires: libpng |
|
Requires: libungif-progs |
|
Requires: libtiff |
|
Requires: libungif |
|
Requires: samba-common |
|
Requires: ImageMagick |
|
Requires: libgr-progs |
|
Requires: man-pages |
|
Requires: tar |
|
Requires: vim-minimal |
|
END |
|
} |
|
else { |
|
$requires=<<END; |
|
Requires: LON-CAPA-base |
|
END |
|
} |
open (SPEC,">$tag/SPECS/LON-CAPA-$tag-$version.spec"); |
open (SPEC,">$tag/SPECS/LON-CAPA-$tag-$version.spec"); |
|
|
|
my $vendor='Laboratory for Instructional Technology Education, Division of '. |
|
'Science and Mathematics Education, Michigan State University.'; |
|
|
print SPEC <<END; |
print SPEC <<END; |
Summary: Files for the $tag component of LON-CAPA. |
Summary: Files for the $tag component of LON-CAPA. |
Name: LON-CAPA-$tag |
Name: LON-CAPA-$tag |
Version: $version |
Version: $version |
Release: 1 |
Release: 1 |
Vendor: Laboratory for Instructional Technology Education, Division of Science and Mathematics Education, Michigan State University. |
Vendor: $vendor |
BuildRoot: $currentdir/BuildRoot |
BuildRoot: $currentdir/BuildRoot |
Copyright: GNU General Public License. Version 2, June 1991. Michigan State University patents may apply. |
Copyright: Michigan State University patents may apply. |
Group: Utilities/System |
Group: Utilities/System |
Source: LON-CAPA-$tag-$version.tar.gz |
Source: LON-CAPA-$tag-$version.tar.gz |
AutoReqProv: no |
AutoReqProv: no |
|
$requires |
# requires: filesystem |
# requires: filesystem |
\%description |
\%description |
This package is automatically generated by the make_rpm.pl perl |
This package is automatically generated by the make_rpm.pl perl |
Line 125 echo "http://www.lon-capa.org/"
|
Line 336 echo "http://www.lon-capa.org/"
|
echo "Gerd Kortemeyer, et al" |
echo "Gerd Kortemeyer, et al" |
echo "Laboratory for Instructional Technology Education" |
echo "Laboratory for Instructional Technology Education" |
echo "Michigan State University" |
echo "Michigan State University" |
echo "General Public License, Version 2, June 1991" |
echo " " |
echo "** Michigan State University patents may apply **" |
echo "** Michigan State University patents may apply **" |
echo " " |
echo " " |
echo "This installation assumes an installation of Redhat 6.2" |
echo "This installation assumes an installation of Redhat 6.2" |
Line 159 foreach $file (<>) {
|
Line 370 foreach $file (<>) {
|
$file=~s/^$pathprefix//; |
$file=~s/^$pathprefix//; |
} |
} |
if ($type eq "files") { |
if ($type eq "files") { |
push @{$BinaryRootMakefile{$type}},"\tinstall -D -m $octalmode $pathprefix$file $binaryroot$file\n"; |
push @{$BinaryRootMakefile{$type}},"\tinstall -D -m $octalmode ". |
push @{$Makefile{$type}},"\tinstall -D -m $octalmode \$(SOURCE)$file \$(ROOT)$file\n"; |
"$pathprefix$file $binaryroot$file\n"; |
push @{$dotspecfile{$type}},"$config\%attr($octalmode,$user,$group) $file\n"; |
push @{$Makefile{$type}},"\tinstall -D -m $octalmode ". |
|
"\$(SOURCE)$file \$(ROOT)$file\n"; |
|
push @{$dotspecfile{$type}},"$config\%attr($octalmode,$user,". |
|
"$group) $file\n"; |
} |
} |
elsif ($type eq "directories") { |
elsif ($type eq "directories") { |
push @{$BinaryRootMakefile{$type}},"\tinstall -m $octalmode -d $binaryroot$file\n"; |
push @{$BinaryRootMakefile{$type}},"\tinstall -m $octalmode -d ". |
push @{$Makefile{$type}},"\tinstall -m $octalmode -d \$(SOURCE)$file \$(ROOT)$file\n"; |
"$binaryroot$file\n"; |
push @{$dotspecfile{$type}},"\%dir \%attr($octalmode,$user,$group) $file\n"; |
push @{$Makefile{$type}},"\tinstall -m $octalmode -d ". |
|
"\$(SOURCE)$file \$(ROOT)$file\n"; |
|
push @{$dotspecfile{$type}},"\%dir \%attr($octalmode,$user,". |
|
"$group) $file\n"; |
} |
} |
elsif ($type eq "links") { |
elsif ($type eq "links") { |
my $link=$size; # I use the size variable to pass the link value from the subroutine find_info |
my $link=$size; # I use the size variable to pass the link value |
|
# from the subroutine find_info |
$link=~s/^$pathprefix//; |
$link=~s/^$pathprefix//; |
push @{$BinaryRootMakefile{$type}},"\tln -s $link $binaryroot$file\n"; |
push @{$BinaryRootMakefile{$type}}, |
|
"\tln -s $link $binaryroot$file\n"; |
push @{$Makefile{$type}},"\tln -s $link \$(ROOT)$file\n"; |
push @{$Makefile{$type}},"\tln -s $link \$(ROOT)$file\n"; |
push @{$dotspecfile{$type}},"\%attr(-,$user,$group) $file\n"; |
push @{$dotspecfile{$type}},"\%attr(-,$user,$group) $file\n"; |
} |
} |
Line 199 close SPEC;
|
Line 418 close SPEC;
|
`make -f $tag/BinaryRootMakefile files`; |
`make -f $tag/BinaryRootMakefile files`; |
`make -f $tag/BinaryRootMakefile links`; |
`make -f $tag/BinaryRootMakefile links`; |
|
|
print `cd $currentdir/SOURCES; tar czvf LON-CAPA-$tag-$version.tar.gz LON-CAPA-$tag-$version`; |
my $command="cd $currentdir/SOURCES; tar czvf LON-CAPA-$tag-$version.tar.gz ". |
print `cd $currentdir/SPECS; rpm --rcfile=./rpmrc -ba LON-CAPA-$tag-$version.spec; cd ../RPMS/i386; cp LON-CAPA-$tag-$version-1.i386.rpm $invokingdir/.`; |
"LON-CAPA-$tag-$version"; |
# print `cd $invokingdir; rm -Rf $tag`; |
print `$command`; |
|
$command="cd $currentdir/SPECS; rpm --rcfile=./rpmrc -ba ". |
|
"LON-CAPA-$tag-$version.spec; cd ../RPMS/i386; cp ". |
|
"LON-CAPA-$tag-$version-1.i386.rpm $invokingdir/."; |
|
print `$command`; |
|
print `cd $invokingdir; rm -Rf $tag`; |
|
|
sub find_info { |
sub find_info { |
# only look for |
# only look for |
Line 216 sub find_info {
|
Line 440 sub find_info {
|
return ("directories",split(/\t/,$line)); |
return ("directories",split(/\t/,$line)); |
} |
} |
elsif (($line=`find $file -type l -prune`)=~/^$file\n/) { |
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)); |
return ("links",split(/\t/,$line)); |
} |
} |
|
|