2008-11-25 01:20:51 +01: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 14:45:48 +01:00
|
|
|
{ name ? "rpm-build"
|
|
|
|
, diskImage
|
|
|
|
, src, vmTools
|
|
|
|
, ... } @ args:
|
2008-11-25 01:20:51 +01:00
|
|
|
|
|
|
|
vmTools.buildRPM (
|
|
|
|
|
2009-03-02 14:45:48 +01:00
|
|
|
removeAttrs args ["vmTools"] //
|
2008-11-25 01:20:51 +01:00
|
|
|
|
|
|
|
{
|
2009-03-02 15:33:33 +01:00
|
|
|
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
|
2009-03-02 14:45:48 +01:00
|
|
|
|
2008-11-25 01:20:51 +01: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
|
2009-10-21 15:34:17 +02:00
|
|
|
if echo $i | grep -vq '\.src\.rpm$'; then
|
|
|
|
echo "file rpm $i" >> $out/nix-support/hydra-build-products
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
for i in $out/rpms/*/*.src.rpm; do
|
|
|
|
echo "file srpm $i" >> $out/nix-support/hydra-build-products
|
2008-11-25 01:20:51 +01:00
|
|
|
done
|
2009-10-01 21:25:08 +02:00
|
|
|
for rpmdir in $extraRPMs ; do
|
2009-10-02 11:49:53 +02:00
|
|
|
echo "file rpm-extra $(ls $rpmdir/rpms/*/*.rpm | grep -v 'src\.rpm' | sort | head -1)" >> $out/nix-support/hydra-build-products
|
2009-10-01 21:25:08 +02:00
|
|
|
done
|
2008-11-25 01:20:51 +01:00
|
|
|
''; # */
|
|
|
|
|
2008-11-26 15:34:29 +01:00
|
|
|
meta = (if args ? meta then args.meta else {}) // {
|
2009-03-02 14:45:48 +01:00
|
|
|
description = "Build of an RPM package on ${diskImage.fullName} (${diskImage.name})";
|
2008-11-25 01:20:51 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|