NAME

RPM::Make - cleanly generate an RPM

SYNOPSIS

    use RPM::Make;

    my @filelist=('tmproot/file1.txt',

		  'tmproot/file2.txt',

		  'tmproot/file3.txt',

		  'tmproot/file4.txt');

    my %doc; my %conf; my %confnoreplace; my %metadata;

    $doc{'tmproot/file1.txt'}=1;

    $conf{'tmproot/file2.txt'}=1;

    $confnoreplace{'tmproot/file3.txt'}=1;

    my $pathprefix='tmproot';

    my $tag='Test';

    my $version='0.1';
    my $release='1';

    %metadata=(
	       'vendor'=>'Laboratory for GeeksLikeMeNeedExercise Medicine',
	       'summary'=>'Test Software Package',
	       'name'=>$tag,
	       'copyrightname'=>'...',
	       'group'=>'Utilities/System',
	       'AutoReqProv'=>'no',
	       'requires'=>[('PreReq: setup',
			     'PreReq: passwd',
			     'PreReq: util-linux'
			     )],
	       'description'=>'This package is generated by RPM::Make. '.
                      'This implements the '.$tag.' software package',
       'pre'=>'You are installing a package built by RPM::Make; '.
              'RPM::Make is available at http://www.cpan.org/.',
	       );

    my $buildloc='TestBuildLoc';
    RPM::Make::execute($tag,$version,$release,$buildloc,$pathprefix,
		       \@filelist,\%doc,\%conf,\%confnoreplace,
		       \%metadata);

    # execution can also be broken down into these three steps
    RPM::Make::rpmsrc($tag,$version,$release,$buildloc,$pathprefix,
 	              \@filelist,\%doc,\%conf,\%confnoreplace,
		      \%metadata);

    RPM::Make::compilerpm($buildloc,$metadata{'name'},$version,$release,'i386',
			  $currentdir,$invokingdir);

    RPM::Make::cleanbuildloc($buildloc);

DESCRIPTION

Automatically generate an RPM software package from a list of files.

RPM::Make 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!)

RPM::Make 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/*.

RPM::Make accepts five kinds of information, three of which are significant:

  • (significant) a list of files that are to be part of the software package;

  • (significant) the filesystem location of these files

  • (significant) a descriptive tag and a version tag for the naming of the RPM software package;

  • documentation and configuration files;

  • and additional metadata associated with the RPM software package.

When using RPM::Make::execute, a temporary directory named $buildloc is

  • generated under the directory from which you run your script.

  • then deleted after the *.rpm file is generated.

The RPM will typically be named "$metadata{'name'}-$version-$release.i386.rpm". If $metadata{'name'} is not specified, then $tag is used.

Here are some of the items are generated inside the $buildloc directory during the construction of an RPM:

  • RPM .spec file (./$buildloc/SPECS/$name-$version.spec)

  • RPM Makefile (./$buildloc/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:

    • SOURCE directory: ./$buildloc/BinaryRoot/

    • TARGET directory: ./$buildloc/BuildRoot/

  • BinaryRootMakefile (./$buildloc/BinaryRootMakefile)

    This is the Makefile that this script creates and calls to build the $buildloc/BinaryRoot/ directory from the existing filesystem. The following directories are generated and/or used:

    • SOURCE directory: / (your entire filesystem)

    • TARGET directory: ./$buildloc/BinaryRoot/

The final output of RPM::Make::execute is a binary .rpm file. The ./buildloc directory is deleted (along with the .src.rpm file). The typical file name generated by RPM::Make is $tag-$version-$release.i386.rpm.

RPM::Make is compatible with either rpm version 3.* or rpm version 4.*.

README

Automatically generate an RPM software package from a list of files.

RPM::Make builds the RPM in a very clean and configurable fashion without using /usr/src/redhat or any other filesystem dependencies.

RPM::Make generates and then deletes temporary files (and binary root directory tree) to build an RPM with.

RPM::Make was originally based on a script "make_rpm.pl" available at http://www.cpan.org/scripts/.

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 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.

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/.

STATUS

This module is new. It is based on a well-tested (and well-used) script that I wrote (make_rpm.pl; available at http://www.cpan.org/scripts/).

OSNAMES

Linux