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 = ''
|
2012-07-13 22:58:39 +04:00
|
|
|
. ${./functions.sh}
|
|
|
|
propagateImageName
|
2014-11-05 20:21:44 +03:00
|
|
|
src=$(findTarball $src)
|
2012-07-13 22:58:39 +04:00
|
|
|
'';
|
2008-11-25 03:20:51 +03:00
|
|
|
|
|
|
|
postInstall = ''
|
2012-05-31 17:50:47 +04:00
|
|
|
declare -a rpms rpmNames
|
2008-11-25 03:20:51 +03:00
|
|
|
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
|
2012-05-31 17:50:47 +04:00
|
|
|
rpms+=($i)
|
|
|
|
rpmNames+=("$(rpm -qp "$i")")
|
2012-05-02 00:31:01 +04:00
|
|
|
fi
|
|
|
|
done
|
2012-03-19 17:40:57 +04:00
|
|
|
|
2012-05-31 17:50:47 +04:00
|
|
|
echo "installing ''${rpms[*]}..."
|
2012-07-14 10:20:33 +04:00
|
|
|
rpm -Up ''${rpms[*]} --excludepath /nix/store
|
2012-05-31 17:50:47 +04:00
|
|
|
|
2012-05-02 00:31:01 +04:00
|
|
|
eval "$postRPMInstall"
|
2013-03-01 15:50:29 +04:00
|
|
|
|
2012-05-31 17:50:47 +04:00
|
|
|
echo "uninstalling ''${rpmNames[*]}..."
|
2012-07-14 10:27:09 +04:00
|
|
|
rpm -e ''${rpmNames[*]} --nodeps
|
2012-05-02 00:31:01 +04:00
|
|
|
|
2009-10-21 17:34:17 +04:00
|
|
|
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
|
2013-03-01 15:50:29 +04:00
|
|
|
|
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 {}) // {
|
2013-03-01 15:50:29 +04:00
|
|
|
description = "RPM package for ${diskImage.fullName}";
|
2008-11-25 03:20:51 +03:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
)
|