From c2ac2e3f383ebf22a1049ca32f54656f14e56c48 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sat, 30 Sep 2023 23:48:56 +0300 Subject: build: cargo-build-system: Check for pregenerated files. * guix/build/cargo-build-system.scm (check-for-pregenerated-files): New procedure. (%standard-phases): Add 'check-for-pregenerated-files phase between 'unpack and 'unpack-rust-crates. --- guix/build/cargo-build-system.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'guix/build') diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index fbba554e9b..9094ea41d1 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -111,6 +111,13 @@ Cargo.toml file present at its root." (define (rust-package? name) (string-prefix? "rust-" name)) +(define* (check-for-pregenerated-files #:rest _) + "Check the source code for files which are known to generally be bundled +libraries or executables." + (let ((pregenerated-files (find-files "." "\\.(a|dll|exe|lib)$"))) + (when (not (null-list? pregenerated-files)) + (error "Possible pre-generated files found:" pregenerated-files)))) + (define* (configure #:key inputs (vendor-dir "guix-vendor") #:allow-other-keys) @@ -285,7 +292,8 @@ directory = '" port) (replace 'check check) (replace 'install install) (add-after 'build 'package package) - (add-after 'unpack 'unpack-rust-crates unpack-rust-crates) + (add-after 'unpack 'check-for-pregenerated-files check-for-pregenerated-files) + (add-after 'check-for-pregenerated-files 'unpack-rust-crates unpack-rust-crates) (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums patch-cargo-checksums))) (define* (cargo-build #:key inputs (phases %standard-phases) -- cgit v1.2.3