1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00

vmTools.buildRPM: properly derive source name

This fixes e.g. building the rpm of patchelf as in
pkgs/build-support/vm/test.nix.  The glob won't work if there are
multiple spec files but I don't think rpmbuild would work in that case
either.
This commit is contained in:
Alyssa Ross 2021-12-22 23:29:48 +00:00
parent e0455e1e29
commit 55b883448e
No known key found for this signature in database
GPG key ID: F9DBED4859B271C0

View file

@ -511,7 +511,6 @@ rec {
buildRPM = attrs: runInLinuxImage (stdenv.mkDerivation ({
prePhases = [ "prepareImagePhase" "sysInfoPhase" ];
dontUnpack = true;
dontConfigure = true;
outDir = "rpms/${attrs.diskImage.name}";
@ -536,9 +535,7 @@ rec {
buildPhase = ''
eval "$preBuild"
# Hacky: RPM looks for <basename>.spec inside the tarball, so
# strip off the hash.
srcName="$(stripHash "$src")"
srcName="$(rpmspec --srpm -q --qf '%{source}' *.spec)"
cp "$src" "$srcName" # `ln' doesn't work always work: RPM requires that the file is owned by root
export HOME=/tmp/home