version 1.1, 2000/10/02 14:07:53
|
version 1.15, 2002/02/16 19:53:46
|
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 (A CLEAN AND CONFIGURABLE WAY) |
# from file listing. |
# |
|
# $Id$ |
# GNU General Public License, Version 2, June 1991 |
# |
# See http://www.gnu.org/copyleft/gpl.html. |
# Written by Scott Harrison, harris41@msu.edu |
|
# |
# This file currently does not actually "build" the RPM. |
# Copyright Michigan State University Board of Trustees |
# This has to be done with an RPM build environment and |
# |
# commands like 'rpm -ba'. |
# This file is part of the LearningOnline Network with CAPA (LON-CAPA). |
|
# |
# What this file DOES do is generate all the needed |
# LON-CAPA is free software; you can redistribute it and/or modify |
# files (and binary root directory tree) to build an RPM with. |
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; either version 2 of the License, or |
# I still need to implement the CONFIGURATION_FILES and |
# (at your option) any later version. |
# DOCUMENTATION_FILES portion of the command line interface to this |
# |
# script. |
# LON-CAPA is distributed in the hope that it will be useful, |
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
# Take in a file list (from standard input), |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
# a description tag and version tag from command line argument |
# GNU General Public License for more details. |
# and generate a: |
# |
# RPM .spec file |
# You should have received a copy of the GNU General Public License |
# RPM Makefile |
# along with LON-CAPA; if not, write to the Free Software |
# SourceRoot |
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
# |
|
# 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,1/8,1/9,2/13 - Scott Harrison |
|
# |
|
### |
|
|
|
# make_rpm.pl automatically generate RPM software packages |
|
# from a target image directory and file listing. POD |
|
# documentation is at the end of this file. |
|
|
|
############################################################################### |
|
## ## |
|
## ORGANIZATION OF THIS PERL SCRIPT ## |
|
## ## |
|
## 1. Check to see if RPM builder application is available ## |
|
## 2. Read in arguments ## |
|
## 3. Generate temporary directories ## |
|
## 4. Initialize some variables ## |
|
## 5. Create a standalone rpm building environment ## |
|
## 6. Perform variable initializations and customizations ## |
|
## 7. Print header information for .spec file ## |
|
## 8. Process file list and generate information ## |
|
## 9. Generate SRPM and BinaryRoot Makefiles ## |
|
## 10. mirror copy (BinaryRoot) files under a temporary directory ## |
|
## 11. roll everything into an rpm ## |
|
## 12. clean everything up ## |
|
## 13. subroutines ## |
|
## 13a. find_info - recursively gather information from a directory ## |
|
## 13b. grabtag - grab a tag from an XML string ## |
|
## 14. Plain Old Documentation ## |
|
## ## |
|
############################################################################### |
|
|
unless (-e "/usr/lib/rpm/rpmrc") { |
use strict; |
|
|
|
# ------------------------ Check to see if RPM builder application is available |
|
|
|
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 |
} |
} |
|
|
my ($tag,$version,$configuration_files,$documentation_files,$pathprefix)=@ARGV; |
# ----------------------------------------------------------- Read in arguments |
|
|
|
my ($tag,$version,$configuration_files,$documentation_files, |
|
$pathprefix,$customize)=@ARGV; |
@ARGV=(); |
@ARGV=(); |
|
|
if (!$version) { |
if (!$version) { |
print "Usage: <TAG> <VERSION> [CONFIGURATION_FILES] [DOCUMENTATION] [PATHPREFIX]\n"; |
print <<END; |
print "Standard input provides the list of files to work with.\n"; |
See "perldoc make_rpm.pl" for more information. |
print "TAG, required descriptive tag. For example, a kerberos software package might be tagged as \"krb4\".\n"; |
|
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"; |
Usage: |
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"; |
<STDIN> | perl make_rpm.pl <TAG> <VERSION> [CONFIGURATION_FILES] |
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"; |
[DOCUMENTATION_FILES] [PATHPREFIX] [CUSTOMIZATION_XML] |
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"; |
|
|
Standard input provides the list of files to work with. |
|
TAG, required descriptive tag. For example, a kerberos software |
|
package might be tagged as "krb4". |
|
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. |
|
CONFIGURATION_FILES, optional comma-separated listing of files to |
|
be treated as configuration files by RPM (and thus subject to saving |
|
during RPM upgrades). |
|
DOCUMENTATION_FILES, 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). |
|
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. |
|
CUSTOMIZATION_XML, allows for customizing various pieces of information such |
|
as vendor, summary, name, copyright, group, autoreqprov, requires, prereq, |
|
description, and pre-installation scripts (see more in the POD; |
|
perldoc make_rpml.pl). |
|
END |
exit; |
exit; |
} |
} |
|
|
mkdir $tag,0755; |
mkdir $tag,0755; |
mkdir "$tag/BuildRoot",0755; |
mkdir "$tag/BuildRoot",0755; |
mkdir "$tag/SOURCES",0755; |
mkdir "$tag/SOURCES",0755; |
mkdir "$tag/SOURCES/LON-CAPA-$tag-$version",0755; |
|
mkdir "$tag/SPECS",0755; |
mkdir "$tag/SPECS",0755; |
mkdir "$tag/BUILD",0755; |
mkdir "$tag/BUILD",0755; |
mkdir "$tag/SRPMS",0755; |
mkdir "$tag/SRPMS",0755; |
mkdir "$tag/RPMS",0755; |
mkdir "$tag/RPMS",0755; |
mkdir "$tag/RPMS/i386",0755; |
mkdir "$tag/RPMS/i386",0755; |
|
|
|
# -------------------------------------------------------- Initialize variables |
|
|
my $file; |
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"; |
my $currentdir=`pwd`; chop $currentdir; my $invokingdir=$currentdir; |
|
$currentdir.="/$tag"; |
|
|
|
# -------------------------------- Create a standalone rpm building environment |
|
|
open (IN,"</usr/lib/rpm/rpmrc") or die("Can't open /usr/lib/rpm/rpmrc"); |
open (IN,'</usr/lib/rpm/rpmrc') or die('Cannot open /usr/lib/rpm/rpmrc'); |
@lines=<IN>; |
my @lines=<IN>; |
close IN; |
close IN; |
|
|
open (RPMRC,">$tag/SPECS/rpmrc"); |
open (RPMRC,">$tag/SPECS/rpmrc"); |
foreach $line (@lines) { |
foreach my $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 86 print RPMMACROS <<END;
|
Line 158 print RPMMACROS <<END;
|
END |
END |
close RPMMACROS; |
close RPMMACROS; |
|
|
open (SPEC,">$tag/SPECS/LON-CAPA-$tag-$version.spec"); |
# ------------------------- Perform variable initializations and customizations |
|
|
|
my $cu; |
|
if ($customize) { |
|
open (IN,"<$customize") or die("Cannot open $customize"); |
|
my @clines=(<IN>); |
|
$cu=join('',@clines); |
|
close IN; |
|
} |
|
my $tv; # tag value variable for storing retrievals from $cu |
|
|
|
# (Sure. We could use HTML::TokeParser here.. but that wouldn't be fun now, |
|
# would it?) |
|
my $name=$tag; |
|
# read in name from customization if available |
|
$tv=grabtag('name',$cu,1); $name=$tv if $tv; |
|
$name=~s/\<tag \/\>/$tag/g; |
|
|
|
# okay.. now we can generate this needed directory |
|
mkdir "$tag/SOURCES/$name-$version",0755; |
|
|
|
my $requires=""; |
|
# read in relevant requires info from customization file (if applicable) |
|
# note that "PreReq: item" controls order of CD-ROM installation (if you |
|
# are making a customized CD-ROM) |
|
# "Requires: item" just enforces dependencies from the command-line invocation |
|
$tv=grabtag('requires',$cu,1); $requires=$tv if $tv; |
|
# do more require processing here |
|
$requires=~s/\s*\<\/item\>\s*//g; |
|
$requires=~s/\s*\<item\>\s*/\n/g; |
|
$requires=~s/^\s+//s; |
|
|
|
my $summary="Files for the $name software package."; |
|
# read in summary from customization if available |
|
$tv=grabtag('summary',$cu,1); $summary=$tv if $tv; |
|
$summary=~s/\<tag \/\>/$tag/g; |
|
|
|
my $autoreqprov='no'; |
|
# read in autoreqprov from customization if available |
|
$tv=grabtag('autoreqprov',$cu,1); $autoreqprov=$tv if $tv; |
|
|
|
my $copyright="not specified here"; |
|
# read in copyright from customization if available |
|
$tv=grabtag('copyright',$cu,1); $copyright=$tv if $tv; |
|
$copyright=~s/\<tag \/\>/$tag/g; |
|
|
|
open (SPEC,">$tag/SPECS/$name-$version.spec"); |
|
|
|
my $vendor='Me'; |
|
# read in vendor from customization if available |
|
$tv=grabtag('vendor',$cu,1); $vendor=$tv if $tv; |
|
$vendor=~s/\<tag \/\>/$tag/g; |
|
|
|
my $description="$name software package"; |
|
# read in description from customization if available |
|
$tv=grabtag('description',$cu,0); $description=$tv if $tv; |
|
$description=~s/\<tag \/\>/$tag/g; |
|
|
|
my $pre=""; |
|
# read in pre-installation script if available |
|
$tv=grabtag('pre',$cu,0); $pre=$tv if $tv; |
|
$pre=~s/\<tag \/\>/$tag/g; |
|
|
|
# ------------------------------------- Print header information for .spec file |
|
|
print SPEC <<END; |
print SPEC <<END; |
Summary: Files for the $tag component of LON-CAPA. |
Summary: $summary |
Name: LON-CAPA-$tag |
Name: $name |
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: $copyright |
Group: Utilities/System |
Group: Utilities/System |
Source: LON-CAPA-$tag-$version.tar.gz |
Source: $name-$version.tar.gz |
AutoReqProv: no |
AutoReqProv: $autoreqprov |
|
$requires |
# requires: filesystem |
# requires: filesystem |
\%description |
\%description |
This package is automatically generated by the make_rpm.pl perl |
$description |
script (written by the LON-CAPA development team, www.lon-capa.org, |
|
Scott Harrison). This implements the $tag component for LON-CAPA. |
|
For more on the LON-CAPA project, visit http://www.lon-capa.org/. |
|
|
|
\%prep |
\%prep |
\%setup |
\%setup |
Line 118 make ROOT="\$RPM_BUILD_ROOT" SOURCE="$cu
|
Line 251 make ROOT="\$RPM_BUILD_ROOT" SOURCE="$cu
|
make ROOT="\$RPM_BUILD_ROOT" SOURCE="$currentdir/BinaryRoot" links |
make ROOT="\$RPM_BUILD_ROOT" SOURCE="$currentdir/BinaryRoot" links |
|
|
\%pre |
\%pre |
echo "***********************************************************************" |
$pre |
echo "LON-CAPA LearningOnline with CAPA" |
|
echo "http://www.lon-capa.org/" |
|
echo "Gerd Kortemeyer, et al" |
|
echo "Laboratory for Instructional Technology Education" |
|
echo "Michigan State University" |
|
echo "General Public License, Version 2, June 1991" |
|
echo "** Michigan State University patents may apply **" |
|
echo " " |
|
echo "This installation assumes an installation of Redhat 6.2" |
|
echo " " |
|
echo "The server computer should be currently connected to the ethernet" |
|
echo " " |
|
echo "The files in this package are only those for the $tag component." |
|
echo "Configuration files are sometimes part of the LON-CAPA-base RPM." |
|
echo "***********************************************************************" |
|
|
|
\%post |
\%post |
\%postun |
\%postun |
Line 141 echo "**********************************
|
Line 259 echo "**********************************
|
\%files |
\%files |
END |
END |
|
|
|
# ------------------------------------ Process file list and gather information |
|
|
|
my %BinaryRootMakefile; |
|
my %Makefile; |
|
my %dotspecfile; |
|
|
foreach $file (<>) { |
foreach $file (<>) { |
chop $file; |
chop $file; |
|
my $comment=""; |
|
if ($file=~/\s+\#(.*)$/) { |
|
$file=~s/\s+\#(.*)$//; |
|
$comment=$1; |
|
} |
|
my $directive=""; |
|
if ($comment=~/config\(noreplace\)/) { |
|
$directive="\%config(noreplace) "; |
|
} |
|
elsif ($comment=~/config/) { |
|
$directive="\%config "; |
|
} |
|
elsif ($comment=~/doc/) { |
|
$directive="\%doc"; |
|
} |
if (($type,$size,$octalmode,$user,$group)=find_info($file)) { |
if (($type,$size,$octalmode,$user,$group)=find_info($file)) { |
$octalmode="0" . $octalmode if length($octalmode)<4; |
$octalmode="0" . $octalmode if length($octalmode)<4; |
if ($pathprefix) { |
if ($pathprefix) { |
$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}},"\%attr($octalmode,$user,$group) $file\n"; |
push @{$Makefile{$type}},"\tinstall -D -m $octalmode ". |
|
"\$(SOURCE)$file \$(ROOT)$file\n"; |
|
push @{$dotspecfile{$type}},"$directive\%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"; |
} |
} |
} |
} |
} |
} |
|
|
open OUT, ">$tag/SOURCES/LON-CAPA-$tag-$version/Makefile"; |
# -------------------------------------- Generate SRPM and BinaryRoot Makefiles |
open OUT2, ">$tag/BinaryRootMakefile"; |
|
|
open OUTS, ">$tag/SOURCES/$name-$version/Makefile"; |
|
open OUTB, ">$tag/BinaryRootMakefile"; |
foreach $type ("directories","files","links") { |
foreach $type ("directories","files","links") { |
print OUT "$type\:\n"; |
print OUTS "$type\:\n"; |
print OUT join("",@{$Makefile{$type}}); |
print OUTS join("",@{$Makefile{$type}}) if $Makefile{$type}; |
print OUT "\n"; |
print OUTS "\n"; |
print OUT2 "$type\:\n"; |
print OUTB "$type\:\n"; |
print OUT2 join("",@{$BinaryRootMakefile{$type}}); |
print OUTB join("",@{$BinaryRootMakefile{$type}}) |
print OUT2 "\n"; |
if $BinaryRootMakefile{$type}; |
print SPEC join("",@{$dotspecfile{$type}}); |
print OUTB "\n"; |
|
print SPEC join("",@{$dotspecfile{$type}}) if $dotspecfile{$type}; |
} |
} |
close OUT2; |
close OUTB; |
close OUT; |
close OUTS; |
|
|
|
|
close SPEC; |
close SPEC; |
|
|
|
# ------------------ mirror copy (BinaryRoot) files under a temporary directory |
|
|
`make -f $tag/BinaryRootMakefile directories`; |
`make -f $tag/BinaryRootMakefile directories`; |
`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`; |
# ------------------------------------------------- roll everything into an RPM |
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/.`; |
|
|
my $command="cd $currentdir/SOURCES; tar czvf $name-$version.tar.gz ". |
|
"$name-$version"; |
|
print `$command`; |
|
$command="cd $currentdir/SPECS; rpm --rcfile=./rpmrc -ba ". |
|
"$name-$version.spec; cd ../RPMS/i386; cp ". |
|
"$name-$version-1.i386.rpm $invokingdir/."; |
|
print `$command`; |
|
|
|
# --------------------------------------------------------- clean everything up |
|
|
print `cd $invokingdir; rm -Rf $tag`; |
print `cd $invokingdir; rm -Rf $tag`; |
|
|
|
# ----------------------------------------------------------------- SUBROUTINES |
|
# ----- Subroutine: find_info - recursively gather information from a directory |
sub find_info { |
sub find_info { |
# only look for |
|
my ($file)=@_; |
my ($file)=@_; |
my $line; |
my $line; |
if (($line=`find $file -type f -prune`)=~/^$file\n/) { |
if (($line=`find $file -type f -prune`)=~/^$file\n/) { |
Line 206 sub find_info {
|
Line 368 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)); |
} |
} |
|
die("**** ERROR **** $file is neither a directory, soft link, or file"); |
|
} |
|
|
|
# ------------------------- Subroutine: grabtag - grab a tag from an xml string |
|
sub grabtag { |
|
my ($tag,$text,$clean)=@_; |
|
# meant to be quick and dirty as opposed to a formal state machine parser |
|
my $value; |
|
$cu=~/\<$tag\>(.*?)\<\/$tag\>/s; |
|
$value=$1; $value=~s/^\s+//; |
|
if ($clean) { |
|
$value=~s/\n\s/ /g; |
|
$value=~s/\s\n/ /g; |
|
$value=~s/\n/ /g; |
|
$value=~s/\s+$//; |
|
} |
|
return $value; |
} |
} |
|
|
|
# ----------------------------------------------------- Plain Old Documentation |
|
|
|
=head1 NAME |
|
|
|
make_rpm.pl - automatically generate an RPM software package |
|
|
|
=head1 SYNOPSIS |
|
|
|
Usage: <TAG> <VERSION> [CONFIGURATION_FILES] |
|
[DOCUMENTATION_FILES] [PATHPREFIX] [CUSTOMIZATION_XML] |
|
|
|
Standard input provides the list of files to work with. |
|
|
|
TAG, required descriptive tag. For example, a kerberos software |
|
package might be tagged as "krb4". |
|
|
|
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. |
|
|
|
CONFIGURATION_FILES, optional comma-separated listing of files to |
|
be treated as configuration files by RPM (and thus subject to saving |
|
during RPM upgrades). |
|
|
|
DOCUMENTATION_FILES, 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). |
|
|
|
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. |
|
|
|
CUSTOMIZATION_XML, allows for customizing various pieces of information such |
|
as vendor, summary, name, copyright, group, autoreqprov, requires, prereq, |
|
description, and pre-installation scripts (see more in the POD; |
|
perldoc make_rpml.pl). |
|
|
|
Examples: |
|
|
|
[prompt] find notreallyrootdir | perl make_rpm.pl makemoney 3.1 '' \ |
|
'/usr/doc/man/man3/makemoney.3' notreallyrootdir |
|
would generate makemoney-3.1-1.i386.rpm |
|
|
|
[prompt] find /usr/local/bin | perl make_rpm.pl mybinfiles 1.0 |
|
would generate mybinfiles-1.0-1.i386.rpm |
|
|
|
[prompt] find romeo | perl make_rpm.pl romeo 1.0 '' '' '' customize.xml |
|
would generate romeo with customizations from customize.xml. |
|
|
|
The CUSTOMIZATION_XML argument represents a way to customize the |
|
numerous variables associated with RPMs. This argument represents |
|
a file name. (Parsing is done in an unsophisticated fashion using |
|
regular expressions.) Here are example contents of such a file: |
|
|
|
<vendor> |
|
Laboratory for Instructional Technology Education, Division of |
|
Science and Mathematics Education, Michigan State University. |
|
</vendor> |
|
<summary>Files for the <tag /> component of LON-CAPA</summary> |
|
<name>LON-CAPA-<tag /></name> |
|
<copyright>Michigan State University patents may apply.</copyright> |
|
<group>Utilities/System</group> |
|
<AutoReqProv>no</AutoReqProv> |
|
<requires tag='setup'> |
|
<item>PreReq: setup</item> |
|
<item>PreReq: passwd</item> |
|
<item>PreReq: util-linux</item> |
|
</requires> |
|
<requires tag='base'> |
|
<item>PreReq: LON-CAPA-setup</item> |
|
<item>PreReq: apache</item> |
|
<item>PreReq: /etc/httpd/conf/access.conf</item> |
|
</requires> |
|
<requires> |
|
<item>Requires: LON-CAPA-base</item> |
|
</requires> |
|
<description> |
|
This package is automatically generated by the make_rpm.pl perl |
|
script (written by the LON-CAPA development team, www.lon-capa.org, |
|
Scott Harrison). This implements the <tag /> component for LON-CAPA. |
|
For more on the LON-CAPA project, visit http://www.lon-capa.org/. |
|
</description> |
|
<pre> |
|
echo "***********************************************************************" |
|
echo "LON-CAPA LearningOnline with CAPA" |
|
echo "http://www.lon-capa.org/" |
|
echo " " |
|
echo "Laboratory for Instructional Technology Education" |
|
echo "Michigan State University" |
|
echo " " |
|
echo "** Michigan State University patents may apply **" |
|
echo " " |
|
echo "This installation assumes an installation of Redhat 6.2" |
|
echo " " |
|
echo "The server computer should be currently connected to the ethernet" |
|
echo " " |
|
echo "The files in this package are only those for the <tag /> component." |
|
echo "Configuration files are sometimes part of the LON-CAPA-base RPM." |
|
echo "***********************************************************************" |
|
</pre> |
|
|
|
=head1 DESCRIPTION |
|
|
|
Automatically generate an RPM software package from a list of files. |
|
|
|
This script builds the RPM in a very clean and configurable fashion. |
|
(Finally! Making RPMs outside of /usr/src/redhat without a zillion |
|
file intermediates left over!) |
|
|
|
This script generates and then deletes temporary |
|
files needed to build an RPM with. |
|
It works cleanly and independently from pre-existing |
|
directory trees such as /usr/src/redhat/*. |
|
|
|
The script is also simple. It accepts four kinds of information, |
|
two of which are mandatory: |
|
|
|
=over 4 |
|
|
|
=item * |
|
|
|
a list of files that are to be part of the software package; |
|
|
|
=item * |
|
|
|
the location of these files; |
|
|
|
=item * |
|
|
|
(optional) a descriptive tag and a version tag; |
|
|
|
=item * |
|
|
|
and (optional) an XML file that defines the additional metadata |
|
associated with the RPM software package. |
|
|
|
=back |
|
|
|
The following items are initially and temporarily generated during the |
|
construction of an RPM: |
|
|
|
=over 4 |
|
|
|
=item * |
|
|
|
RPM .spec file |
|
|
|
=item * |
|
|
|
RPM Makefile |
|
|
|
=item * |
|
|
|
SourceRoot |
|
|
|
=back |
|
|
|
A resulting .rpm file is generated. |
|
|
|
make_rpm.pl is compatible with both rpm version 3.* and rpm version 4.*. |
|
|
|
=head1 README |
|
|
|
Automatically generate an RPM software package from a list of files. |
|
|
|
This script builds the RPM in a very clean and configurable fashion. |
|
(Making RPMs the simple and right way!) |
|
|
|
This script generates and then deletes temporary |
|
files (and binary root directory tree) to build an RPM with. |
|
It is designed to work cleanly and independently from pre-existing |
|
directory trees such as /usr/src/redhat/*. |
|
|
|
=head1 PREREQUISITES |
|
|
|
This script requires the C<strict> module. |
|
|
|
=pod OSNAMES |
|
|
|
Linux |
|
|
|
=pod SCRIPT CATEGORIES |
|
|
|
UNIX/System Administration |
|
|
|
=cut |