From 55b883448ef0bec402b28a8db9172aaf41c0a941 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 22 Dec 2021 23:29:48 +0000 Subject: [PATCH] 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. --- pkgs/build-support/vm/default.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index a3e7f5f8c556..e466ff7ecce8 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -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 .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