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 = ''
|
2012-07-13 19:58:39 +01:00
|
|
|
. ${./functions.sh}
|
|
|
|
propagateImageName
|
2014-11-05 17:21:44 +00:00
|
|
|
src=$(findTarball $src)
|
2012-07-13 19:58:39 +01:00
|
|
|
'';
|
2008-11-25 00:20:51 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
2012-05-31 14:50:47 +01:00
|
|
|
declare -a rpms rpmNames
|
2008-11-25 00:20:51 +00:00
|
|
|
for i in $out/rpms/*/*.rpm; do
|
2009-10-23 14:41:11 +01:00
|
|
|
if echo $i | grep -vq "\.src\.rpm$"; then
|
2009-10-21 14:34:17 +01:00
|
|
|
echo "file rpm $i" >> $out/nix-support/hydra-build-products
|
2012-05-31 14:50:47 +01:00
|
|
|
rpms+=($i)
|
|
|
|
rpmNames+=("$(rpm -qp "$i")")
|
2012-05-01 21:31:01 +01:00
|
|
|
fi
|
|
|
|
done
|
2012-03-19 13:40:57 +00:00
|
|
|
|
2012-05-31 14:50:47 +01:00
|
|
|
echo "installing ''${rpms[*]}..."
|
2012-07-14 07:20:33 +01:00
|
|
|
rpm -Up ''${rpms[*]} --excludepath /nix/store
|
2012-05-31 14:50:47 +01:00
|
|
|
|
2012-05-01 21:31:01 +01:00
|
|
|
eval "$postRPMInstall"
|
2013-03-01 11:50:29 +00:00
|
|
|
|
2012-05-31 14:50:47 +01:00
|
|
|
echo "uninstalling ''${rpmNames[*]}..."
|
2012-07-14 07:27:09 +01:00
|
|
|
rpm -e ''${rpmNames[*]} --nodeps
|
2012-05-01 21:31:01 +01:00
|
|
|
|
2009-10-21 14:34:17 +01:00
|
|
|
for i in $out/rpms/*/*.src.rpm; do
|
|
|
|
echo "file srpm $i" >> $out/nix-support/hydra-build-products
|
2008-11-25 00:20:51 +00:00
|
|
|
done
|
2013-03-01 11:50:29 +00:00
|
|
|
|
2009-10-01 20:25:08 +01:00
|
|
|
for rpmdir in $extraRPMs ; do
|
2009-10-02 10:49:53 +01: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 20:25:08 +01:00
|
|
|
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 {}) // {
|
2013-03-01 11:50:29 +00:00
|
|
|
description = "RPM package for ${diskImage.fullName}";
|
2008-11-25 00:20:51 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|