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