diff --git a/0001-make-test-that-the-config-variables-are-not-empty.patch b/0001-make-test-that-the-config-variables-are-not-empty.patch new file mode 100644 index 0000000..6a0c8cd --- /dev/null +++ b/0001-make-test-that-the-config-variables-are-not-empty.patch @@ -0,0 +1,35 @@ +From 590bbc4941716658901709a42658962d665b06ad Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 26 Oct 2021 16:08:36 +0200 +Subject: [PATCH 1/2] make: test that the config variables are not empty + +If the user does something like "make SYSTEMD_SYSTEM_GENERATOR_DIR=", we +would put things in /. I actually did something like this in an rpm build, +where SYSTEMD_SYSTEM_GENERATOR_DIR is set using rpm macros, and not read +from pkgconfig. We can easily catch this. +--- + Makefile | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/Makefile b/Makefile +index ebbd135878..a15b95f483 100644 +--- a/Makefile ++++ b/Makefile +@@ -21,6 +21,7 @@ program: + @$(CARGO) build --release $(CARGOFLAGS) + + systemd-service: ++ @test -n "$(SYSTEMD_SYSTEM_GENERATOR_DIR)" + @sed -e 's,@SYSTEMD_SYSTEM_GENERATOR_DIR@,$(SYSTEMD_SYSTEM_GENERATOR_DIR),' \ + < units/systemd-zram-setup@.service.in \ + > units/systemd-zram-setup@.service +@@ -36,6 +37,9 @@ clean: + @rm -f units/systemd-zram-setup@.service + + install: build ++ @test -n "$(SYSTEMD_SYSTEM_GENERATOR_DIR)" ++ @test -n "$(SYSTEMD_SYSTEM_UNIT_DIR)" ++ @test -n "$(PREFIX)" + $(INSTALL) -Dpm755 target/release/zram-generator -t $(DESTDIR)$(SYSTEMD_SYSTEM_GENERATOR_DIR)/ + $(INSTALL) -Dpm644 units/systemd-zram-setup@.service -t $(DESTDIR)$(SYSTEMD_SYSTEM_UNIT_DIR)/ + $(INSTALL) -Dpm644 zram-generator.conf.example -t $(DESTDIR)$(PREFIX)/share/doc/zram-generator/ diff --git a/0002-make-print-executed-commands.patch b/0002-make-print-executed-commands.patch new file mode 100644 index 0000000..b596390 --- /dev/null +++ b/0002-make-print-executed-commands.patch @@ -0,0 +1,46 @@ +From 5628c8f28940e30a40e4a5c006e738ad7b9991b6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= +Date: Tue, 26 Oct 2021 16:11:53 +0200 +Subject: [PATCH 2/2] make: print executed commands + +The initial version of the Makefile used @ everywhere, but this hides +errors. If anything, the user should use "make --silent" if they want +to hide the commands. +--- + Makefile | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/Makefile b/Makefile +index a15b95f483..0df1eaad64 100644 +--- a/Makefile ++++ b/Makefile +@@ -18,23 +18,23 @@ export SYSTEMD_UTIL_DIR + build: program systemd-service man + + program: +- @$(CARGO) build --release $(CARGOFLAGS) ++ $(CARGO) build --release $(CARGOFLAGS) + + systemd-service: + @test -n "$(SYSTEMD_SYSTEM_GENERATOR_DIR)" +- @sed -e 's,@SYSTEMD_SYSTEM_GENERATOR_DIR@,$(SYSTEMD_SYSTEM_GENERATOR_DIR),' \ ++ sed -e 's,@SYSTEMD_SYSTEM_GENERATOR_DIR@,$(SYSTEMD_SYSTEM_GENERATOR_DIR),' \ + < units/systemd-zram-setup@.service.in \ + > units/systemd-zram-setup@.service + + man: +- @$(RONN) --organization="zram-generator developers" man/*.md ++ $(RONN) --organization="zram-generator developers" man/*.md + + check: program +- @$(CARGO) test --release $(CARGOFLAGS) ++ $(CARGO) test --release $(CARGOFLAGS) + + clean: +- @$(CARGO) clean +- @rm -f units/systemd-zram-setup@.service ++ $(CARGO) clean ++ rm -f units/systemd-zram-setup@.service + + install: build + @test -n "$(SYSTEMD_SYSTEM_GENERATOR_DIR)" diff --git a/rust-zram-generator.spec b/rust-zram-generator.spec index bd6cd24..dbdc490 100644 --- a/rust-zram-generator.spec +++ b/rust-zram-generator.spec @@ -14,6 +14,9 @@ URL: https://crates.io/crates/zram-generator Source: %{crates_source} Source1: zram-generator.conf +Patch1: 0001-make-test-that-the-config-variables-are-not-empty.patch +Patch2: 0002-make-print-executed-commands.patch + ExclusiveArch: %{rust_arches} %if %{__cargo_skip_build} BuildArch: noarch