RpmBuilder
From ControlTier
The intent of this module is to demonstrate how an extended Build workflow can manage packaging the results of the build as an RPM.
While the standard Builder Build workflow assumes the that build script (called by the runBuildScript command) does everything necessary to create the artifacts to be imported to the package repository (by the repoImport command), the RpmBuilder module adds two commands to the workflow to implement this step explicitly.
Firstly, the generateManifest command is used to create a list of the subset of files and directories (determined by the command's include and exclude options) of the builder's base directory (entity.attribute.basedir) to be included in the RPM. The command creates the manifest file in the builder's install root directory called manifest.txt (by default).
Note: the use of the standard base directory (entity.attribute.basedir) to denote the directory hierarchy to include in the RPM is inherently at odds with the normal use of this attribute in a builder (i.e. as the location of the source working files). It would probably be more flexible to either use the install root directory (entity.attribute.targetdir) or a new attribute for this purpose. In its current implementation, the thought is that one can easily package a hierarchy checked out directly from the source code repository as opposed to one created by a build process. Careful structuring of the source base and specification of the inclusion/exclusion attributes can mitigate this inflexibility.
Secondly, the createPackage command is used to invoke the package type's (entity.attribute.packageType - rpm by default) create command supplying the generate manifest file. Naturally, the rpm create command ultimately invokes the rpmbuild command to actually create the RPM in the builder's install root directory (entity.attribute.targetdir) producing the standard layout expected by rpmbuild.
Note: the rpmbuild command is often not part of the default system installation:
[root@centos52 ~]# rpm -q --whatprovides /usr/bin/rpmbuild rpm-build-4.4.2.3-9.el5
Contents |
Limitations
RpmBuilder includes a C utility called "mkmanifest" that needs to be compiled and added to the module before the generateManifest command can be used. Here are instructions to accomplish this assuming you've checked-out the relevant module library source from ModuleForge; for example:
[anthony@centos52 RpmBuilder]$ pwd /home/anthony/ctier/src/elements-3-4-support/modules/RpmBuilder [anthony@centos52 RpmBuilder]$ svn info . Path: . URL: https://moduleforge.svn.sourceforge.net/svnroot/moduleforge/controltier/branches/controltier-3-4-support/elements/modules/RpmBuilder Repository Root: https://moduleforge.svn.sourceforge.net/svnroot/moduleforge Repository UUID: 3ed12e13-7237-0410-b9af-b7dc6c7a317f Revision: 1710 Node Kind: directory Schedule: normal Last Changed Author: moseslei Last Changed Rev: 1537 Last Changed Date: 2009-05-28 17:12:24 -0700 (Thu, 28 May 2009)
... and have the appropriate C-compiler to hand:
[anthony@centos52 src]$ gcc --version gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44) Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- Locate the mkmanifest source:
[anthony@centos52 src]$ pwd /home/anthony/ctier/src/elements-3-4-support/modules/RpmBuilder/src
- Compile and check the utility:
[anthony@centos52 src]$ make rm -f mkmanifest cc mkmanifest.c -o mkmanifest cp mkmanifest ../bin [anthony@centos52 src]$ ../bin/mkmanifest --help Usage: mkmanifest [OPTIONS] -b basedir options: --basedir -b <dir> : base directory from which to create the manifest --excludes -e <regex> : POSIX.2 extended regular expression indicating paths relative to the basedir to exclude --includes -i <regex> : POSIX.2 extended regular expression indicating paths relative to the basedir to include --attributes -a : include the RPM %attr directive for each entry in the manifest based on the permissions of the source file --manifest -m <file> : name of the manifest file to be created for inclusion in an RPM specification %files section --version -V : version of mkmanifest --verbose -v : verbose output --help -h : this help screen
- Build and upload the module to Workbench:
[anthony@centos52 src]$ ctl -p development -t ProjectBuilder -o elements-3-4-support -c build-type -- -type RpmBuilder -upload Created dir: /home/anthony/ctier/target/elements-3-4-support/modules Building type using the buildmodule.xml via classloader converting type.xml for module: RpmBuilder generating handlers... packaging module: RpmBuilder Copying 1 file to /home/anthony/ctier/src/elements-3-4-support/modules/RpmBuilder Copying 1 file to /home/anthony/ctier/src/elements-3-4-support/modules/RpmBuilder Deleting: /home/anthony/ctier/src/elements-3-4-support/modules/RpmBuilder/module.properties.temp Building jar: /home/anthony/ctier/target/elements-3-4-support/modules/RpmBuilder-1.jar Uploading built module to server ... processing files in directory: /home/anthony/ctier/target/elements-3-4-support/modules scanning for files matching pattern: (RpmBuilder)-([0-9]+)\.jar Uploading jar: /home/anthony/ctier/target/elements-3-4-support/modules/RpmBuilder-1.jar to server: 'centos52' ...
Examples
Basic example
The minimal RpmBuilder object definition is something like this:
<?xml version="1.0"?>
<!DOCTYPE project PUBLIC "-//ControlTier Software Inc.//DTD Project Document 1.0//EN" "project.dtd">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- RpmBuilder example object XML definition file -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<project>
<!-- Builder settings: -->
<setting type="BuilderBuildFile" name="sampleRpmBuilder" description="Sample RPM build target" settingValue="build.xml"/>
<setting type="BuilderBuildTarget" name="sampleRpmBuilder" description="Sample RPM build target" settingValue="all"/>
<setting type="BuilderPackageFilebase" name="sampleRpmBuilder" description="Sample RPM file base name" settingValue="sampleRpm"/>
<!-- Build environment updaters, sites and services: -->
<deployment type="RpmBuilder" name="sampleRpmBuilder" basedir="${modules.dir}/RpmBuilder/sample" installRoot="${user.home}/RPMS/sampleRpm" description="Sample RPM builder" startuprank="1">
<resources replace="true">
<resource type="BuilderBuildFile" name="sampleRpmBuilder"/>
<resource type="BuilderBuildTarget" name="sampleRpmBuilder"/>
<resource type="BuilderPackageFilebase" name="sampleRpmBuilder"/>
</resources>
</deployment>
</project>
You can see that three settings are required to make the Build workflow work:
- Specify the build file for the runBuildScript command to call
- Set the target for the build
- Give the resultant RPM a "base" file name
The "basedir" decides which directory is packaged and the "installRoot" specifies the directory in which the RPM is setup and built.
Here's sample output from the command:
[anthony@centos52 ~]$ ctl -p development -t RpmBuilder -o sampleRpmBuilder -c Build -- -buildstamp 1.2.3-1
Start: "Run the build cycle." commands: scmCheckout,setBuildstamp,runBuildScript,generateManifest,createPackage,repoImport
begin workflow command (1/6) -> "scmCheckout -buildstamp 1.2.3-1" ...
scmCheckout parameters: {basedir="/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample", connection="", module="", label="", scmcommand="checkout" }
[command.timer.Builder.scmCheckout: 0.002 sec]
end workflow command (1/6) -> "scmCheckout -buildstamp 1.2.3-1"
begin workflow command (2/6) -> "setBuildstamp -buildstamp 1.2.3-1" ...
Using provided buildstamp "1.2.3-1"
[command.timer.RpmBuilder.setBuildstamp: 0.003 sec]
end workflow command (2/6) -> "setBuildstamp -buildstamp 1.2.3-1"
begin workflow command (3/6) -> "runBuildScript -buildstamp 1.2.3-1" ...
Exiting command. buildfile did not exist: 'build.xml'"
[command.timer.Builder.runBuildScript: 0.003 sec]
end workflow command (3/6) -> "runBuildScript -buildstamp 1.2.3-1"
begin workflow command (4/6) -> "generateManifest -buildstamp 1.2.3-1" ...
Created dir: /home/anthony/RPMS/sampleRpm
[command.timer.RpmBuilder.generateManifest: 0.083 sec]
end workflow command (4/6) -> "generateManifest -buildstamp 1.2.3-1"
begin workflow command (5/6) -> "createPackage -buildstamp 1.2.3-1" ...
Getting: http://centos52:8080/jackrabbit/repository/workbench/development/publish/modules/rpm-head.jar
To: /home/anthony/ctier/ctl/var/tmp/downloads/development/rpm-head.jar
Not modified - so not downloaded
Deleting directory /home/anthony/ctier/ctl/depots/development/modules/rpm
Created dir: /home/anthony/ctier/ctl/depots/development/modules/rpm
Expanding: /home/anthony/ctier/ctl/var/tmp/downloads/development/rpm-head.jar into /home/anthony/ctier/ctl/depots/development/modules/rpm
Attempting to get Package-head.jar ...
Getting: http://centos52:8080/jackrabbit/repository/workbench/development/publish/modules/Package-head.jar
To: /home/anthony/ctier/ctl/var/tmp/downloads/development/Package-head.jar
Not modified - so not downloaded
Deleting directory /home/anthony/ctier/ctl/depots/development/modules/Package
Created dir: /home/anthony/ctier/ctl/depots/development/modules/Package
Expanding: /home/anthony/ctier/ctl/var/tmp/downloads/development/Package-head.jar into /home/anthony/ctier/ctl/depots/development/modules/Package
Created dir: /home/anthony/RPMS/sampleRpm/SPECS
Created dir: /home/anthony/RPMS/sampleRpm/RPMS
Copying 1 file to /home/anthony/RPMS/sampleRpm/SPECS
Building the RPM based on the sampleRpm.spec file
Building target platforms: noarch
Building for target noarch
Processing files: sampleRpm-1.2.3-1
Requires(rpmlib): rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Wrote: /home/anthony/RPMS/sampleRpm/RPMS/noarch/sampleRpm-1.2.3-1.noarch.rpm
[command.timer.RpmBuilder.createPackage: 1.116 sec]
end workflow command (5/6) -> "createPackage -buildstamp 1.2.3-1"
begin workflow command (6/6) -> "repoImport -buildstamp 1.2.3-1" ...
Created dir: /home/anthony/ctier/ctl/depots/development/deployments/RpmBuilder/sampleRpmBuilder/tmp/Builder-repoImport-20090911212743
Condition: isProcessableWithoutExistingPropfile result: true
opts.propfile set to: autogenerated-builder.properties
Creating new property file: /home/anthony/ctier/ctl/depots/development/deployments/RpmBuilder/sampleRpmBuilder/tmp/Builder-repoImport-20090911212743/import-count.properties
processing files in directory: '/home/anthony/RPMS/sampleRpm' matching: '(sampleRpm)(?:-1.2.3-1)?\.(noarch.rpm)$' ...
processing matched file: RPMS/noarch/sampleRpm-1.2.3-1.noarch.rpm
Auto-generated builder properties file created: /home/anthony/RPMS/sampleRpm/RPMS/noarch/autogenerated-builder.properties...
Copying 1 file to /home/anthony/RPMS/sampleRpm/RPMS/noarch
Updating property file: /home/anthony/ctier/ctl/depots/development/deployments/RpmBuilder/sampleRpmBuilder/tmp/Builder-repoImport-20090911212743/import-count.properties
Copying 1 file to /home/anthony/ctier/ctl/depots/development/modules/Builder/commands
Getting: http://centos52:8080/jackrabbit/repository/workbench/development/publish/modules/rpm-head.jar
To: /home/anthony/ctier/ctl/var/tmp/downloads/development/rpm-head.jar
Not modified - so not downloaded
Deleting directory /home/anthony/ctier/ctl/depots/development/modules/rpm
Created dir: /home/anthony/ctier/ctl/depots/development/modules/rpm
Expanding: /home/anthony/ctier/ctl/var/tmp/downloads/development/rpm-head.jar into /home/anthony/ctier/ctl/depots/development/modules/rpm
Attempting to get Package-head.jar ...
Getting: http://centos52:8080/jackrabbit/repository/workbench/development/publish/modules/Package-head.jar
To: /home/anthony/ctier/ctl/var/tmp/downloads/development/Package-head.jar
Not modified - so not downloaded
Deleting directory /home/anthony/ctier/ctl/depots/development/modules/Package
Created dir: /home/anthony/ctier/ctl/depots/development/modules/Package
Expanding: /home/anthony/ctier/ctl/var/tmp/downloads/development/Package-head.jar into /home/anthony/ctier/ctl/depots/development/modules/Package
uploading file: /home/anthony/RPMS/sampleRpm/RPMS/noarch/sampleRpm-1.2.3-1.noarch.rpm to: http://centos52:8080/jackrabbit/repository/workbench/pkgs/development/rpm/noarch.rpms/sampleRpm-1.2.3-1.noarch.rpm...
Puted 1 file to http://centos52:8080/jackrabbit/repository/workbench/pkgs/development/rpm/noarch.rpms/sampleRpm-1.2.3-1.noarch.rpm
Creating new property file: /home/anthony/ctier/ctl/depots/development/deployments/RpmBuilder/sampleRpmBuilder/tmp/Builder-repoImport-20090911212743/import-list.properties
Deleting: /home/anthony/ctier/ctl/depots/development/modules/Builder/commands/entity1099091901.properties
Current count: 1
Batch request performed successfully.
Current count: 1
[command.timer.Builder.repoImport: 6.162 sec]
end workflow command (6/6) -> "repoImport -buildstamp 1.2.3-1"
[command.timer.development.RpmBuilder.Build: 10.351 sec]
Workflow completed. execution time: 10.351 sec
Note: the buildstamp must be specified in the form that RPMs require (e.g. "1.2.3-1" ... numerical version and a release number).
Here's what the resultant RPMS directory looks like:
[anthony@centos52 ~]$ find RPMS/ RPMS/ RPMS/sampleRpm RPMS/sampleRpm/manifest.txt RPMS/sampleRpm/SPECS RPMS/sampleRpm/SPECS/sampleRpm.spec RPMS/sampleRpm/RPMS RPMS/sampleRpm/RPMS/noarch RPMS/sampleRpm/RPMS/noarch/sampleRpm-1.2.3-1.noarch.rpm RPMS/sampleRpm/RPMS/noarch/autogenerated-builder.properties
The manifest file created by generateManifest:
[anthony@centos52 ~]$ cat RPMS/sampleRpm/manifest.txt %dir "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample" %dir "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2/file21" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2/file22" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2/file23" %dir "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir1" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir1/file12" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir1/file11" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir1/file13" %dir "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3/file33" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3/file32" "/home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3/file31"
... and the SPEC file created from a template kept in the rpm module:
[anthony@centos52 ~]$ cat RPMS/sampleRpm/SPECS/sampleRpm.spec
#
# One-line summary description of the package:
#
Summary: sampleRpm binary RPM package
#
# Name of the package:
#
Name: sampleRpm
#
# Version number ordering:
#
# Epoch:
#
# Package version number:
#
Version: 1.2.3
#
# Package release number:
#
Release: 1
#
# Package builder tags:
#
Vendor: none
URL: none
# Copyright: none
Packager: none
Distribution: none
Group: none
License: none
#
# Dependency tags:
#
# Requires:
# Provides:
# Obsoletes:
# Conflicts:
#
# Explictly turn off requirements checking:
#
AutoReq: 0
#
# Source of the files to include in the package:
#
# Source: %{_topdir}/SOURCES/sampleRpm.tar.gz
#
# Relocatable package prefix:
#
Prefix: /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample
#
# Detailed description of the package:
#
%description
This is version 1.2.3 of the sampleRpm binary RPM package built on centos52 using the /home/anthony/RPMS/sampleRpm/manifest.txt file list.
The package is relocatable from its base directory of /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample.
#
# Prepare for the build:
#
# %prep
#
# Build from source:
#
# %build
#
# Install the built files:
#
# %install
#
# Clean up after the build:
#
# %clean
#
# Select file for the binary RPM:
#
%files -f /home/anthony/RPMS/sampleRpm/manifest.txt
%defattr(-,root,root)
%undefine __check_files
Here's the lowdown on the rpm itself:
[anthony@centos52 ~]$ rpm -qi -p RPMS/sampleRpm/RPMS/noarch/sampleRpm-1.2.3-1.noarch.rpm Name : sampleRpm Relocations: /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample Version : 1.2.3 Vendor: none Release : 1 Build Date: Fri 11 Sep 2009 09:27:43 PM PDT Install Date: (not installed) Build Host: localhost.localdomain Group : none Source RPM: sampleRpm-1.2.3-1.src.rpm Size : 1863 License: none Signature : (none) Packager : none URL : none Summary : sampleRpm binary RPM package Description : This is version 1.2.3 of the sampleRpm binary RPM package built on centos52 using the /home/anthony/RPMS/sampleRpm/manifest.txt file list. The package is relocatable from its base directory of /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample. [anthony@centos52 ~]$ rpm -ql -p RPMS/sampleRpm/RPMS/noarch/sampleRpm-1.2.3-1.noarch.rpm /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir1 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir1/file11 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir1/file12 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir1/file13 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2/file21 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2/file22 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2/file23 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3/file31 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3/file32 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3/file33
Specifying includes and excludes
This example goes a step further to use the includes and excludes settings to select a subset of the files and directories beneath the base directory:
[anthony@centos52 objects]$ cat sample.xml
<?xml version="1.0"?>
<!DOCTYPE project PUBLIC "-//ControlTier Software Inc.//DTD Project Document 1.0//EN" "project.dtd">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- RpmBuilder example object XML definition file -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<project>
<!-- Builder settings: -->
<setting type="BuilderBuildFile" name="sampleRpmBuilder" description="Sample RPM build target" settingValue="build.xml"/>
<setting type="BuilderBuildTarget" name="sampleRpmBuilder" description="Sample RPM build target" settingValue="all"/>
<setting type="BuilderPackageFilebase" name="sampleRpmBuilder" description="Sample RPM file base name" settingValue="sampleRpm"/>
<setting type="BuilderPackageIncludes" name="sampleRpmBuilder" description="Sample RPM include regex" settingValue="dir2|dir3"/>
<setting type="BuilderPackageExcludes" name="sampleRpmBuilder" description="Sample RPM exclude regex" settingValue="file[23]1"/>
<!-- Build environment updaters, sites and services: -->
<deployment type="RpmBuilder" name="sampleRpmBuilder" basedir="${modules.dir}/RpmBuilder/sample" installRoot="${user.home}/RPMS/sampleRpm" description="Sample RPM builder" startuprank="1">
<resources replace="true">
<resource type="BuilderBuildFile" name="sampleRpmBuilder"/>
<resource type="BuilderBuildTarget" name="sampleRpmBuilder"/>
<resource type="BuilderPackageFilebase" name="sampleRpmBuilder"/>
<resource type="BuilderPackageIncludes" name="sampleRpmBuilder"/>
<resource type="BuilderPackageExcludes" name="sampleRpmBuilder"/>
</resources>
</deployment>
</project>
... and here's the contents of the resultant RPM:
[anthony@centos52 ~]$ rpm -ql -p RPMS/sampleRpm/RPMS/noarch/sampleRpm-1.2.3-1.noarch.rpm /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2/file22 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir2/file23 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3/file32 /home/anthony/ctier/ctl/depots/development/modules/RpmBuilder/sample/dir3/file33
Web content RPM example
This example demonstrates the use of the requires and provides attributes as part of on an RpmBuilder implementation that packages the contents of the default Linux Apache web server document root (/var/www/html). The RpmBuilder object definition is something like this:
<?xml version="1.0"?>
<!DOCTYPE project PUBLIC "-//ControlTier Software Inc.//DTD Project Document 1.0//EN" "project.dtd">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- RpmBuilder example object XML definition file -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<project>
<!-- Builder settings: -->
<setting type="BuilderBuildFile" name="sampleRpmBuilder" description="Sample RPM build target" settingValue="build.xml"/>
<setting type="BuilderBuildTarget" name="sampleRpmBuilder" description="Sample RPM build target" settingValue="all"/>
<setting type="BuilderPackageFilebase" name="sampleWwwRpmBuilder" description="Sample web content RPM file base name" settingValue="sampleWwwRpm"/>
<setting type="BuilderPackageInstallroot" name="sampleWwwRpmBuilder" description="Sample web content RPM builder file install root" settingValue="/var/www/html"/>
<setting type="RpmRequires" name="sampleWwwRpmBuilder" description="Sample web content RPM builder package requires" settingValue="httpd"/>
<setting type="RpmProvides" name="sampleWwwRpmBuilder" description="Sample web content RPM builder package provides" settingValue="website"/>
<setting type="RpmAutoreq" name="sampleWwwRpmBuilder" description="Sample web content RPM builder automatic requires processing check" settingValue="1"/>
<!-- Build environment updaters, sites and services: -->
<deployment type="RpmBuilder" name="sampleWwwRpmBuilder" basedir="/var/www/html" installRoot="${user.home}/RPMS/sampleWwwRpm" description="Sample web content RPM builder" startuprank="1">
<resources replace="true">
<resource type="BuilderBuildFile" name="sampleRpmBuilder"/>
<resource type="BuilderBuildTarget" name="sampleRpmBuilder"/>
<resource type="BuilderPackageFilebase" name="sampleWwwRpmBuilder"/>
<resource type="BuilderPackageInstallroot" name="sampleWwwRpmBuilder"/>
<resource type="RpmRequires" name="sampleWwwRpmBuilder"/>
<resource type="RpmProvides" name="sampleWwwRpmBuilder"/>
<resource type="RpmAutoreq" name="sampleWwwRpmBuilder"/>
</resources>
</deployment>
</project>
You can see the three extra settings that manage package dependencies:
- Specify which other RPMs this RPM depends on for successful installation
- Define "virtual" package categories that this RPM provides
- Turn on automatic requirements checking in the RPM (it is off by default)
Here's sample output from the command:
[anthony@centos54 ctl]$ ctl -p Development -t RpmBuilder -o sampleWwwRpmBuilder -c Build -- -buildstamp 1.0-1
Start: "Run the build cycle." commands: scmCheckout,setBuildstamp,runBuildScript,generateManifest,createPackage,repoImport
begin workflow command (1/6) -> "scmCheckout -buildstamp 1.0-1" ...
scmCheckout parameters: {basedir="/var/www/html", connection="", module="", label="", scmcommand="checkout" }
[command.timer.Builder.scmCheckout: 0.002 sec]
end workflow command (1/6) -> "scmCheckout -buildstamp 1.0-1"
begin workflow command (2/6) -> "setBuildstamp -buildstamp 1.0-1" ...
Using provided buildstamp "1.0-1"
[command.timer.RpmBuilder.setBuildstamp: 0.004 sec]
end workflow command (2/6) -> "setBuildstamp -buildstamp 1.0-1"
begin workflow command (3/6) -> "runBuildScript -buildstamp 1.0-1" ...
Exiting command. buildfile did not exist: 'build.xml'"
[command.timer.Builder.runBuildScript: 0.004 sec]
end workflow command (3/6) -> "runBuildScript -buildstamp 1.0-1"
begin workflow command (4/6) -> "generateManifest -buildstamp 1.0-1" ...
[command.timer.RpmBuilder.generateManifest: 0.140 sec]
end workflow command (4/6) -> "generateManifest -buildstamp 1.0-1"
begin workflow command (5/6) -> "createPackage -buildstamp 1.0-1" ...
Getting: http://centos54:8080/jackrabbit/repository/workbench/Development/publish/modules/rpm-head.jar
To: /opt/ctier/ctl/var/tmp/downloads/Development/rpm-head.jar
Created dir: /opt/ctier/ctl/depots/Development/modules/rpm
Expanding: /opt/ctier/ctl/var/tmp/downloads/Development/rpm-head.jar into /opt/ctier/ctl/depots/Development/modules/rpm
Attempting to get Package-head.jar ...
Getting: http://centos54:8080/jackrabbit/repository/workbench/Development/publish/modules/Package-head.jar
To: /opt/ctier/ctl/var/tmp/downloads/Development/Package-head.jar
Created dir: /opt/ctier/ctl/depots/Development/modules/Package
Expanding: /opt/ctier/ctl/var/tmp/downloads/Development/Package-head.jar into /opt/ctier/ctl/depots/Development/modules/Package
Created dir: /home/anthony/RPMS/sampleWwwRpm/SPECS
Created dir: /home/anthony/RPMS/sampleWwwRpm/RPMS
Created dir: /home/anthony/RPMS/sampleWwwRpm/BUILD
Copying 1 file to /home/anthony/RPMS/sampleWwwRpm/SPECS
Building the RPM based on the sampleWwwRpm.spec file
Building target platforms: noarch
Building for target noarch
Processing files: sampleWwwRpm-1.0-1
Provides: Explictly checking: off requirements turn website${line.seperator}#
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
Requires: httpd
Wrote: /home/anthony/RPMS/sampleWwwRpm/RPMS/noarch/sampleWwwRpm-1.0-1.noarch.rpm
[command.timer.RpmBuilder.createPackage: 2.845 sec]
end workflow command (5/6) -> "createPackage -buildstamp 1.0-1"
begin workflow command (6/6) -> "repoImport -buildstamp 1.0-1" ...
Created dir: /opt/ctier/ctl/depots/Development/deployments/RpmBuilder/sampleWwwRpmBuilder/tmp/Builder-repoImport-20091107165832
Condition: isProcessableWithoutExistingPropfile result: true
opts.propfile set to: autogenerated-builder.properties
Creating new property file: /opt/ctier/ctl/depots/Development/deployments/RpmBuilder/sampleWwwRpmBuilder/tmp/Builder-repoImport-20091107165832/import-count.properties
processing files in directory: '/home/anthony/RPMS/sampleWwwRpm' matching: '(sampleWwwRpm)(?:-1.0-1)?\.(noarch.rpm)$' ...
processing matched file: RPMS/noarch/sampleWwwRpm-1.0-1.noarch.rpm
Auto-generated builder properties file created: /home/anthony/RPMS/sampleWwwRpm/RPMS/noarch/autogenerated-builder.properties...
Copying 1 file to /home/anthony/RPMS/sampleWwwRpm/RPMS/noarch
Updating property file: /opt/ctier/ctl/depots/Development/deployments/RpmBuilder/sampleWwwRpmBuilder/tmp/Builder-repoImport-20091107165832/import-count.properties
Copying 1 file to /opt/ctier/ctl/depots/Development/modules/Builder/commands
Getting: http://centos54:8080/jackrabbit/repository/workbench/Development/publish/modules/rpm-head.jar
To: /opt/ctier/ctl/var/tmp/downloads/Development/rpm-head.jar
Not modified - so not downloaded
rpm up to date
Attempting to get Package-head.jar ...
Getting: http://centos54:8080/jackrabbit/repository/workbench/Development/publish/modules/Package-head.jar
To: /opt/ctier/ctl/var/tmp/downloads/Development/Package-head.jar
Not modified - so not downloaded
Package up to date
uploading file: /home/anthony/RPMS/sampleWwwRpm/RPMS/noarch/sampleWwwRpm-1.0-1.noarch.rpm to: http://centos54:8080/jackrabbit/repository/workbench/pkgs/Development/rpm/noarch.rpms/sampleWwwRpm-1.0-1.noarch.rpm...
Puted 1 file to http://centos54:8080/jackrabbit/repository/workbench/pkgs/Development/rpm/noarch.rpms/sampleWwwRpm-1.0-1.noarch.rpm
Creating new property file: /opt/ctier/ctl/depots/Development/deployments/RpmBuilder/sampleWwwRpmBuilder/tmp/Builder-repoImport-20091107165832/import-list.properties
Deleting: /opt/ctier/ctl/depots/Development/modules/Builder/commands/entity52776743.properties
Current count: 1
Batch request performed successfully.
Current count: 1
[command.timer.Builder.repoImport: 4.877 sec]
end workflow command (6/6) -> "repoImport -buildstamp 1.0-1"
[command.timer.Development.RpmBuilder.Build: 13.789 sec]
Workflow completed. execution time: 13.789 sec
Note: the buildstamp must be specified in the form that RPMs require (e.g. "1.0-1" ... numerical version and a release number).
Here's what the resultant RPMS directory looks like:
[anthony@centos54 ~]$ find RPMS/ RPMS/ RPMS/sampleWwwRpm RPMS/sampleWwwRpm/BUILD RPMS/sampleWwwRpm/RPMS RPMS/sampleWwwRpm/RPMS/noarch RPMS/sampleWwwRpm/RPMS/noarch/sampleWwwRpm-1.0-1.noarch.rpm RPMS/sampleWwwRpm/RPMS/noarch/autogenerated-builder.properties RPMS/sampleWwwRpm/manifest.txt RPMS/sampleWwwRpm/SPECS RPMS/sampleWwwRpm/SPECS/sampleWwwRpm.spec
The manifest file created by generateManifest:
[anthony@centos54 ~]$ cat RPMS/sampleWwwRpm/manifest.txt %dir "/var/www/html" "/var/www/html/index.html"
... and the SPEC file created from a template kept in the rpm module:
[anthony@centos54 ~]$ cat RPMS/sampleWwwRpm/SPECS/sampleWwwRpm.spec
#
# One-line summary description of the package:
#
Summary: sampleWwwRpm binary RPM package
#
# Name of the package:
#
Name: sampleWwwRpm
#
# Version number ordering:
#
# Epoch:
#
# Package version number:
#
Version: 1.0
#
# Package release number:
#
Release: 1
#
# Package builder tags:
#
Vendor: none
URL: none
# Copyright: none
Packager: none
Distribution: none
Group: root
License: none
#
# Dependency tags:
#
# Requires:
# Provides:
# Obsoletes:
# Conflicts:
Requires: httpd
Provides: website
#
# Manage requirements checking:
#
AutoReq: 1
#
# Source of the files to include in the package:
#
# Source: %{_topdir}/SOURCES/sampleWwwRpm.tar.gz
#
# Relocatable package prefix:
#
Prefix: /var/www/html
#
# Detailed description of the package:
#
%description
This is version 1.0 of the sampleWwwRpm binary RPM package built on centos54 using the /home/anthony/RPMS/sampleWwwRpm/manifest.txt file list.
The package is relocatable from its base directory of /var/www/html.
#
# Prepare for the build:
#
# %prep
#
# Build from source:
#
# %build
#
# Install the built files:
#
# %install
#
# Clean up after the build:
#
# %clean
#
# Select file for the binary RPM:
#
%files -f /home/anthony/RPMS/sampleWwwRpm/manifest.txt
%defattr(-,root,root)
%undefine __check_files
... note the Requires, Provides and Autoreq settings. Here's the lowdown on the rpm itself:
[anthony@centos54 ~]$ rpm -qi -p RPMS/sampleWwwRpm/RPMS/noarch/sampleWwwRpm-1.0-1.noarch.rpm Name : sampleWwwRpm Relocations: /var/www/html Version : 1.0 Vendor: none Release : 1 Build Date: Sat 07 Nov 2009 05:02:28 PM PST Install Date: (not installed) Build Host: localhost.localdomain Group : root Source RPM: sampleWwwRpm-1.0-1.src.rpm Size : 8327 License: none Signature : (none) Packager : none URL : none Summary : sampleWwwRpm binary RPM package Description : This is version 1.0 of the sampleWwwRpm binary RPM package built on centos54 using the /home/anthony/RPMS/sampleWwwRpm/manifest.txt file list. The package is relocatable from its base directory of /var/www/html. [anthony@centos54 ~]$ rpm -q --requires -p RPMS/sampleWwwRpm/RPMS/noarch/sampleWwwRpm-1.0-1.noarch.rpm httpd rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 [anthony@centos54 ~]$ rpm -q --provides -p RPMS/sampleWwwRpm/RPMS/noarch/sampleWwwRpm-1.0-1.noarch.rpm website sampleWwwRpm = 1.0-1 [anthony@centos54 ~]$ rpm -ql -p RPMS/sampleWwwRpm/RPMS/noarch/sampleWwwRpm-1.0-1.noarch.rpm /var/www/html /var/www/html/index.html
| ||||||||||||||||||||||||||

