2008-11-25 03:20:51 +03: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 16:45:48 +03:00
|
|
|
{ name ? "rpm-build"
|
|
|
|
, diskImage
|
|
|
|
, src, vmTools
|
|
|
|
, ... } @ args:
|
2008-11-25 03:20:51 +03:00
|
|
|
|
|
|
|
vmTools.buildRPM (
|
|
|
|
|
2009-03-02 16:45:48 +03:00
|
|
|
removeAttrs args ["vmTools"] //
|
2008-11-25 03:20:51 +03:00
|
|
|
|
|
|
|
{
|
2009-03-02 17:33:33 +03:00
|
|
|
name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
|
2009-03-02 16:45:48 +03:00
|
|
|
|
2008-11-25 03:20:51 +03: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-23 17:41:11 +04:00
|
|
|
if echo $i | grep -vq "\.src\.rpm$"; then
|
2009-10-21 17:34:17 +04:00
|
|
|
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 03:20:51 +03:00
|
|
|
done
|
2009-10-01 23:25:08 +04:00
|
|
|
for rpmdir in $extraRPMs ; do
|
2009-10-02 13:49:53 +04: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 23:25:08 +04:00
|
|
|
done
|
2008-11-25 03:20:51 +03:00
|
|
|
''; # */
|
|
|
|
|
2008-11-26 17:34:29 +03:00
|
|
|
meta = (if args ? meta then args.meta else {}) // {
|
2009-03-02 16:45:48 +03:00
|
|
|
description = "Build of an RPM package on ${diskImage.fullName} (${diskImage.name})";
|
2008-11-25 03:20:51 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|