Version 1.1.0
This commit is contained in:
parent
2227078dc4
commit
85d12c64a0
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,3 +7,4 @@
|
||||
/zram-generator-0.3.1.crate
|
||||
/zram-generator-0.3.2.crate
|
||||
/zram-generator-1.0.1.crate
|
||||
/zram-generator-1.1.0.crate
|
||||
|
@ -1,40 +0,0 @@
|
||||
From e03d06a4a631aec0cd0d9ae88ef75d374055e45e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Tue, 26 Oct 2021 16:08:36 +0200
|
||||
Subject: [PATCH 1/5] 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_UTIL_DIR is set using rpm macros, and not read from pkgconfig,
|
||||
and the variable was defined but empty. We should catch this to avoid stupid
|
||||
operator mistakes.
|
||||
---
|
||||
Makefile | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index ebbd135878..49baab926f 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -18,9 +18,11 @@ export SYSTEMD_UTIL_DIR
|
||||
build: program systemd-service man
|
||||
|
||||
program:
|
||||
+ @test -n "$(SYSTEMD_UTIL_DIR)"
|
||||
@$(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 +38,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/
|
@ -1,46 +0,0 @@
|
||||
From 87f3f12d27f7a81891f9a6942de22a6084e9bc1a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Tue, 26 Oct 2021 16:11:53 +0200
|
||||
Subject: [PATCH 2/5] make: print executed commands
|
||||
|
||||
The initial version of the Makefile used @ everywhere, but this can hide
|
||||
errors in the executed commands. The user should instead 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 49baab926f..ff3d4e80d9 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -19,23 +19,23 @@ build: program systemd-service man
|
||||
|
||||
program:
|
||||
@test -n "$(SYSTEMD_UTIL_DIR)"
|
||||
- @$(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)"
|
@ -1,38 +0,0 @@
|
||||
From 85a44e5bff53fa28fc1346a3c1a789f9a3050345 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Tue, 26 Oct 2021 17:25:54 +0200
|
||||
Subject: [PATCH 3/5] Print the path to the makefs command in --help
|
||||
|
||||
It is called at runtime, but not in any output files, so if this
|
||||
is misconfigured, it can be quite hard to notice. So let's add this
|
||||
to make life easier when something is misconfigured.
|
||||
---
|
||||
src/main.rs | 1 +
|
||||
src/setup.rs | 2 +-
|
||||
2 files changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main.rs b/src/main.rs
|
||||
index a17e0f9235..5bfa556cd0 100644
|
||||
--- a/src/main.rs
|
||||
+++ b/src/main.rs
|
||||
@@ -41,6 +41,7 @@ fn get_opts() -> Opts {
|
||||
.number_of_values(2)
|
||||
.conflicts_with_all(&["setup-device", "reset-device"]),
|
||||
)
|
||||
+ .after_help(&*("Uses ".to_owned() + setup::SYSTEMD_MAKEFS_COMMAND + " to perform setup."))
|
||||
.get_matches();
|
||||
|
||||
let val = opts
|
||||
diff --git a/src/setup.rs b/src/setup.rs
|
||||
index befb0032f5..74572e55e0 100644
|
||||
--- a/src/setup.rs
|
||||
+++ b/src/setup.rs
|
||||
@@ -9,7 +9,7 @@ use std::os::unix::process::ExitStatusExt;
|
||||
use std::path::Path;
|
||||
use std::process::Command;
|
||||
|
||||
-const SYSTEMD_MAKEFS_COMMAND: &str = concat!(
|
||||
+pub const SYSTEMD_MAKEFS_COMMAND: &str = concat!(
|
||||
env!(
|
||||
"SYSTEMD_UTIL_DIR",
|
||||
"Define $SYSTEMD_UTIL_DIR to the result of \
|
@ -1,32 +0,0 @@
|
||||
From 1b862b25f9c645dba7312ea2b06f065412713285 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Tue, 26 Oct 2021 17:45:39 +0200
|
||||
Subject: [PATCH 4/4] make: add an install subtarget that doesn't build
|
||||
anything
|
||||
|
||||
This is useful when we want to split the build and installation steps,
|
||||
and if there is anything to build in the installation step this is an
|
||||
error. For example, when doing 'make build && sudo make install'.
|
||||
---
|
||||
Makefile | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index ff3d4e80d9..4c4845e8db 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -37,7 +37,7 @@ clean:
|
||||
$(CARGO) clean
|
||||
rm -f units/systemd-zram-setup@.service
|
||||
|
||||
-install: build
|
||||
+install-nobuild:
|
||||
@test -n "$(SYSTEMD_SYSTEM_GENERATOR_DIR)"
|
||||
@test -n "$(SYSTEMD_SYSTEM_UNIT_DIR)"
|
||||
@test -n "$(PREFIX)"
|
||||
@@ -46,3 +46,5 @@ install: build
|
||||
$(INSTALL) -Dpm644 zram-generator.conf.example -t $(DESTDIR)$(PREFIX)/share/doc/zram-generator/
|
||||
$(INSTALL) -Dpm644 man/zram-generator.8 -t $(DESTDIR)$(PREFIX)/share/man/man8/
|
||||
$(INSTALL) -Dpm644 man/zram-generator.conf.5 -t $(DESTDIR)$(PREFIX)/share/man/man5/
|
||||
+
|
||||
+install: build install-nobuild
|
@ -1,28 +0,0 @@
|
||||
From f3c988c329939e4a0d6413ea9070db490c27dea5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
||||
Date: Tue, 26 Oct 2021 17:45:39 +0200
|
||||
Subject: [PATCH 4/5] make: allow install target that doesn't build anything
|
||||
|
||||
This is useful when we want to split the build and installation steps,
|
||||
and if there is anything to build in the installation step it is an error.
|
||||
For example, when doing 'make build && sudo make install'.
|
||||
---
|
||||
Makefile | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
diff --git a/Makefile b/Makefile
|
||||
index ff3d4e80d9..960728928f 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -37,7 +37,11 @@ clean:
|
||||
$(CARGO) clean
|
||||
rm -f units/systemd-zram-setup@.service
|
||||
|
||||
+ifndef NOBUILD
|
||||
install: build
|
||||
+endif
|
||||
+
|
||||
+install:
|
||||
@test -n "$(SYSTEMD_SYSTEM_GENERATOR_DIR)"
|
||||
@test -n "$(SYSTEMD_SYSTEM_UNIT_DIR)"
|
||||
@test -n "$(PREFIX)"
|
@ -4,7 +4,7 @@
|
||||
%global crate zram-generator
|
||||
|
||||
Name: rust-%{crate}
|
||||
Version: 1.0.1
|
||||
Version: 1.1.0
|
||||
Release: %autorelease
|
||||
Summary: Systemd unit generator for zram swap devices
|
||||
|
||||
@ -14,11 +14,6 @@ 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
|
||||
Patch3: 0003-Print-the-path-to-the-makefs-command-in-help.patch
|
||||
Patch4: 0004-make-allow-install-target-that-doesn-t-build-anythin.patch
|
||||
|
||||
ExclusiveArch: %{rust_arches}
|
||||
%if %{__cargo_skip_build}
|
||||
BuildArch: noarch
|
||||
@ -28,7 +23,7 @@ BuildRequires: rust-packaging
|
||||
|
||||
%global _description %{expand:
|
||||
This is a systemd unit generator that enables swap on zram.
|
||||
(With zram, there is no physical swap device. Part of the avaialable RAM
|
||||
(With zram, there is no physical swap device. Part of the available RAM
|
||||
is used to store compressed pages, essentially trading CPU cycles for memory.)
|
||||
|
||||
To activate, install %{crate}-defaults subpackage.}
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (zram-generator-1.0.1.crate) = c3a6dfebdd954443e9d6c36a401f7ca24e1125653f49b29e70641f5f55773a732679b493be5a0fb52e68731adb26cb574a0b5aa315e9f1116daef7097e245946
|
||||
SHA512 (zram-generator-1.1.0.crate) = 3d80a35fe9edc1960589a4a6d06c7272c7619affa2543d84da92e756154d3bace997d51c8fe190bb54537f9b9d63053c2d4fc1bb38f402fbc6bd459a0a420dc5
|
||||
|
Loading…
Reference in New Issue
Block a user