RPM homepage link
Home
Up

   MAKE_RPM-1.17(1) User Contributed Perl Documentation MAKE_RPM-1.17(1) NAME make_rpm.pl - cleanly generate an rpm in a simple one-line command SYNOPSIS Usage: <STDIN> | make_rpm.pl <TAG> <VERSION> [CONFIGURATION_FILES] [DOCUMENTATION_FILES] [PATHPREFIX] [CUSTOMIZATION_XML] The standard input stream STDIN, the standard input stream, provides the list of files to work with. This list of file names must give the complete filesystem path starting from '/'. o For instance, the following is invalid: romeodir/file1.txt # ** INVALID! ** missing leading filesystem path romeodir/file2.txt romeodir/file3.txt o Whereas, the following is valid: /home/joe/romeodir/file1.txt /home/joe/romeodir/file2.txt /home/joe/romeodir/file3.txt o In terms of the find command, "find romeodir | perl make_rpm.pl [COMMAND-LINE ARGUMENTS]" is incorrect, whereas "find /home/joe/romeodir |perl make_rpm.pl [COMMAND-LINE ARGUMENTS]" or "find `pwd`/romeodir |perl make_rpm.pl [COMMAND-LINE ARGUMENTS]" is correct. The standard input stream can also specify configuration files and doc- umentation files through '#'-style commenting. For example, the following file listing encodes some of these direc- tives: /home/joe/romeodir/buildloc/etc/romeo/user.conf # config(noreplace) /home/joe/romeodir/buildloc/etc/romeo/juliet.conf # config /home/joe/romeodir/buildloc/doc/man/man.1/romeo.1 # doc /home/joe/romeodir/buildloc/doc/man/man.1/romeo_talks.1 # doc /home/joe/romeodir/buildloc/usr/local/bin/where_art_thou /home/joe/romeodir/buildloc/usr/local/bin/romeo_talks The config directive controls how files are replaced and/or backed up when a user attempts to install (rpm -i) the .rpm file generated by make_rpm.pl. The doc directive controls how a given file is placed inside special documentation directories on the filesystem during rpm installation (rpm -i). (If you want to learn more on how the rpmtool gives configuration and documentation files special treatment, you should read about "Directives" in Edward Bailey's well-known "Maximum RPM" book available online at /max-rpm/s1-rpm-inside-files-list-directives.html.) Description of command-line arguments TAG ($tag), required descriptive tag. For example, a kerberos software package might be tagged as "krb4". VERSION ($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 dur- ing RPM upgrades). Configuration files can also be specified in the standard input stream (as described in "The standard input stream"). 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). Documen- tation files can also be specified in the standard input stream (as described in "The standard input stream"). 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 PATHPRE- FIX. CUSTOMIZATION_XML, optional filename where XML-ish information exists. Allows for customizing various pieces of information such as vendor, summary, name, copyright, group, autoreqprov, requires, prereq, description, and pre-installation scripts (see "Customizing descriptive data of your RPM software package"). Examples bash$ find /notreallyrootdir | perl make_rpm.pl \ makemoney 3.1 '' \ '/usr/doc/man/man3/makemoney.3' \ /notreallyrootdir would generate makemoney-3.1-1.i386.rpm bash$ find /usr/local/bin | \ perl make_rpm.pl mybinfiles 1.0 would generate mybinfiles-1.0-1.i386.rpm bash$ find /home/joe/romeodir/buildloc | \ perl make_rpm.pl romeo \ 1.0 '' '' '/home/joe/romeodir/buildloc' customize.xml would generate romeo with customizations from customize.xml. The CUSTOMIZATION_XML argument represents a way to customize the numer- ous variables associated with RPMs. This argument represents a file name. (Parsing is done in an unsophisticated fashion using regular expressions.) See "Customizing descriptive data of your RPM software package". Customizing descriptive data of your RPM software package RPMS can be (and often are) packaged with descriptive data describing authorship, dependencies, descriptions, etc. The following values can be tagged inside an XML file (specified by the 6th command-line argument) and made part of the RPM package information (rpm -qi <package-name>). o vendor o summary o name (overrides the <TAG> argument value; see ""Description of command- line arguments") o copyright o group (the software package group; e.g. Applications/System, User Inter- face/X, Development/Libraries, etc.) o requires Contains all the dependency information (see the example below). o description o pre Commands to be executed prior to software package installation. Here is an example (note that make_rpm.pl automatically substitutes any "<tag />" string with the first command-line argument described in "Description of command-line arguments"): <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 files in this package are for the <tag /> component." echo "***********************************************************" </pre> DESCRIPTION Automatically generate an RPM software package from a list of files. make_rpm.pl 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!) make_rpm.pl 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/*. Input to the script is simple. make_rpm.pl accepts five kinds of information, three of which are mandatory: o (required) a list of files that are to be part of the software package; o (required) the absolute filesystem location of these files (see "The standard input stream"); o (required) a descriptive tag and a version tag for the naming of the RPM software package; o (optional) documentation and configuration files; o and (optional) an XML file that defines the additional metadata associated with the RPM software package. A temporary directory named $tag (first argument described in "Descrip- tion of command-line arguments") is o generated under the directory from which you run make_rpm.pl. For example, user "joe" running cat file_list.txt | make_rpm.pl krb4 1.0 would temporarily generate /home/joe/krb4/. o /home/joe/krb4/ is deleted after the *.rpm file is generated. The RPM will typically be named $name-$version.i386.rpm where $name=$tag. (The $name can be overridden in the customization XML file; see "Customizing descriptive data of your RPM software package".) Here are some of the items are generated inside the $tag directory dur- ing the construction of an RPM: o RPM .spec file (./$tag/SPECS/$name-$version.spec) o RPM Makefile (./$tag/SOURCES/$name-$version/Makefile) This is the Makefile that is called by the rpm command in building the .i386.rpm from the .src.rpm. The following directories are generated and/or used: o SOURCE directory: ./$tag/BinaryRoot/ o TARGET directory: ./$tag/BuildRoot/ o BinaryRootMakefile (./$tag/BinaryRootMakefile) This is the Makefile that this script creates and calls to build the $tag/BinaryRoot/ directory from the existing filesystem. The following directories are generated and/or used: o SOURCE directory: / (your entire filesystem) o TARGET directory: ./$tag/BinaryRoot/ The final output of make_rpm.pl is a binary .rpm file. The ./tag directory is deleted (along with the .src.rpm file). The typical file name generated by make_rpm.pl is $tag-$version.i386.rpm. make_rpm.pl is compatible with either rpm version 3.* or rpm version 4.*. README Automatically generate an RPM software package from a list of files. make_rpm.pl builds the RPM in a very clean and configurable fashion. (Making RPMs "the simple way" in a one-line command.) make_rpm.pl 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/*. PREREQUISITES This script requires the "strict" module. AUTHOR Scott Harrison harris41@msu.edu Please let me know how/if you are finding this script useful and any/all suggestions. -Scott LICENSE 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). This 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. This file is distributed in the hope that it will be useful, but WITH- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The GNU Public License is available for review at http://www.gnu.org/copyleft/gpl.html. For information on the LON-CAPA project, please visit http://www.lon-capa.org/. OSNAMES Linux SCRIPT CATEGORIES UNIX/System_administration perl v5.8.0 2002-11-26 MAKE_RPM-1.17(1)
Last updated: Sat, 16 Dec 2006 14:28:58 -0500

 

Back to Top page
Maintained by Owl River Company -- Comments to: rpm editor, please.