1 # This function builds an RPM from a source tarball that contains a
2 # RPM spec file (i.e., one that can be built using `rpmbuild -ta').
11 removeAttrs args ["vmTools"] //
14 name = name + "-" + diskImage.name + (lib.optionalString (src ? version) "-${src.version}");
19 src=$(findTarball $src)
23 declare -a rpms rpmNames
24 for i in $out/rpms/*/*.rpm; do
25 if echo $i | grep -vq "\.src\.rpm$"; then
26 echo "file rpm $i" >> $out/nix-support/hydra-build-products
28 rpmNames+=("$(rpm -qp "$i")")
32 echo "installing ''${rpms[*]}..."
33 rpm -Up ''${rpms[*]} --excludepath /nix/store
35 eval "$postRPMInstall"
37 echo "uninstalling ''${rpmNames[*]}..."
38 rpm -e ''${rpmNames[*]} --nodeps
40 for i in $out/rpms/*/*.src.rpm; do
41 echo "file srpm $i" >> $out/nix-support/hydra-build-products
44 for rpmdir in $extraRPMs ; do
45 echo "file rpm-extra $(ls $rpmdir/rpms/*/*.rpm | grep -v 'src\.rpm' | sort | head -1)" >> $out/nix-support/hydra-build-products
49 meta = (lib.optionalAttrs (args ? meta) args.meta) // {
50 description = "RPM package for ${diskImage.fullName}";