2008-11-25 00:20:51 +00:00
|
|
|
# This function builds an RPM from a source tarball that contains a
|
|
|
|
# RPM spec file (i.e., one that can be built using `rpmbuild -ta').
|
|
|
|
|
2009-03-02 13:45:48 +00:00
|
|
|
{ name ? "rpm-build"
|
|
|
|
, diskImage
|
|
|
|
, src, vmTools
|
|
|
|
, ... } @ args:
|
2008-11-25 00:20:51 +00:00
|
|
|
|
|
|
|
vmTools.buildRPM (
|
|
|
|
|
2009-03-02 13:45:48 +00:00
|
|
|
removeAttrs args ["vmTools"] //
|
2008-11-25 00:20:51 +00:00
|
|
|
|
|
|
|
{
|
2009-03-02 14:33:33 +00:00
|
|
|
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
|
2009-03-02 13:45:48 +00:00
|
|
|
|
2008-11-25 00:20:51 +00:00
|
|
|
preBuild = ''
|
|
|
|
ensureDir $out/nix-support
|
|
|
|
cat "$diskImage"/nix-support/full-name > $out/nix-support/full-name
|
|
|
|
|
|
|
|
# If `src' is the result of a call to `makeSourceTarball', then it
|
|
|
|
# has a subdirectory containing the actual tarball(s). If there are
|
|
|
|
# multiple tarballs, just pick the first one.
|
|
|
|
if test -d $src/tarballs; then
|
|
|
|
src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
|
|
|
|
fi
|
|
|
|
''; # */
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for i in $out/rpms/*/*.rpm; do
|
|
|
|
echo "file rpm $i" >> $out/nix-support/hydra-build-products
|
|
|
|
done
|
2009-10-01 19:25:08 +00:00
|
|
|
for rpmdir in $extraRPMs ; do
|
|
|
|
echo "file rpm $(ls $rpmdir/rpms/*/*.rpm | grep -v 'src\.rpm' | sort | head -1)" >> $out/nix-support/hydra-build-products
|
|
|
|
done
|
2008-11-25 00:20:51 +00:00
|
|
|
''; # */
|
|
|
|
|
2008-11-26 14:34:29 +00:00
|
|
|
meta = (if args ? meta then args.meta else {}) // {
|
2009-03-02 13:45:48 +00:00
|
|
|
description = "Build of an RPM package on ${diskImage.fullName} (${diskImage.name})";
|
2008-11-25 00:20:51 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|