File: test-replace-rev-command-by-sed.patch

package info (click to toggle)
dracut 109-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,592 kB
  • sloc: sh: 24,498; ansic: 5,234; makefile: 346; perl: 186; python: 48; javascript: 19
file content (53 lines) | stat: -rw-r--r-- 1,987 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From: Benjamin Drung <benjamin.drung@canonical.com>
Date: Tue, 18 Nov 2025 19:34:52 +0100
Subject: test: replace rev command by sed

On Debian-based systems, the `rev` command is shipped by the
bsdextrautils package. Replace the `rev` command by `sed` which is an
essential command and does not need additional packages.

Forwarded: https://github.com/dracut-ng/dracut-ng/pull/1856
---
 test/container/Dockerfile-debian | 1 -
 test/run-qemu                    | 2 +-
 test/test-functions              | 2 +-
 3 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/test/container/Dockerfile-debian b/test/container/Dockerfile-debian
index a97caad..5a6a1eb 100644
--- a/test/container/Dockerfile-debian
+++ b/test/container/Dockerfile-debian
@@ -28,7 +28,6 @@ RUN \
     DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends -o Dpkg::Use-Pty=0 \
     asciidoctor \
     bluez \
-    bsdextrautils \
     btrfs-progs \
     ca-certificates \
     cargo \
diff --git a/test/run-qemu b/test/run-qemu
index b957018..cf110d3 100755
--- a/test/run-qemu
+++ b/test/run-qemu
@@ -138,7 +138,7 @@ ARGS+=("$@")
 # only set -kernel if -initrd is specified
 initrd=$(get_initrd "${ARGS[@]}")
 if [[ -n $initrd ]]; then
-    KVERSION=$(lsinitrd "$initrd" | grep modules.dep | head -1 | rev | cut -d'/' -f2 | rev)
+    KVERSION=$(lsinitrd "$initrd" | grep modules.dep | head -1 | sed 's;.*/\([^/]\+\)/modules.dep;\1;')
     set_vmlinux_env
     ARGS+=(-kernel "$VMLINUZ")
     add_to_append "console=${console:-ttyS0},115200"
diff --git a/test/test-functions b/test/test-functions
index c0c55bc..5b8d6fc 100644
--- a/test/test-functions
+++ b/test/test-functions
@@ -133,7 +133,7 @@ command -v test_cleanup &> /dev/null || test_cleanup() {
 }
 
 determine_kernel_version() {
-    lsinitrd "$1" | grep modules.dep | head -1 | rev | cut -d'/' -f2 | rev
+    lsinitrd "$1" | grep modules.dep | head -1 | sed 's;.*/\([^/]\+\)/modules.dep;\1;'
 }
 
 determine_kernel_image() {