summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/util-linux')
-rw-r--r--meta/recipes-core/util-linux/util-linux-libuuid_2.41.bb21
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc27
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-lsfd-mkfds-foreign-sockets-skip-when-lacking-sock_di.patch36
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-tests-ts-kill-decode-avoid-using-shell-built-in-kill.patch36
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-ts-kill-decode-use-RTMIN-from-kill-L-instead-of-hard.patch58
-rw-r--r--meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch26
-rw-r--r--meta/recipes-core/util-linux/util-linux/configure-sbindir.patch18
-rw-r--r--meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch13
-rw-r--r--meta/recipes-core/util-linux/util-linux/fcntl-lock.c332
-rw-r--r--meta/recipes-core/util-linux/util-linux/ptest.patch14
-rw-r--r--meta/recipes-core/util-linux/util-linux/run-ptest29
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.41.bb (renamed from meta/recipes-core/util-linux/util-linux_2.36.2.bb)308
12 files changed, 756 insertions, 162 deletions
diff --git a/meta/recipes-core/util-linux/util-linux-libuuid_2.41.bb b/meta/recipes-core/util-linux/util-linux-libuuid_2.41.bb
new file mode 100644
index 0000000000..5ad2997c27
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux-libuuid_2.41.bb
@@ -0,0 +1,21 @@
1# To allow util-linux to optionally build-depend on cryptsetup, libuuid is
2# split out of the main recipe, as it's needed by cryptsetup
3
4require util-linux.inc
5
6LICENSE = "BSD-3-Clause"
7LIC_FILES_CHKSUM = "file://libuuid/COPYING;md5=6d2cafc999feb2c2de84d4d24b23290c \
8 file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af"
9
10inherit autotools gettext pkgconfig
11
12S = "${UNPACKDIR}/util-linux-${PV}"
13
14EXTRA_AUTORECONF += "--exclude=gtkdocize"
15EXTRA_OECONF += "--disable-all-programs --enable-libuuid"
16
17do_install:append() {
18 rm -rf ${D}${datadir} ${D}${bindir} ${D}${base_bindir} ${D}${sbindir} ${D}${base_sbindir} ${D}${exec_prefix}/sbin
19}
20
21BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
new file mode 100644
index 0000000000..111f29cb92
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -0,0 +1,27 @@
1SUMMARY = "A suite of basic system administration utilities"
2HOMEPAGE = "https://en.wikipedia.org/wiki/Util-linux"
3DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \
4commonly found on most Linux systems. Some of the more important utilities include \
5disk partitioning, kernel message management, filesystem creation, and system login."
6
7SECTION = "base"
8
9FILESEXTRAPATHS:prepend := "${THISDIR}/util-linux:"
10MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
11SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
12 file://configure-sbindir.patch \
13 file://runuser.pamd \
14 file://runuser-l.pamd \
15 file://ptest.patch \
16 file://run-ptest \
17 file://display_testname_for_subtest.patch \
18 file://avoid_parallel_tests.patch \
19 file://fcntl-lock.c \
20 file://0001-tests-ts-kill-decode-avoid-using-shell-built-in-kill.patch \
21 file://0001-lsfd-mkfds-foreign-sockets-skip-when-lacking-sock_di.patch \
22 file://0001-ts-kill-decode-use-RTMIN-from-kill-L-instead-of-hard.patch \
23 "
24
25SRC_URI[sha256sum] = "81ee93b3cfdfeb7d7c4090cedeba1d7bbce9141fd0b501b686b3fe475ddca4c6"
26
27CVE_PRODUCT = "util-linux"
diff --git a/meta/recipes-core/util-linux/util-linux/0001-lsfd-mkfds-foreign-sockets-skip-when-lacking-sock_di.patch b/meta/recipes-core/util-linux/util-linux/0001-lsfd-mkfds-foreign-sockets-skip-when-lacking-sock_di.patch
new file mode 100644
index 0000000000..e3f9112192
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/0001-lsfd-mkfds-foreign-sockets-skip-when-lacking-sock_di.patch
@@ -0,0 +1,36 @@
1From b3a1d92a9078fada31b2cf64b802edd616026766 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Mon, 26 May 2025 15:24:16 +0800
4Subject: [PATCH] lsfd/mkfds-foreign-sockets: skip when lacking sock_diag
5 ability
6
7The ENDPOINTS will need sock_diag ability. The kernel might not
8enable related configs. Check and skip in case of lacking such ability.
9
10Fixes: https://github.com/util-linux/util-linux/issues/3590
11
12Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
13
14Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/3591]
15
16Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
17---
18 tests/ts/lsfd/mkfds-foreign-sockets | 2 ++
19 1 file changed, 2 insertions(+)
20
21diff --git a/tests/ts/lsfd/mkfds-foreign-sockets b/tests/ts/lsfd/mkfds-foreign-sockets
22index cd94da799..76138a7a6 100755
23--- a/tests/ts/lsfd/mkfds-foreign-sockets
24+++ b/tests/ts/lsfd/mkfds-foreign-sockets
25@@ -30,6 +30,8 @@ ts_skip_nonroot
26 ts_skip_qemu_user
27 ts_cd "$TS_OUTDIR"
28
29+lsfd_check_sockdiag "unix"
30+
31 declare -A tcase
32 tcase[NAME]="state=connected"
33 tcase[SOCK.NETNS]=
34--
352.34.1
36
diff --git a/meta/recipes-core/util-linux/util-linux/0001-tests-ts-kill-decode-avoid-using-shell-built-in-kill.patch b/meta/recipes-core/util-linux/util-linux/0001-tests-ts-kill-decode-avoid-using-shell-built-in-kill.patch
new file mode 100644
index 0000000000..dece0e94b7
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/0001-tests-ts-kill-decode-avoid-using-shell-built-in-kill.patch
@@ -0,0 +1,36 @@
1From d2eeccf36542d506b660641a07a44f3976772897 Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Thu, 15 May 2025 16:44:33 +0800
4Subject: [PATCH] tests/ts/kill/decode: avoid using shell built-in kill command
5
6This test case should do the same as other kill test cases, avoiding
7using shell built-in kill command.
8
9Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
10
11Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/d2eeccf36542d506b660641a07a44f3976772897]
12
13Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
14---
15 tests/ts/kill/decode | 5 +++++
16 1 file changed, 5 insertions(+)
17
18diff --git a/tests/ts/kill/decode b/tests/ts/kill/decode
19index 03bc25ff6..57149899e 100755
20--- a/tests/ts/kill/decode
21+++ b/tests/ts/kill/decode
22@@ -18,6 +18,11 @@ TS_DESC="decode functions"
23 . "$TS_TOPDIR/functions.sh"
24 ts_init "$*"
25
26+# make sure we do not use shell built-in command
27+if [ "$TS_USE_SYSTEM_COMMANDS" == "yes" ]; then
28+ TS_CMD_KILL="$(which kill)"
29+fi
30+
31 ts_skip_qemu_user
32
33 ts_check_test_command "$TS_CMD_KILL"
34--
352.34.1
36
diff --git a/meta/recipes-core/util-linux/util-linux/0001-ts-kill-decode-use-RTMIN-from-kill-L-instead-of-hard.patch b/meta/recipes-core/util-linux/util-linux/0001-ts-kill-decode-use-RTMIN-from-kill-L-instead-of-hard.patch
new file mode 100644
index 0000000000..f4e2f9e745
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/0001-ts-kill-decode-use-RTMIN-from-kill-L-instead-of-hard.patch
@@ -0,0 +1,58 @@
1From c5d5e8873029d170fcab38a6fbd5d5a355574b9f Mon Sep 17 00:00:00 2001
2From: Chen Qi <Qi.Chen@windriver.com>
3Date: Wed, 4 Jun 2025 16:27:19 +0800
4Subject: [PATCH] ts/kill/decode: use RTMIN from 'kill -L' instead of
5 hardcoding 34
6
7glibc uses 34 as the value of SIGRTMIN:
8https://sourceware.org/git/?p=glibc.git;a=blob;f=signal/allocrtsig.c;h=8ed8e37dd6c41f94be6eef042ce9db1af1153228;hb=HEAD#l27 """
9static int current_rtmin = __SIGRTMIN + RESERVED_SIGRT; """
10
11musl uses 35 as the value of SIGRTMIN:
12https://git.musl-libc.org/cgit/musl/tree/src/signal/sigrtmin.c
13
14With the hardcoded 34, test case fails with the following difference:
15
16-Ignored: HUP QUIT TRAP PIPE ALRM
17+Ignored: HUP QUIT TRAP PIPE ALRM 34
18
19Extract the value of RTMIN from 'kill -L' to avoid such hardcoding.
20
21Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
22
23Upstream-Status: Backport [https://github.com/util-linux/util-linux/commit/c5d5e8873029d170fcab38a6fbd5d5a355574b9f]
24
25Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
26---
27 tests/ts/kill/decode | 9 +++++++--
28 1 file changed, 7 insertions(+), 2 deletions(-)
29
30diff --git a/tests/ts/kill/decode b/tests/ts/kill/decode
31index 57149899e..524b4e5e2 100755
32--- a/tests/ts/kill/decode
33+++ b/tests/ts/kill/decode
34@@ -53,14 +53,19 @@ ACK=
35 # Sending one more USR1 is for making the signal pending state.
36 "$TS_CMD_KILL" -USR1 "$PID"
37 "$TS_CMD_KILL" -d "$PID" | {
38- if [[ $("$TS_CMD_KILL" --list=34) == RT0 ]]; then
39+ SIGRTMIN=$("$TS_CMD_KILL" -L | grep -o '[0-9]\+ RTMIN' | cut -d " " -f 1)
40+ if [[ $("$TS_CMD_KILL" --list=$SIGRTMIN) == RT0 ]]; then
41 # See man signal(7).
42 # The Linux kernel supports a range of 33 different real-time signals,
43 # numbered 32 to 64. However, the glibc POSIX threads implementation in‐
44 # ternally uses two (for NPTL) or three (for LinuxThreads) real-time sig‐
45 # nals (see pthreads(7)), and adjusts the value of SIGRTMIN suitably (to
46 # 34 or 35).
47- sed -e s/' 32 33'// -e s/' 34'//
48+ sed_cmd="sed"
49+ for ((i=32; i<=SIGRTMIN; i++)); do
50+ sed_cmd+=" -e s/' $i'//"
51+ done
52+ eval $sed_cmd
53 else
54 cat
55 fi
56--
572.34.1
58
diff --git a/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
index 748b6ef096..fe92afbc53 100644
--- a/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
+++ b/meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch
@@ -1,20 +1,28 @@
1From 43030388e831642d36cb7b9d4b63755e9696714a Mon Sep 17 00:00:00 2001
2From: Tudor Florea <tudor.florea@enea.com>
3Date: Mon, 14 Jun 2021 14:00:31 +0200
4Subject: [PATCH] util-linux: Add ptest
5
1Ptest needs buildtest-TESTS and runtest-TESTS targets. 6Ptest needs buildtest-TESTS and runtest-TESTS targets.
2serial-tests is required to generate those targets. 7serial-tests is required to generate those targets.
3Revert run.sh script accordingly to serialize running tests 8Revert run.sh script accordingly to serialize running tests
4 9
5Signed-off-by: Tudor Florea <tudor.florea@enea.com> 10Signed-off-by: Tudor Florea <tudor.florea@enea.com>
6Upstream-Status: Inappropriate 11Upstream-Status: Inappropriate
12---
13 configure.ac | 2 +-
14 1 file changed, 1 insertion(+), 1 deletion(-)
7 15
8Index: util-linux-2.32/configure.ac 16diff --git a/configure.ac b/configure.ac
9=================================================================== 17index 43a23a5..4a84531 100644
10--- util-linux-2.32.orig/configure.ac 18--- a/configure.ac
11+++ util-linux-2.32/configure.ac 19+++ b/configure.ac
12@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4]) 20@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4])
13 dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run 21 dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run
14 dnl the compiler (like AC_PROG_LIBTOOL) to avoid autoconf errors. 22 dnl the compiler (like LT_INIT) to avoid autoconf errors.
15 AC_USE_SYSTEM_EXTENSIONS 23 AC_USE_SYSTEM_EXTENSIONS
16-AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects]) 24-AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects])
17+AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests]) 25+AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
18 26
19 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], 27 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
20 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) 28 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])])
diff --git a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
index e475289f65..ebb32a6845 100644
--- a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
+++ b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
@@ -1,15 +1,23 @@
1From 378998bf82e3b6ff46569077b29f95e72b734681 Mon Sep 17 00:00:00 2001
2From: Phil Blundell <pb@pbcl.net>
3Date: Mon, 24 Sep 2012 07:24:51 +0100
4Subject: [PATCH] util-linux: Ensure that ${sbindir} is respected
5
1util-linux: take ${sbindir} from the environment if it is set there 6util-linux: take ${sbindir} from the environment if it is set there
2fix the test, the [ ] syntax was getting eaten by autoconf 7fix the test, the [ ] syntax was getting eaten by autoconf
3 8
4Signed-off-by: Phil Blundell <pb@pbcl.net> 9Signed-off-by: Phil Blundell <pb@pbcl.net>
5Signed-off-by: Saul Wold <sgw@linux.intel.com 10Signed-off-by: Saul Wold <sgw@linux.intel.com
6Upstream-Status: Inappropriate [configuration] 11Upstream-Status: Inappropriate [configuration]
12---
13 configure.ac | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
7 15
8Index: util-linux-2.31/configure.ac 16diff --git a/configure.ac b/configure.ac
9=================================================================== 17index a5d9102..43a23a5 100644
10--- util-linux-2.31.orig/configure.ac 18--- a/configure.ac
11+++ util-linux-2.31/configure.ac 19+++ b/configure.ac
12@@ -89,7 +89,10 @@ AC_SUBST([runstatedir]) 20@@ -110,7 +110,10 @@ AC_SUBST([runstatedir])
13 usrbin_execdir='${exec_prefix}/bin' 21 usrbin_execdir='${exec_prefix}/bin'
14 AC_SUBST([usrbin_execdir]) 22 AC_SUBST([usrbin_execdir])
15 23
diff --git a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
index 417ca1d98f..fa4ae02bc3 100644
--- a/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
+++ b/meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch
@@ -1,17 +1,19 @@
1Display testname for subtest 1From 728c2abd889d225535008c3e7a1eef4b8a0aeea2 Mon Sep 17 00:00:00 2001
2From: Tudor Florea <tudor.florea@enea.com>
3Date: Thu, 3 Dec 2015 04:08:00 +0100
4Subject: [PATCH] Display testname for subtest
2 5
3Signed-off-by: Tudor Florea <tudor.florea@enea.com> 6Signed-off-by: Tudor Florea <tudor.florea@enea.com>
4Upstream-Status: Pending 7Upstream-Status: Pending
5
6--- 8---
7 tests/functions.sh | 2 +- 9 tests/functions.sh | 2 +-
8 1 file changed, 1 insertion(+), 1 deletion(-) 10 1 file changed, 1 insertion(+), 1 deletion(-)
9 11
10diff --git a/tests/functions.sh b/tests/functions.sh 12diff --git a/tests/functions.sh b/tests/functions.sh
11index 5246605..b24dc15 100644 13index 1d7a425..b1f0986 100644
12--- a/tests/functions.sh 14--- a/tests/functions.sh
13+++ b/tests/functions.sh 15+++ b/tests/functions.sh
14@@ -320,7 +320,7 @@ function ts_init_subtest { 16@@ -455,7 +455,7 @@ function ts_init_subtest {
15 17
16 if [ "$TS_PARSABLE" != "yes" ]; then 18 if [ "$TS_PARSABLE" != "yes" ]; then
17 [ $TS_NSUBTESTS -eq 1 ] && echo 19 [ $TS_NSUBTESTS -eq 1 ] && echo
@@ -20,6 +22,3 @@ index 5246605..b24dc15 100644
20 fi 22 fi
21 } 23 }
22 24
23--
242.8.3
25
diff --git a/meta/recipes-core/util-linux/util-linux/fcntl-lock.c b/meta/recipes-core/util-linux/util-linux/fcntl-lock.c
new file mode 100644
index 0000000000..966d8c5ecb
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/fcntl-lock.c
@@ -0,0 +1,332 @@
1// From https://github.com/magnumripper/fcntl-lock
2// SPDX-License-Identifier: MIT
3/* ----------------------------------------------------------------------- *
4 *
5 * Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
6 * Copyright 2015 magnum (fcntl version)
7 *
8 * Permission is hereby granted, free of charge, to any person
9 * obtaining a copy of this software and associated documentation
10 * files (the "Software"), to deal in the Software without
11 * restriction, including without limitation the rights to use,
12 * copy, modify, merge, publish, distribute, sublicense, and/or
13 * sell copies of the Software, and to permit persons to whom
14 * the Software is furnished to do so, subject to the following
15 * conditions:
16 *
17 * The above copyright notice and this permission notice shall
18 * be included in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
22 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
24 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
25 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
28 *
29 * ----------------------------------------------------------------------- */
30
31#include <errno.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <fcntl.h>
35#include <unistd.h>
36#include <getopt.h>
37#include <signal.h>
38#include <ctype.h>
39#include <string.h>
40#include <paths.h>
41#include <sysexits.h>
42#include <sys/types.h>
43#include <sys/file.h>
44#include <sys/time.h>
45#include <sys/wait.h>
46
47#define PACKAGE_STRING "magnum"
48#define _(x) (x)
49
50static const struct option long_options[] = {
51 { "shared", 0, NULL, 's' },
52 { "exclusive", 0, NULL, 'x' },
53 { "unlock", 0, NULL, 'u' },
54 { "nonblocking", 0, NULL, 'n' },
55 { "nb", 0, NULL, 'n' },
56 { "timeout", 1, NULL, 'w' },
57 { "wait", 1, NULL, 'w' },
58 { "close", 0, NULL, 'o' },
59 { "help", 0, NULL, 'h' },
60 { "version", 0, NULL, 'V' },
61 { 0, 0, 0, 0 }
62};
63
64const char *program;
65
66static void usage(int ex)
67{
68 fputs("fcntl-lock (" PACKAGE_STRING ")\n", stderr);
69 fprintf(stderr,
70 _("Usage: %1$s [-sxun][-w #] fd#\n"
71 " %1$s [-sxon][-w #] file [-c] command...\n"
72 " %1$s [-sxon][-w #] directory [-c] command...\n"
73 " -s --shared Get a shared lock\n"
74 " -x --exclusive Get an exclusive lock\n"
75 " -u --unlock Remove a lock\n"
76 " -n --nonblock Fail rather than wait\n"
77 " -w --timeout Wait for a limited amount of time\n"
78 " -o --close Close file descriptor before running command\n"
79 " -c --command Run a single command string through the shell\n"
80 " -h --help Display this text\n"
81 " -V --version Display version\n"),
82 program);
83 exit(ex);
84}
85
86
87static sig_atomic_t timeout_expired = 0;
88
89static void timeout_handler(int sig)
90{
91 (void)sig;
92
93 timeout_expired = 1;
94}
95
96
97static char * strtotimeval(const char *str, struct timeval *tv)
98{
99 char *s;
100 long fs; /* Fractional seconds */
101 int i;
102
103 tv->tv_sec = strtol(str, &s, 10);
104 fs = 0;
105
106 if ( *s == '.' ) {
107 s++;
108
109 for ( i = 0 ; i < 6 ; i++ ) {
110 if ( !isdigit(*s) )
111 break;
112
113 fs *= 10;
114 fs += *s++ - '0';
115 }
116
117 for ( ; i < 6; i++ )
118 fs *= 10;
119
120 while ( isdigit(*s) )
121 s++;
122 }
123
124 tv->tv_usec = fs;
125 return s;
126}
127
128int main(int argc, char *argv[])
129{
130 struct itimerval timeout, old_timer;
131 int have_timeout = 0;
132 int type = F_WRLCK;
133 int block = F_SETLKW;
134 int fd = -1;
135 int opt, ix;
136 int do_close = 0;
137 int err;
138 int status;
139 char *eon;
140 char **cmd_argv = NULL, *sh_c_argv[4];
141 struct flock lock;
142 const char *filename = NULL;
143 struct sigaction sa, old_sa;
144
145 program = argv[0];
146
147 if ( argc < 2 )
148 usage(EX_USAGE);
149
150 memset(&timeout, 0, sizeof timeout);
151
152 optopt = 0;
153 while ( (opt = getopt_long(argc, argv, "+sexnouw:hV?", long_options, &ix)) != EOF ) {
154 switch(opt) {
155 case 's':
156 type = F_RDLCK;
157 break;
158 case 'e':
159 case 'x':
160 type = F_WRLCK;
161 break;
162 case 'u':
163 type = F_UNLCK;
164 break;
165 case 'o':
166 do_close = 1;
167 break;
168 case 'n':
169 block = F_SETLK;
170 break;
171 case 'w':
172 have_timeout = 1;
173 eon = strtotimeval(optarg, &timeout.it_value);
174 if ( *eon )
175 usage(EX_USAGE);
176 break;
177 case 'V':
178 printf("fcntl-lock (%s)\n", PACKAGE_STRING);
179 exit(0);
180 default:
181 /* optopt will be set if this was an unrecognized option, i.e. *not* 'h' or '?' */
182 usage(optopt ? EX_USAGE : 0);
183 break;
184 }
185 }
186
187 if ( argc > optind+1 ) {
188 /* Run command */
189
190 if ( !strcmp(argv[optind+1], "-c") ||
191 !strcmp(argv[optind+1], "--command") ) {
192
193 if ( argc != optind+3 ) {
194 fprintf(stderr, _("%s: %s requires exactly one command argument\n"),
195 program, argv[optind+1]);
196 exit(EX_USAGE);
197 }
198
199 cmd_argv = sh_c_argv;
200
201 cmd_argv[0] = getenv("SHELL");
202 if ( !cmd_argv[0] || !*cmd_argv[0] )
203 cmd_argv[0] = _PATH_BSHELL;
204
205 cmd_argv[1] = "-c";
206 cmd_argv[2] = argv[optind+2];
207 cmd_argv[3] = 0;
208 } else {
209 cmd_argv = &argv[optind+1];
210 }
211
212 filename = argv[optind];
213 fd = open(filename, O_RDWR|O_NOCTTY|O_CREAT, 0666);
214 /* Linux doesn't like O_CREAT on a directory, even though it should be a
215 no-op */
216 if (fd < 0 && errno == EISDIR)
217 fd = open(filename, O_RDONLY|O_NOCTTY);
218
219 if ( fd < 0 ) {
220 err = errno;
221 fprintf(stderr, _("%s: cannot open lock file %s: %s\n"),
222 program, argv[optind], strerror(err));
223 exit((err == ENOMEM||err == EMFILE||err == ENFILE) ? EX_OSERR :
224 (err == EROFS||err == ENOSPC) ? EX_CANTCREAT :
225 EX_NOINPUT);
226 }
227
228 } else if (optind < argc) {
229 /* Use provided file descriptor */
230
231 fd = (int)strtol(argv[optind], &eon, 10);
232 if ( *eon || !argv[optind] ) {
233 fprintf(stderr, _("%s: bad number: %s\n"), program, argv[optind]);
234 exit(EX_USAGE);
235 }
236
237 } else {
238 /* Bad options */
239
240 fprintf(stderr, _("%s: requires file descriptor, file or directory\n"),
241 program);
242 exit(EX_USAGE);
243 }
244
245
246 if ( have_timeout ) {
247 if ( timeout.it_value.tv_sec == 0 &&
248 timeout.it_value.tv_usec == 0 ) {
249 /* -w 0 is equivalent to -n; this has to be special-cased
250 because setting an itimer to zero means disabled! */
251
252 have_timeout = 0;
253 block = F_SETLK;
254 } else {
255 memset(&sa, 0, sizeof sa);
256
257 sa.sa_handler = timeout_handler;
258 sa.sa_flags = SA_RESETHAND;
259 sigaction(SIGALRM, &sa, &old_sa);
260
261 setitimer(ITIMER_REAL, &timeout, &old_timer);
262 }
263 }
264
265 memset(&lock, 0, sizeof(lock));
266 lock.l_type = type;
267 while ( fcntl(fd, block, &lock) ) {
268 switch( (err = errno) ) {
269 case EAGAIN: /* -n option set and failed to lock */
270 case EACCES: /* -n option set and failed to lock */
271 exit(1);
272 case EINTR: /* Signal received */
273 if ( timeout_expired )
274 exit(1); /* -w option set and failed to lock */
275 continue; /* otherwise try again */
276 default: /* Other errors */
277 if ( filename )
278 fprintf(stderr, "%s: %s: %s\n", program, filename, strerror(err));
279 else
280 fprintf(stderr, "%s: %d: %s\n", program, fd, strerror(err));
281 exit((err == ENOLCK||err == ENOMEM) ? EX_OSERR : EX_DATAERR);
282 }
283 }
284
285 if ( have_timeout ) {
286 setitimer(ITIMER_REAL, &old_timer, NULL); /* Cancel itimer */
287 sigaction(SIGALRM, &old_sa, NULL); /* Cancel signal handler */
288 }
289
290 status = 0;
291
292 if ( cmd_argv ) {
293 pid_t w, f;
294
295 /* Clear any inherited settings */
296 signal(SIGCHLD, SIG_DFL);
297 f = fork();
298
299 if ( f < 0 ) {
300 err = errno;
301 fprintf(stderr, _("%s: fork failed: %s\n"), program, strerror(err));
302 exit(EX_OSERR);
303 } else if ( f == 0 ) {
304 if ( do_close )
305 close(fd);
306 err = errno;
307 execvp(cmd_argv[0], cmd_argv);
308 /* execvp() failed */
309 fprintf(stderr, "%s: %s: %s\n", program, cmd_argv[0], strerror(err));
310 _exit((err == ENOMEM) ? EX_OSERR: EX_UNAVAILABLE);
311 } else {
312 do {
313 w = waitpid(f, &status, 0);
314 if (w == -1 && errno != EINTR)
315 break;
316 } while ( w != f );
317
318 if (w == -1) {
319 err = errno;
320 status = EXIT_FAILURE;
321 fprintf(stderr, "%s: waitpid failed: %s\n", program, strerror(err));
322 } else if ( WIFEXITED(status) )
323 status = WEXITSTATUS(status);
324 else if ( WIFSIGNALED(status) )
325 status = WTERMSIG(status) + 128;
326 else
327 status = EX_OSERR; /* WTF? */
328 }
329 }
330
331 return status;
332}
diff --git a/meta/recipes-core/util-linux/util-linux/ptest.patch b/meta/recipes-core/util-linux/util-linux/ptest.patch
index 0537f7d856..ad23001cfa 100644
--- a/meta/recipes-core/util-linux/util-linux/ptest.patch
+++ b/meta/recipes-core/util-linux/util-linux/ptest.patch
@@ -1,4 +1,7 @@
1Define TESTS variable 1From 18bf6aded9b2a75185ae4b23a41cd2e4322c5e31 Mon Sep 17 00:00:00 2001
2From: Tudor Florea <tudor.florea@enea.com>
3Date: Thu, 3 Dec 2015 04:08:00 +0100
4Subject: [PATCH] Define TESTS variable
2 5
3Signed-off-by: Tudor Florea <tudor.florea@enea.com> 6Signed-off-by: Tudor Florea <tudor.florea@enea.com>
4Upstream-Status: Pending 7Upstream-Status: Pending
@@ -7,17 +10,14 @@ Upstream-Status: Pending
7 1 file changed, 1 insertion(+) 10 1 file changed, 1 insertion(+)
8 11
9diff --git a/Makefile.am b/Makefile.am 12diff --git a/Makefile.am b/Makefile.am
10index bbaccb1..7d5a6bb 100644 13index 01e9970..c3313ff 100644
11--- a/Makefile.am 14--- a/Makefile.am
12+++ b/Makefile.am 15+++ b/Makefile.am
13@@ -48,6 +48,7 @@ systemdsystemunit_DATA = 16@@ -66,6 +66,7 @@ sysusers_DATA =
14 dist_bashcompletion_DATA = 17 dist_bashcompletion_DATA =
15 check_PROGRAMS = 18 check_PROGRAMS =
16 dist_check_SCRIPTS = 19 dist_check_SCRIPTS =
17+TESTS = $(check_PROGRAMS) 20+TESTS = $(check_PROGRAMS)
18 21
19 PATHFILES = 22 BUILT_SOURCES =
20 23
21--
222.8.3
23
diff --git a/meta/recipes-core/util-linux/util-linux/run-ptest b/meta/recipes-core/util-linux/util-linux/run-ptest
index e135ee583b..1410229172 100644
--- a/meta/recipes-core/util-linux/util-linux/run-ptest
+++ b/meta/recipes-core/util-linux/util-linux/run-ptest
@@ -13,31 +13,22 @@ current_path=$(readlink -f $0)
13export bindir=$(dirname $current_path) 13export bindir=$(dirname $current_path)
14export PATH=$bindir/bin:$PATH 14export PATH=$bindir/bin:$PATH
15 15
16cd tests || exit 1 16# losetup tests will be skipped and/or fail otherwise
17modprobe loop
17 18
18comps=$(find ts/ -type f -perm -111 -regex ".*/[^\.~]*" | sort) 19# required for mount/fallback test to pass
20# systemd does this by default, but ptest images do not use it
21# see https://man7.org/linux/man-pages/man7/mount_namespaces.7.html
22# for a long description of mount namespaces in Linux
23mount --make-shared /
19 24
20 25# lsfd/mkfds-bpf* have issues with the gcc 15 upgrade
21echo 26./tests/run.sh --use-system-commands --parsable --show-diff --exclude='lsfd/mkfds-bpf-map lsfd/mkfds-bpf-prog' | sed -u '{
22echo "-------------------- util-linux regression tests --------------------"
23echo
24echo " For development purpose only. "
25echo " Don't execute on production system! "
26echo
27
28res=0
29count=0
30for ts in $comps;
31do
32 $ts | sed -u '{
33 s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/ 27 s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/
34 s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/ 28 s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/
35 s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/ 29 s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/
36 }' 30 }'
37done
38
39 31
40if [ "x$UDEV_PID" != "x" ]; then 32if [ "x$UDEV_PID" != "x" ]; then
41 /etc/init.d/udev start 33 /etc/init.d/udev start
42fi 34fi
43
diff --git a/meta/recipes-core/util-linux/util-linux_2.36.2.bb b/meta/recipes-core/util-linux/util-linux_2.41.bb
index 19950a2726..41fb3e5951 100644
--- a/meta/recipes-core/util-linux/util-linux_2.36.2.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.41.bb
@@ -1,46 +1,60 @@
1SUMMARY = "A suite of basic system administration utilities" 1require util-linux.inc
2HOMEPAGE = "https://en.wikipedia.org/wiki/Util-linux" 2
3DESCRIPTION = "Util-linux includes a suite of basic system administration utilities \ 3# Most of the applications and the libraries are linked with libcommon.la,
4commonly found on most Linux systems. Some of the more important utilities include \ 4# which uses these licenses
5disk partitioning, kernel message management, filesystem creation, and system login." 5LIBCOMMON_LICENSES = "LGPL-2.1-or-later & BSD-2-Clause & BSD-3-Clause & MIT"
6 6
7SECTION = "base" 7# The default license is GPL-2.0-or-later
8 8DEFAULT_LICENSES = "GPL-2.0-or-later & ${LIBCOMMON_LICENSES}"
9LICENSE = "GPLv2+ & LGPLv2.1+ & BSD-3-Clause & BSD-4-Clause" 9
10LICENSE_${PN}-libblkid = "LGPLv2.1+" 10LICENSE = "GPL-1.0-or-later & GPL-2.0-only & GPL-2.0-or-later & LGPL-2.1-or-later & BSD-2-Clause & BSD-3-Clause & BSD-4-Clause-UC & MIT & EUPL-1.2"
11LICENSE_${PN}-libfdisk = "LGPLv2.1+" 11LICENSE:${PN}-bash-completion = "GPL-2.0-or-later"
12LICENSE_${PN}-libmount = "LGPLv2.1+" 12LICENSE:${PN}-dev = "${LIBCOMMON_LICENSES}"
13LICENSE_${PN}-libsmartcols = "LGPLv2.1+" 13# All dynamic packages use ${DEFAULT_LICENSES} with the following exceptions
14LICENSE_${PN}-libuuid = "BSD-3-Clause" 14LICENSE:${PN}-cal = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
15 15LICENSE:${PN}-col = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
16LIC_FILES_CHKSUM = "file://README.licensing;md5=0fd5c050c6187d2bf0a4492b7f4e33da \ 16LICENSE:${PN}-colcrt = "BSD-4-Clause-UC"
17LICENSE:${PN}-colrm = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
18LICENSE:${PN}-column = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
19LICENSE:${PN}-coresched = "EUPL-1.2 & ${LIBCOMMON_LICENSES}"
20LICENSE:${PN}-fcntl-lock = "MIT"
21LICENSE:${PN}-fdisk = "GPL-1.0-or-later & ${DEFAULT_LICENSES}"
22LICENSE:${PN}-fsfreeze = "GPL-1.0-or-later"
23LICENSE:${PN}-hexdump = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
24LICENSE:${PN}-kill = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
25LICENSE:${PN}-libblkid = "${LIBCOMMON_LICENSES}"
26LICENSE:${PN}-libfdisk = "${LIBCOMMON_LICENSES}"
27LICENSE:${PN}-libmount = "${LIBCOMMON_LICENSES}"
28LICENSE:${PN}-libsmartcols = "${LIBCOMMON_LICENSES}"
29LICENSE:${PN}-logger = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
30LICENSE:${PN}-look = "BSD-4-Clause-UC"
31LICENSE:${PN}-lscpu = "GPL-2.0-only & ${DEFAULT_LICENSES}"
32LICENSE:${PN}-mesg = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
33LICENSE:${PN}-nsenter = "GPL-2.0-only & ${DEFAULT_LICENSES}"
34LICENSE:${PN}-renice = "BSD-4-Clause-UC"
35LICENSE:${PN}-rev = "BSD-4-Clause-UC"
36LICENSE:${PN}-script = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
37LICENSE:${PN}-ul = "BSD-4-Clause-UC"
38LICENSE:${PN}-vipw = "BSD-4-Clause-UC & ${DEFAULT_LICENSES}"
39LICENSE:${PN}-wall = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
40LICENSE:${PN}-whereis = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
41LICENSE:${PN}-write = "BSD-4-Clause-UC & ${LIBCOMMON_LICENSES}"
42
43LIC_FILES_CHKSUM = "file://README.licensing;md5=55e895a80bdd4ffc65e167a76d2e7569 \
17 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 44 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
18 file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ 45 file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
19 file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \ 46 file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \
20 file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af \ 47 file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af \
21 file://Documentation/licenses/COPYING.BSD-4-Clause-UC;md5=263860f8968d8bafa5392cab74285262 \ 48 file://Documentation/licenses/COPYING.BSD-4-Clause-UC;md5=263860f8968d8bafa5392cab74285262 \
22 file://libuuid/COPYING;md5=6d2cafc999feb2c2de84d4d24b23290c \ 49 file://Documentation/licenses/COPYING.EUPL-1.2;md5=c075d2767167a2355b23392018a1cbbd \
23 file://libmount/COPYING;md5=7c7e39fb7d70ffe5d693a643e29987c2 \ 50 file://libmount/COPYING;md5=7c7e39fb7d70ffe5d693a643e29987c2 \
24 file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \ 51 file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
25 file://libfdisk/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \ 52 file://libfdisk/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
26 file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \ 53 file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
27" 54 "
28 55
29#gtk-doc is not enabled as it requires xmlto which requires util-linux 56inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest gtk-doc
30inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest 57DEPENDS = "libcap-ng ncurses virtual/crypt zlib util-linux-libuuid"
31DEPENDS = "libcap-ng ncurses virtual/crypt zlib"
32
33MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
34SRC_URI = "${KERNELORG_MIRROR}/linux/utils/${BPN}/v${MAJOR_VERSION}/${BP}.tar.xz \
35 file://configure-sbindir.patch \
36 file://runuser.pamd \
37 file://runuser-l.pamd \
38 file://ptest.patch \
39 file://run-ptest \
40 file://display_testname_for_subtest.patch \
41 file://avoid_parallel_tests.patch \
42 "
43SRC_URI[sha256sum] = "f7516ba9d8689343594356f0e5e1a5f0da34adfbc89023437735872bb5024c5f"
44 58
45PACKAGES =+ "${PN}-swaponoff" 59PACKAGES =+ "${PN}-swaponoff"
46PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}" 60PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}"
@@ -48,12 +62,15 @@ PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmou
48python util_linux_binpackages () { 62python util_linux_binpackages () {
49 def pkg_hook(f, pkg, file_regex, output_pattern, modulename): 63 def pkg_hook(f, pkg, file_regex, output_pattern, modulename):
50 pn = d.getVar('PN') 64 pn = d.getVar('PN')
51 d.appendVar('RRECOMMENDS_%s' % pn, ' %s' % pkg) 65 d.appendVar('RRECOMMENDS:%s' % pn, ' %s' % pkg)
66
67 if not d.getVar('LICENSE:' + pkg):
68 d.setVar('LICENSE:' + pkg, '${DEFAULT_LICENSES}')
52 69
53 if d.getVar('ALTERNATIVE_' + pkg): 70 if d.getVar('ALTERNATIVE:' + pkg):
54 return 71 return
55 if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename): 72 if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename):
56 d.setVar('ALTERNATIVE_' + pkg, modulename) 73 d.setVar('ALTERNATIVE:' + pkg, modulename)
57 74
58 bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split()))) 75 bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split())))
59 for dir in bindirs: 76 for dir in bindirs:
@@ -75,20 +92,22 @@ python util_linux_binpackages () {
75 continue 92 continue
76 93
77 pkg = os.path.basename(os.readlink(file)) 94 pkg = os.path.basename(os.readlink(file))
78 extras[pkg] = extras.get(pkg, '') + ' ' + file.replace(dvar, '', 1) 95 extras.setdefault(pkg, [])
96 extras[pkg].append(file.replace(dvar, '', 1))
79 97
80 pn = d.getVar('PN') 98 pn = d.getVar('PN')
81 for pkg, links in extras.items(): 99 for pkg, links in extras.items():
82 of = d.getVar('FILES_' + pn + '-' + pkg) 100 of = d.getVar('FILES:' + pn + '-' + pkg)
83 links = of + links 101 links = of + " " + " ".join(sorted(links))
84 d.setVar('FILES_' + pn + '-' + pkg, links) 102 d.setVar('FILES:' + pn + '-' + pkg, links)
85} 103}
86 104
87# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS 105# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS
88PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages " 106PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages "
89 107
108# skip libuuid as it will be packaged by the util-linux-libuuid recipe
90python util_linux_libpackages() { 109python util_linux_libpackages() {
91 do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(.*)\.so\..*$', 110 do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(?!uuid)(.*)\.so\..*$',
92 output_pattern='${PN}-lib%s', 111 output_pattern='${PN}-lib%s',
93 description='${PN} lib%s', 112 description='${PN} lib%s',
94 extra_depends='', prepend=True, allow_links=True) 113 extra_depends='', prepend=True, allow_links=True)
@@ -96,21 +115,21 @@ python util_linux_libpackages() {
96 115
97PACKAGESPLITFUNCS =+ "util_linux_libpackages" 116PACKAGESPLITFUNCS =+ "util_linux_libpackages"
98 117
99PACKAGES_DYNAMIC = "^${PN}-.*" 118PACKAGES_DYNAMIC = "^${PN}(?!.*-native)-.*"
119PACKAGES_DYNAMIC:class-native = "^${BPN}-.*-native"
100 120
101CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
102UTIL_LINUX_LIBDIR = "${libdir}" 121UTIL_LINUX_LIBDIR = "${libdir}"
103UTIL_LINUX_LIBDIR_class-target = "${base_libdir}" 122UTIL_LINUX_LIBDIR:class-target = "${base_libdir}"
104EXTRA_OECONF = "\ 123EXTRA_OECONF = "\
105 --enable-libuuid --enable-libblkid \ 124 --enable-libuuid --enable-libblkid \
106 \ 125 \
107 --enable-fsck --enable-kill --enable-last --enable-mesg \ 126 --enable-fsck --enable-kill --enable-last --enable-mesg \
108 --enable-mount --enable-partx --enable-raw --enable-rfkill \ 127 --enable-mount --enable-partx --enable-rfkill \
109 --enable-unshare --enable-write \ 128 --enable-unshare --enable-write \
110 \ 129 \
111 --disable-bfs --disable-chfn-chsh --disable-login \ 130 --disable-bfs --disable-login \
112 --disable-makeinstall-chown --disable-minix --disable-newgrp \ 131 --disable-makeinstall-chown --disable-minix --disable-newgrp \
113 --disable-use-tty-group --disable-vipw \ 132 --disable-use-tty-group --disable-vipw --disable-raw \
114 \ 133 \
115 --without-udev \ 134 --without-udev \
116 \ 135 \
@@ -118,17 +137,20 @@ EXTRA_OECONF = "\
118 --libdir='${UTIL_LINUX_LIBDIR}' \ 137 --libdir='${UTIL_LINUX_LIBDIR}' \
119" 138"
120 139
121EXTRA_OECONF_append_class-target = " --enable-setpriv" 140EXTRA_OECONF:append:class-target = " --enable-setpriv"
122EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv" 141EXTRA_OECONF:append:class-native = " --without-cap-ng --disable-setpriv"
123EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv" 142EXTRA_OECONF:append:class-nativesdk = " --without-cap-ng --disable-setpriv"
124EXTRA_OECONF_append = " --disable-hwclock-gplv3" 143EXTRA_OECONF:append = " --disable-hwclock-gplv3"
125 144
126# enable pcre2 for native/nativesdk to match host distros 145# enable pcre2 for native/nativesdk to match host distros
127# this helps to keep same expectations when using the SDK or 146# this helps to keep same expectations when using the SDK or
128# build host versions during development 147# build host versions during development
129# 148#
130PACKAGECONFIG ?= "pcre2" 149PACKAGECONFIG ?= "pcre2"
131PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" 150PACKAGECONFIG:class-target ?= "\
151 libmount-mountfd-support \
152 ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam lastlog2', '', d)} \
153"
132# inherit manpages requires this to be present, however util-linux does not have 154# inherit manpages requires this to be present, however util-linux does not have
133# configuration options, and installs manpages always 155# configuration options, and installs manpages always
134PACKAGECONFIG[manpages] = "" 156PACKAGECONFIG[manpages] = ""
@@ -141,51 +163,76 @@ PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-pytho
141PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" 163PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
142# PCRE support in hardlink 164# PCRE support in hardlink
143PACKAGECONFIG[pcre2] = ",,libpcre2" 165PACKAGECONFIG[pcre2] = ",,libpcre2"
166PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup"
167PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh,"
168PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
169PACKAGECONFIG[lastlog2] = "--enable-liblastlog2,--disable-liblastlog2,sqlite3"
170# Using the new file descriptors based mount kernel API can cause rootfs remount failure with some older kernels.
171# Of currently supported LTS kernels, the old mount API should be used with:
172# - versions prior to 6.6.18 in the 6.6.y series.
173# - versions prior to 6.1.79 in the 6.1.y series.
174# - versions till at least 5.15.164 in the 5.15.y series.
175# - with 5.10.y, 5.4.y and 4.19.y series kernels, libmount seemed to use the old API regardless of this option.
176PACKAGECONFIG[libmount-mountfd-support] = "--enable-libmount-mountfd-support,--disable-libmount-mountfd-support"
144 177
145EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'" 178EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
146 179
147ALLOW_EMPTY_${PN} = "1" 180ALLOW_EMPTY:${PN} = "1"
148FILES_${PN} = "" 181FILES:${PN} = ""
149FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*" 182FILES:${PN}-doc += "${datadir}/getopt/getopt-*.*"
150FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la" 183FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
151FILES_${PN}-mount = "${sysconfdir}/default/mountall" 184FILES:${PN}-mount = "${sysconfdir}/default/mountall"
152FILES_${PN}-runuser = "${sysconfdir}/pam.d/runuser*" 185FILES:${PN}-runuser = "${sysconfdir}/pam.d/runuser*"
153FILES_${PN}-su = "${sysconfdir}/pam.d/su-l" 186FILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
154CONFFILES_${PN}-su = "${sysconfdir}/pam.d/su-l" 187CONFFILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
155FILES_${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \ 188FILES:${PN}-lastlog2 += "${base_libdir}/security/pam_lastlog2.so \
189 ${nonarch_libdir}/tmpfiles.d/lastlog2.conf \
190 ${sysconfdir}/default/volatiles/99_lastlog2"
191FILES:${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
156 ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \ 192 ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
157 ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*" 193 ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
158 194
159# Util-linux' blkid replaces the e2fsprogs one 195# Util-linux' blkid replaces the e2fsprogs one
160RCONFLICTS_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" 196RCONFLICTS:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
161RREPLACES_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" 197RREPLACES:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
162 198
163RRECOMMENDS_${PN}_class-native = "" 199RRECOMMENDS:${PN}:class-native = ""
164RRECOMMENDS_${PN}_class-nativesdk = "" 200RRECOMMENDS:${PN}:class-nativesdk = ""
165RDEPENDS_${PN}_class-native = "" 201RDEPENDS:${PN}:class-native = ""
166RDEPENDS_${PN}_class-nativesdk = "" 202RDEPENDS:${PN}:class-nativesdk = ""
167 203
168RPROVIDES_${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev ${PN}-libuuid-dev" 204RDEPENDS:${PN} += " util-linux-libuuid"
205RDEPENDS:${PN}-dev += " util-linux-libuuid-dev"
169 206
170RDEPENDS_${PN}-bash-completion += "${PN}-lsblk" 207RPROVIDES:${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev"
171RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs grep iproute2 kmod mdadm procps sed socat which xz" 208
172RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug" 209RDEPENDS:${PN}-bash-completion += "${PN}-lsblk ${PN}-findmnt"
173RDEPENDS_${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff" 210RDEPENDS:${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod procps sed socat which xz diffutils"
174ALLOW_EMPTY_${PN}-swaponoff = "1" 211RRECOMMENDS:${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop kernel-module-algif-hash"
212RDEPENDS:${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
213ALLOW_EMPTY:${PN}-swaponoff = "1"
175 214
176#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim" 215#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
177SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service" 216SYSTEMD_SERVICE:${PN}-uuidd = "uuidd.socket uuidd.service"
178SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable" 217SYSTEMD_AUTO_ENABLE:${PN}-uuidd = "disable"
179SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service" 218SYSTEMD_SERVICE:${PN}-fstrim = "fstrim.timer fstrim.service"
180SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable" 219SYSTEMD_AUTO_ENABLE:${PN}-fstrim = "disable"
181 220
182do_install () { 221do_compile:prepend () {
183 # with ccache the timestamps on compiled files may 222 # this is a workaround for the unnecessary remake problem. Issue and PR are as below:
184 # end up earlier than on their inputs, this allows 223 # https://github.com/util-linux/util-linux/issues/3061
185 # for the resultant compilation in the install step. 224 # https://github.com/util-linux/util-linux/pull/3064
186 oe_runmake 'CC=${CC}' 'LD=${LD}' \ 225 # When newly release tarball contains the above fix, the following workaround could be dropped.
187 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install 226 [ -e ${S}/libsmartcols/src/filter-scanner.c ] && touch ${S}/libsmartcols/src/filter-scanner.c
227 [ -e ${S}/libsmartcols/src/filter-parser.c ] && touch ${S}/libsmartcols/src/filter-parser.c
228}
188 229
230do_compile:append () {
231 cp ${UNPACKDIR}/fcntl-lock.c ${S}/fcntl-lock.c
232 ${CC} ${CFLAGS} ${LDFLAGS} ${S}/fcntl-lock.c -o ${B}/fcntl-lock
233}
234
235do_install:append () {
189 mkdir -p ${D}${base_bindir} 236 mkdir -p ${D}${base_bindir}
190 237
191 sbinprogs="agetty ctrlaltdel cfdisk vipw vigr" 238 sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
@@ -214,49 +261,74 @@ do_install () {
214 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall 261 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
215 262
216 rm -f ${D}${bindir}/chkdupexe 263 rm -f ${D}${bindir}/chkdupexe
264
265 install -m 0755 ${B}/fcntl-lock ${D}${bindir}
217} 266}
218 267
219do_install_append_class-target () { 268do_install:append:class-target () {
220 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then 269 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
221 install -d ${D}${sysconfdir}/pam.d 270 install -d ${D}${sysconfdir}/pam.d
222 install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser 271 install -m 0644 ${UNPACKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
223 install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l 272 install -m 0644 ${UNPACKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
224 # Required for "su -" aka "su --login" because 273 # Required for "su -" aka "su --login" because
225 # otherwise it uses "other", which has "auth pam_deny.so" 274 # otherwise it uses "other", which has "auth pam_deny.so"
226 # and thus prevents the operation. 275 # and thus prevents the operation.
227 ln -s su ${D}${sysconfdir}/pam.d/su-l 276 ln -s su ${D}${sysconfdir}/pam.d/su-l
277
278 if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
279 install -d ${D}${nonarch_libdir}/tmpfiles.d
280 install -m 0644 ${S}/misc-utils/lastlog2-tmpfiles.conf.in \
281 ${D}${nonarch_libdir}/tmpfiles.d/lastlog2.conf
282 fi
283
284 if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
285 install -d ${D}${sysconfdir}/default/volatiles
286 echo "d root root 0755 /var/lib/lastlog none" \
287 > ${D}${sysconfdir}/default/volatiles/99_lastlog2
288 fi
228 fi 289 fi
229} 290}
230# nologin causes a conflict with shadow-native 291# nologin causes a conflict with shadow-native
231# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir}) 292# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir})
232do_install_append_class-native () { 293do_install:append:class-native () {
233 rm -f ${D}${base_sbindir}/nologin 294 rm -f ${D}${base_sbindir}/nologin
234 rm -f ${D}${base_bindir}/kill 295 rm -f ${D}${base_bindir}/kill
235} 296}
236 297
298# dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds
299# Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it
300do_install:append () {
301 rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid*
302}
303
237ALTERNATIVE_PRIORITY = "80" 304ALTERNATIVE_PRIORITY = "80"
238 305
239ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid" 306ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
240ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev" 307ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
241ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal" 308ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
309ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn"
310ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh"
242ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt" 311ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
243ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg" 312ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
244ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject" 313ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
245ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate" 314ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate"
246ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk" 315ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
316ALTERNATIVE_LINK_NAME[findfs] = "${sbindir}/findfs"
247ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock" 317ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock"
248ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck" 318ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
249ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze" 319ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
250ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim" 320ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim"
251ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt" 321ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
252ALTERNATIVE_${PN}-agetty = "getty" 322ALTERNATIVE:${PN}-agetty = "getty"
253ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty" 323ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
254ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty" 324ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
255ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump" 325ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump"
256ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock" 326ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
257ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice" 327ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice"
328ALTERNATIVE_LINK_NAME[ipcrm] = "${bindir}/ipcrm"
329ALTERNATIVE_LINK_NAME[ipcs] = "${bindir}/ipcs"
258ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill" 330ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
259ALTERNATIVE_${PN}-last = "last lastb" 331ALTERNATIVE:${PN}-last = "last lastb"
260ALTERNATIVE_LINK_NAME[last] = "${bindir}/last" 332ALTERNATIVE_LINK_NAME[last] = "${bindir}/last"
261ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb" 333ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb"
262ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger" 334ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger"
@@ -276,6 +348,7 @@ ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice"
276ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev" 348ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev"
277ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill" 349ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill"
278ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake" 350ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake"
351ALTERNATIVE_LINK_NAME[scriptreplay] = "${bindir}/scriptreplay"
279ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv" 352ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv"
280ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid" 353ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid"
281ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" 354ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
@@ -290,13 +363,16 @@ ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump"
290ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen" 363ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen"
291ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall" 364ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall"
292 365
293ALTERNATIVE_${PN}-doc = "\ 366ALTERNATIVE:${PN}-doc = "\
294blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \ 367blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \
295mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\ 368mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\
296" 369"
297ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}" 370ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
371ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'chfn-chsh', 'chfn.1 chsh.1', '', d)}"
298 372
299ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8" 373ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
374ALTERNATIVE_LINK_NAME[chfn.1] = "${mandir}/man1/chfn.1"
375ALTERNATIVE_LINK_NAME[chsh.1] = "${mandir}/man1/chsh.1"
300ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1" 376ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
301ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8" 377ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
302ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8" 378ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
@@ -316,7 +392,6 @@ ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
316ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3" 392ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
317ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1" 393ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
318 394
319
320BBCLASSEXTEND = "native nativesdk" 395BBCLASSEXTEND = "native nativesdk"
321 396
322PTEST_BINDIR = "1" 397PTEST_BINDIR = "1"
@@ -333,27 +408,30 @@ do_install_ptest() {
333 cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/ 408 cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/
334 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected 409 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
335 cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/ 410 cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
336 cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH} 411 cp ${B}/config.h ${D}${PTEST_PATH}
337 412
338 # The original paths of executables to be tested point to a local folder containing 413 sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
339 # the executables. We want to test the installed executables, not the local copies. 414
340 # So strip the paths, the executables will be located via "which" 415 if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then
341 sed -i \ 416 # chfn needs PAM
342 -e '/^TS_CMD/ s|$top_builddir/||g' \ 417 rm -rf ${D}${PTEST_PATH}/tests/ts/chfn
343 -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \ 418 # su is not enabled when pam is not in PACKAGECONFIG
344 ${D}${PTEST_PATH}/tests/commands.sh 419 rm -rf ${D}${PTEST_PATH}/tests/ts/su
345 420 fi
346 # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]' 421 # remove raid tests, known failures and avoid dependency on mdadm therefore
347 sed -i -e \ 422 # See https://github.com/util-linux/util-linux/commit/7519c3edab120b14623931d5ddb16fdc6e7cad5d
348 '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \ 423 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid0-whole
349 ${D}${PTEST_PATH}/tests/functions.sh 424 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-part
350 425 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-whole
351 # Running "kill" without the the complete path would use the shell's built-in kill 426 rm -rf ${D}${PTEST_PATH}/tests/ts/fdisk/align-512-4K-md
352 sed -i -e \ 427}
353 '/^TS_CMD_KILL/ s|kill|${PTEST_PATH}/bin/kill|g' \
354 ${D}${PTEST_PATH}/tests/commands.sh
355
356
357 sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
358 428
429# Delete tests not working on musl
430do_install_ptest:append:libc-musl() {
431 for t in tests/ts/col/multibyte \
432 tests/ts/lib/timeutils \
433 tests/ts/misc/enosys \
434 tests/ts/dmesg/limit; do
435 rm -rf ${D}${PTEST_PATH}/$t
436 done
359} 437}