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.39.3.bb19
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc45
-rw-r--r--meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch60
-rw-r--r--meta/recipes-core/util-linux/util-linux/avoid_parallel_tests.patch27
-rw-r--r--meta/recipes-core/util-linux/util-linux/configure-sbindir.patch19
-rw-r--r--meta/recipes-core/util-linux/util-linux/display_testname_for_subtest.patch12
-rw-r--r--meta/recipes-core/util-linux/util-linux/fcntl-lock.c332
-rw-r--r--meta/recipes-core/util-linux/util-linux/mit-license.patch45
-rw-r--r--meta/recipes-core/util-linux/util-linux/ptest.patch15
-rw-r--r--meta/recipes-core/util-linux/util-linux/run-ptest34
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.39.3.bb (renamed from meta/recipes-core/util-linux/util-linux_2.36.2.bb)213
11 files changed, 661 insertions, 160 deletions
diff --git a/meta/recipes-core/util-linux/util-linux-libuuid_2.39.3.bb b/meta/recipes-core/util-linux/util-linux-libuuid_2.39.3.bb
new file mode 100644
index 0000000000..ec04c1d384
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux-libuuid_2.39.3.bb
@@ -0,0 +1,19 @@
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
6inherit autotools gettext pkgconfig
7
8S = "${WORKDIR}/util-linux-${PV}"
9
10EXTRA_AUTORECONF += "--exclude=gtkdocize"
11EXTRA_OECONF += "--disable-all-programs --enable-libuuid"
12
13LICENSE = "BSD-3-Clause"
14
15do_install:append() {
16 rm -rf ${D}${datadir} ${D}${bindir} ${D}${base_bindir} ${D}${sbindir} ${D}${base_sbindir} ${D}${exec_prefix}/sbin
17}
18
19BBCLASSEXTEND = "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..d506783f9a
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux.inc
@@ -0,0 +1,45 @@
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
9LICENSE = "GPL-1.0-or-later & GPL-2.0-or-later & LGPL-2.1-or-later & BSD-2-Clause & BSD-3-Clause & BSD-4-Clause & MIT"
10LICENSE:${PN}-fcntl-lock = "MIT"
11LICENSE:${PN}-fdisk = "GPL-1.0-or-later"
12LICENSE:${PN}-libblkid = "LGPL-2.1-or-later"
13LICENSE:${PN}-libfdisk = "LGPL-2.1-or-later"
14LICENSE:${PN}-libmount = "LGPL-2.1-or-later"
15LICENSE:${PN}-libsmartcols = "LGPL-2.1-or-later"
16
17LIC_FILES_CHKSUM = "file://README.licensing;md5=cc80239f106687ab39ef0271ff5cf4ba \
18 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
19 file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
20 file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \
21 file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af \
22 file://Documentation/licenses/COPYING.BSD-4-Clause-UC;md5=263860f8968d8bafa5392cab74285262 \
23 file://libuuid/COPYING;md5=6d2cafc999feb2c2de84d4d24b23290c \
24 file://libmount/COPYING;md5=7c7e39fb7d70ffe5d693a643e29987c2 \
25 file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
26 file://libfdisk/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
27 file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
28 "
29
30FILESEXTRAPATHS:prepend := "${THISDIR}/util-linux:"
31MAJOR_VERSION = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
32SRC_URI = "${KERNELORG_MIRROR}/linux/utils/util-linux/v${MAJOR_VERSION}/util-linux-${PV}.tar.xz \
33 file://mit-license.patch \
34 file://configure-sbindir.patch \
35 file://runuser.pamd \
36 file://runuser-l.pamd \
37 file://ptest.patch \
38 file://run-ptest \
39 file://display_testname_for_subtest.patch \
40 file://avoid_parallel_tests.patch \
41 file://0001-login-utils-include-libgen.h-for-basename-API.patch \
42 file://fcntl-lock.c \
43 "
44
45SRC_URI[sha256sum] = "7b6605e48d1a49f43cc4b4cfc59f313d0dd5402fa40b96810bd572e167dfed0f"
diff --git a/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch b/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch
new file mode 100644
index 0000000000..6258710e1e
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/0001-login-utils-include-libgen.h-for-basename-API.patch
@@ -0,0 +1,60 @@
1From d44e3ad1f6f8b5c1b3098bb7d537943a4c21d22f Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 3 Dec 2023 19:59:46 -0800
4Subject: [PATCH] login-utils: include libgen.h for basename API
5
6musl has removed the non-prototype declaration of basename from string.h [1] which now results in build errors with clang-17+ compiler
7
8include libgen.h for using the posix declaration of the funciton.
9
10Fixes
11
12../util-linux-2.39.2/login-utils/su-common.c:847:20: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
13 847 | shell_basename = basename(shell);
14 | ^
15
16[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
17
18Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2615]
19Signed-off-by: Khem Raj <raj.khem@gmail.com>
20
21---
22 login-utils/su-common.c | 10 +++++++---
23 1 file changed, 7 insertions(+), 3 deletions(-)
24
25diff --git a/login-utils/su-common.c b/login-utils/su-common.c
26index b674920..3297c78 100644
27--- a/login-utils/su-common.c
28+++ b/login-utils/su-common.c
29@@ -26,6 +26,7 @@
30 #include <sys/types.h>
31 #include <pwd.h>
32 #include <grp.h>
33+#include <libgen.h>
34 #include <security/pam_appl.h>
35 #ifdef HAVE_SECURITY_PAM_MISC_H
36 # include <security/pam_misc.h>
37@@ -840,17 +841,20 @@ static void run_shell(
38 su->simulate_login ? " login" : "",
39 su->fast_startup ? " fast-start" : ""));
40
41+ char* tmp = xstrdup(shell);
42 if (su->simulate_login) {
43 char *arg0;
44 char *shell_basename;
45
46- shell_basename = basename(shell);
47+ shell_basename = basename(tmp);
48 arg0 = xmalloc(strlen(shell_basename) + 2);
49 arg0[0] = '-';
50 strcpy(arg0 + 1, shell_basename);
51 args[0] = arg0;
52- } else
53- args[0] = basename(shell);
54+ } else {
55+ args[0] = basename(tmp);
56+ }
57+ free(tmp);
58
59 if (su->fast_startup)
60 args[argno++] = "-f";
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..85ad7a5575 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,29 @@
1From 0b05e4695a0616badef71dfa459a00ef6ff1b521 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---
14 configure.ac | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
7 16
8Index: util-linux-2.32/configure.ac 17diff --git a/configure.ac b/configure.ac
9=================================================================== 18index 890212f..870e817 100644
10--- util-linux-2.32.orig/configure.ac 19--- a/configure.ac
11+++ util-linux-2.32/configure.ac 20+++ b/configure.ac
12@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4]) 21@@ -11,7 +11,7 @@ AC_CONFIG_MACRO_DIR([m4])
13 dnl AC_USE_SYSTEM_EXTENSIONS must be called before any macros that run 22 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. 23 dnl the compiler (like LT_INIT) to avoid autoconf errors.
15 AC_USE_SYSTEM_EXTENSIONS 24 AC_USE_SYSTEM_EXTENSIONS
16-AM_INIT_AUTOMAKE([-Wall foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects]) 25-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]) 26+AM_INIT_AUTOMAKE([-Wall -Wno-portability foreign 1.10 tar-pax no-dist-gzip dist-xz subdir-objects serial-tests])
18 27
19 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], 28 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
20 [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) 29 [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..75adeca188 100644
--- a/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
+++ b/meta/recipes-core/util-linux/util-linux/configure-sbindir.patch
@@ -1,3 +1,8 @@
1From c79222a9a5e3425c55e150edc0b7ac59c573aa2f 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
@@ -5,11 +10,15 @@ Signed-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]
7 12
8Index: util-linux-2.31/configure.ac 13---
9=================================================================== 14 configure.ac | 5 ++++-
10--- util-linux-2.31.orig/configure.ac 15 1 file changed, 4 insertions(+), 1 deletion(-)
11+++ util-linux-2.31/configure.ac 16
12@@ -89,7 +89,10 @@ AC_SUBST([runstatedir]) 17diff --git a/configure.ac b/configure.ac
18index 36c24b4..890212f 100644
19--- a/configure.ac
20+++ b/configure.ac
21@@ -102,7 +102,10 @@ AC_SUBST([runstatedir])
13 usrbin_execdir='${exec_prefix}/bin' 22 usrbin_execdir='${exec_prefix}/bin'
14 AC_SUBST([usrbin_execdir]) 23 AC_SUBST([usrbin_execdir])
15 24
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..815ae9c915 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,4 +1,7 @@
1Display testname for subtest 1From fc5de1de898fd1a372a2fd2fa493dc57323a029d 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
@@ -8,10 +11,10 @@ Upstream-Status: Pending
8 1 file changed, 1 insertion(+), 1 deletion(-) 11 1 file changed, 1 insertion(+), 1 deletion(-)
9 12
10diff --git a/tests/functions.sh b/tests/functions.sh 13diff --git a/tests/functions.sh b/tests/functions.sh
11index 5246605..b24dc15 100644 14index 5a562a3..098145e 100644
12--- a/tests/functions.sh 15--- a/tests/functions.sh
13+++ b/tests/functions.sh 16+++ b/tests/functions.sh
14@@ -320,7 +320,7 @@ function ts_init_subtest { 17@@ -437,7 +437,7 @@ function ts_init_subtest {
15 18
16 if [ "$TS_PARSABLE" != "yes" ]; then 19 if [ "$TS_PARSABLE" != "yes" ]; then
17 [ $TS_NSUBTESTS -eq 1 ] && echo 20 [ $TS_NSUBTESTS -eq 1 ] && echo
@@ -20,6 +23,3 @@ index 5246605..b24dc15 100644
20 fi 23 fi
21 } 24 }
22 25
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/mit-license.patch b/meta/recipes-core/util-linux/util-linux/mit-license.patch
new file mode 100644
index 0000000000..afbec98f18
--- /dev/null
+++ b/meta/recipes-core/util-linux/util-linux/mit-license.patch
@@ -0,0 +1,45 @@
1From 5b8fab1584017d9d9be008c23b90128bba41a7b5 Mon Sep 17 00:00:00 2001
2From: Richard Purdie <richard.purdie@linuxfoundation.org>
3Date: Thu, 28 Mar 2024 12:16:57 +0000
4Subject: [PATCH] README.licensing/flock: Add MIT license mention
5
6Looking at the license text, flock.c is under the MIT license (see
7https://spdx.org/licenses/MIT).
8
9Add an SPDX license identifier header and add to the list of licenses the
10source so everything is correctly listed/identified.
11
12Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
13
14Upstream-Status: Submitted [https://github.com/util-linux/util-linux/pull/2870]
15
16---
17 README.licensing | 2 ++
18 sys-utils/flock.c | 4 +++-
19 2 files changed, 5 insertions(+), 1 deletion(-)
20
21diff --git a/README.licensing b/README.licensing
22index 4454f8392a..535ad34813 100644
23--- a/README.licensing
24+++ b/README.licensing
25@@ -12,6 +12,8 @@ There is code under:
26
27 * LGPL-2.1-or-later - GNU Lesser General Public License 2.1 or any later version
28
29+ * MIT - MIT License
30+
31 * BSD-2-Clause - Simplified BSD License
32
33 * BSD-3-Clause - BSD 3-Clause "New" or "Revised" License
34diff --git a/sys-utils/flock.c b/sys-utils/flock.c
35index fed29d7270..7d878ff810 100644
36--- a/sys-utils/flock.c
37+++ b/sys-utils/flock.c
38@@ -1,4 +1,6 @@
39-/* Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
40+/* SPDX-License-Identifier: MIT
41+ *
42+ * Copyright 2003-2005 H. Peter Anvin - All Rights Reserved
43 *
44 * Permission is hereby granted, free of charge, to any person
45 * obtaining a copy of this software and associated documentation
diff --git a/meta/recipes-core/util-linux/util-linux/ptest.patch b/meta/recipes-core/util-linux/util-linux/ptest.patch
index 0537f7d856..6221de7182 100644
--- a/meta/recipes-core/util-linux/util-linux/ptest.patch
+++ b/meta/recipes-core/util-linux/util-linux/ptest.patch
@@ -1,23 +1,24 @@
1Define TESTS variable 1From d0a69ce80c579cbb7627a2f20e8b92e006a8d8ad 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
8
5--- 9---
6 Makefile.am | 1 + 10 Makefile.am | 1 +
7 1 file changed, 1 insertion(+) 11 1 file changed, 1 insertion(+)
8 12
9diff --git a/Makefile.am b/Makefile.am 13diff --git a/Makefile.am b/Makefile.am
10index bbaccb1..7d5a6bb 100644 14index effbb02..7d2bd1e 100644
11--- a/Makefile.am 15--- a/Makefile.am
12+++ b/Makefile.am 16+++ b/Makefile.am
13@@ -48,6 +48,7 @@ systemdsystemunit_DATA = 17@@ -57,6 +57,7 @@ systemdsystemunit_DATA =
14 dist_bashcompletion_DATA = 18 dist_bashcompletion_DATA =
15 check_PROGRAMS = 19 check_PROGRAMS =
16 dist_check_SCRIPTS = 20 dist_check_SCRIPTS =
17+TESTS = $(check_PROGRAMS) 21+TESTS = $(check_PROGRAMS)
18 22
19 PATHFILES = 23 PATHFILES =
20 24 ADOCFILES_COMMON =
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..7b6b1d1dc2 100644
--- a/meta/recipes-core/util-linux/util-linux/run-ptest
+++ b/meta/recipes-core/util-linux/util-linux/run-ptest
@@ -13,31 +13,23 @@ 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
17 17modprobe loop
18comps=$(find ts/ -type f -perm -111 -regex ".*/[^\.~]*" | sort) 18
19 19# required for mount/fallback test to pass
20 20# systemd does this by default, but ptest images do not use it
21echo 21# see https://man7.org/linux/man-pages/man7/mount_namespaces.7.html
22echo "-------------------- util-linux regression tests --------------------" 22# for a long description of mount namespaces in Linux
23echo 23mount --make-shared /
24echo " For development purpose only. " 24
25echo " Don't execute on production system! " 25# lsfd/option-inet has races in the test script:
26echo 26# https://github.com/util-linux/util-linux/issues/2399
27 27./tests/run.sh --use-system-commands --parsable --show-diff --exclude=lsfd/option-inet | sed -u '{
28res=0
29count=0
30for ts in $comps;
31do
32 $ts | sed -u '{
33 s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/ 28 s/^\(.*\):\(.*\) \.\.\. OK$/PASS: \1:\2/
34 s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/ 29 s/^\(.*\):\(.*\) \.\.\. FAILED \(.*\)$/FAIL: \1:\2 \3/
35 s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/ 30 s/^\(.*\):\(.*\) \.\.\. SKIPPED \(.*\)$/SKIP: \1:\2 \3/
36 }' 31 }'
37done
38
39 32
40if [ "x$UDEV_PID" != "x" ]; then 33if [ "x$UDEV_PID" != "x" ]; then
41 /etc/init.d/udev start 34 /etc/init.d/udev start
42fi 35fi
43
diff --git a/meta/recipes-core/util-linux/util-linux_2.36.2.bb b/meta/recipes-core/util-linux/util-linux_2.39.3.bb
index 19950a2726..a3f9badbd9 100644
--- a/meta/recipes-core/util-linux/util-linux_2.36.2.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.39.3.bb
@@ -1,46 +1,7 @@
1SUMMARY = "A suite of basic system administration utilities" 1require util-linux.inc
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
9LICENSE = "GPLv2+ & LGPLv2.1+ & BSD-3-Clause & BSD-4-Clause"
10LICENSE_${PN}-libblkid = "LGPLv2.1+"
11LICENSE_${PN}-libfdisk = "LGPLv2.1+"
12LICENSE_${PN}-libmount = "LGPLv2.1+"
13LICENSE_${PN}-libsmartcols = "LGPLv2.1+"
14LICENSE_${PN}-libuuid = "BSD-3-Clause"
15
16LIC_FILES_CHKSUM = "file://README.licensing;md5=0fd5c050c6187d2bf0a4492b7f4e33da \
17 file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
18 file://Documentation/licenses/COPYING.GPL-2.0-or-later;md5=b234ee4d69f5fce4486a80fdaf4a4263 \
19 file://Documentation/licenses/COPYING.LGPL-2.1-or-later;md5=4fbd65380cdd255951079008b364516c \
20 file://Documentation/licenses/COPYING.BSD-3-Clause;md5=58dcd8452651fc8b07d1f65ce07ca8af \
21 file://Documentation/licenses/COPYING.BSD-4-Clause-UC;md5=263860f8968d8bafa5392cab74285262 \
22 file://libuuid/COPYING;md5=6d2cafc999feb2c2de84d4d24b23290c \
23 file://libmount/COPYING;md5=7c7e39fb7d70ffe5d693a643e29987c2 \
24 file://libblkid/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
25 file://libfdisk/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
26 file://libsmartcols/COPYING;md5=693bcbbe16d3a4a4b37bc906bc01cc04 \
27"
28 2
29#gtk-doc is not enabled as it requires xmlto which requires util-linux 3inherit 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 4DEPENDS = "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 5
45PACKAGES =+ "${PN}-swaponoff" 6PACKAGES =+ "${PN}-swaponoff"
46PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}" 7PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}"
@@ -48,12 +9,12 @@ PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmou
48python util_linux_binpackages () { 9python util_linux_binpackages () {
49 def pkg_hook(f, pkg, file_regex, output_pattern, modulename): 10 def pkg_hook(f, pkg, file_regex, output_pattern, modulename):
50 pn = d.getVar('PN') 11 pn = d.getVar('PN')
51 d.appendVar('RRECOMMENDS_%s' % pn, ' %s' % pkg) 12 d.appendVar('RRECOMMENDS:%s' % pn, ' %s' % pkg)
52 13
53 if d.getVar('ALTERNATIVE_' + pkg): 14 if d.getVar('ALTERNATIVE:' + pkg):
54 return 15 return
55 if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename): 16 if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename):
56 d.setVar('ALTERNATIVE_' + pkg, modulename) 17 d.setVar('ALTERNATIVE:' + pkg, modulename)
57 18
58 bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split()))) 19 bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split())))
59 for dir in bindirs: 20 for dir in bindirs:
@@ -75,20 +36,22 @@ python util_linux_binpackages () {
75 continue 36 continue
76 37
77 pkg = os.path.basename(os.readlink(file)) 38 pkg = os.path.basename(os.readlink(file))
78 extras[pkg] = extras.get(pkg, '') + ' ' + file.replace(dvar, '', 1) 39 extras.setdefault(pkg, [])
40 extras[pkg].append(file.replace(dvar, '', 1))
79 41
80 pn = d.getVar('PN') 42 pn = d.getVar('PN')
81 for pkg, links in extras.items(): 43 for pkg, links in extras.items():
82 of = d.getVar('FILES_' + pn + '-' + pkg) 44 of = d.getVar('FILES:' + pn + '-' + pkg)
83 links = of + links 45 links = of + " " + " ".join(sorted(links))
84 d.setVar('FILES_' + pn + '-' + pkg, links) 46 d.setVar('FILES:' + pn + '-' + pkg, links)
85} 47}
86 48
87# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS 49# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS
88PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages " 50PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages "
89 51
52# skip libuuid as it will be packaged by the util-linux-libuuid recipe
90python util_linux_libpackages() { 53python util_linux_libpackages() {
91 do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(.*)\.so\..*$', 54 do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(?!uuid)(.*)\.so\..*$',
92 output_pattern='${PN}-lib%s', 55 output_pattern='${PN}-lib%s',
93 description='${PN} lib%s', 56 description='${PN} lib%s',
94 extra_depends='', prepend=True, allow_links=True) 57 extra_depends='', prepend=True, allow_links=True)
@@ -98,19 +61,18 @@ PACKAGESPLITFUNCS =+ "util_linux_libpackages"
98 61
99PACKAGES_DYNAMIC = "^${PN}-.*" 62PACKAGES_DYNAMIC = "^${PN}-.*"
100 63
101CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
102UTIL_LINUX_LIBDIR = "${libdir}" 64UTIL_LINUX_LIBDIR = "${libdir}"
103UTIL_LINUX_LIBDIR_class-target = "${base_libdir}" 65UTIL_LINUX_LIBDIR:class-target = "${base_libdir}"
104EXTRA_OECONF = "\ 66EXTRA_OECONF = "\
105 --enable-libuuid --enable-libblkid \ 67 --enable-libuuid --enable-libblkid \
106 \ 68 \
107 --enable-fsck --enable-kill --enable-last --enable-mesg \ 69 --enable-fsck --enable-kill --enable-last --enable-mesg \
108 --enable-mount --enable-partx --enable-raw --enable-rfkill \ 70 --enable-mount --enable-partx --enable-rfkill \
109 --enable-unshare --enable-write \ 71 --enable-unshare --enable-write \
110 \ 72 \
111 --disable-bfs --disable-chfn-chsh --disable-login \ 73 --disable-bfs --disable-login \
112 --disable-makeinstall-chown --disable-minix --disable-newgrp \ 74 --disable-makeinstall-chown --disable-minix --disable-newgrp \
113 --disable-use-tty-group --disable-vipw \ 75 --disable-use-tty-group --disable-vipw --disable-raw \
114 \ 76 \
115 --without-udev \ 77 --without-udev \
116 \ 78 \
@@ -118,17 +80,17 @@ EXTRA_OECONF = "\
118 --libdir='${UTIL_LINUX_LIBDIR}' \ 80 --libdir='${UTIL_LINUX_LIBDIR}' \
119" 81"
120 82
121EXTRA_OECONF_append_class-target = " --enable-setpriv" 83EXTRA_OECONF:append:class-target = " --enable-setpriv"
122EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv" 84EXTRA_OECONF:append:class-native = " --without-cap-ng --disable-setpriv"
123EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv" 85EXTRA_OECONF:append:class-nativesdk = " --without-cap-ng --disable-setpriv"
124EXTRA_OECONF_append = " --disable-hwclock-gplv3" 86EXTRA_OECONF:append = " --disable-hwclock-gplv3"
125 87
126# enable pcre2 for native/nativesdk to match host distros 88# enable pcre2 for native/nativesdk to match host distros
127# this helps to keep same expectations when using the SDK or 89# this helps to keep same expectations when using the SDK or
128# build host versions during development 90# build host versions during development
129# 91#
130PACKAGECONFIG ?= "pcre2" 92PACKAGECONFIG ?= "pcre2"
131PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}" 93PACKAGECONFIG:class-target ?= "${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'chfn-chsh pam', '', d)}"
132# inherit manpages requires this to be present, however util-linux does not have 94# inherit manpages requires this to be present, however util-linux does not have
133# configuration options, and installs manpages always 95# configuration options, and installs manpages always
134PACKAGECONFIG[manpages] = "" 96PACKAGECONFIG[manpages] = ""
@@ -141,43 +103,54 @@ PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-pytho
141PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline" 103PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
142# PCRE support in hardlink 104# PCRE support in hardlink
143PACKAGECONFIG[pcre2] = ",,libpcre2" 105PACKAGECONFIG[pcre2] = ",,libpcre2"
106PACKAGECONFIG[cryptsetup] = "--with-cryptsetup,--without-cryptsetup,cryptsetup"
107PACKAGECONFIG[chfn-chsh] = "--enable-chfn-chsh,--disable-chfn-chsh,"
108PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux"
144 109
145EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'" 110EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
146 111
147ALLOW_EMPTY_${PN} = "1" 112ALLOW_EMPTY:${PN} = "1"
148FILES_${PN} = "" 113FILES:${PN} = ""
149FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*" 114FILES:${PN}-doc += "${datadir}/getopt/getopt-*.*"
150FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la" 115FILES:${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
151FILES_${PN}-mount = "${sysconfdir}/default/mountall" 116FILES:${PN}-mount = "${sysconfdir}/default/mountall"
152FILES_${PN}-runuser = "${sysconfdir}/pam.d/runuser*" 117FILES:${PN}-runuser = "${sysconfdir}/pam.d/runuser*"
153FILES_${PN}-su = "${sysconfdir}/pam.d/su-l" 118FILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
154CONFFILES_${PN}-su = "${sysconfdir}/pam.d/su-l" 119CONFFILES:${PN}-su = "${sysconfdir}/pam.d/su-l"
155FILES_${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \ 120FILES:${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
156 ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \ 121 ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
157 ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*" 122 ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
158 123
159# Util-linux' blkid replaces the e2fsprogs one 124# Util-linux' blkid replaces the e2fsprogs one
160RCONFLICTS_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" 125RCONFLICTS:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
161RREPLACES_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid" 126RREPLACES:${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
127
128RRECOMMENDS:${PN}:class-native = ""
129RRECOMMENDS:${PN}:class-nativesdk = ""
130RDEPENDS:${PN}:class-native = ""
131RDEPENDS:${PN}:class-nativesdk = ""
162 132
163RRECOMMENDS_${PN}_class-native = "" 133RDEPENDS:${PN} += " util-linux-libuuid"
164RRECOMMENDS_${PN}_class-nativesdk = "" 134RDEPENDS:${PN}-dev += " util-linux-libuuid-dev"
165RDEPENDS_${PN}_class-native = ""
166RDEPENDS_${PN}_class-nativesdk = ""
167 135
168RPROVIDES_${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev ${PN}-libuuid-dev" 136RPROVIDES:${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev"
169 137
170RDEPENDS_${PN}-bash-completion += "${PN}-lsblk" 138RDEPENDS:${PN}-bash-completion += "${PN}-lsblk"
171RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs grep iproute2 kmod mdadm procps sed socat which xz" 139RDEPENDS:${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs findutils grep iproute2 kmod procps sed socat which xz"
172RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug" 140RRECOMMENDS:${PN}-ptest += "kernel-module-scsi-debug kernel-module-sd-mod kernel-module-loop kernel-module-algif-hash"
173RDEPENDS_${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff" 141RDEPENDS:${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
174ALLOW_EMPTY_${PN}-swaponoff = "1" 142ALLOW_EMPTY:${PN}-swaponoff = "1"
175 143
176#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim" 144#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
177SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service" 145SYSTEMD_SERVICE:${PN}-uuidd = "uuidd.socket uuidd.service"
178SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable" 146SYSTEMD_AUTO_ENABLE:${PN}-uuidd = "disable"
179SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service" 147SYSTEMD_SERVICE:${PN}-fstrim = "fstrim.timer fstrim.service"
180SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable" 148SYSTEMD_AUTO_ENABLE:${PN}-fstrim = "disable"
149
150do_compile:append () {
151 cp ${WORKDIR}/fcntl-lock.c ${S}/fcntl-lock.c
152 ${CC} ${CFLAGS} ${LDFLAGS} ${S}/fcntl-lock.c -o ${B}/fcntl-lock
153}
181 154
182do_install () { 155do_install () {
183 # with ccache the timestamps on compiled files may 156 # with ccache the timestamps on compiled files may
@@ -214,9 +187,11 @@ do_install () {
214 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall 187 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
215 188
216 rm -f ${D}${bindir}/chkdupexe 189 rm -f ${D}${bindir}/chkdupexe
190
191 install -m 0755 ${B}/fcntl-lock ${D}${bindir}
217} 192}
218 193
219do_install_append_class-target () { 194do_install:append:class-target () {
220 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then 195 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
221 install -d ${D}${sysconfdir}/pam.d 196 install -d ${D}${sysconfdir}/pam.d
222 install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser 197 install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
@@ -229,34 +204,45 @@ do_install_append_class-target () {
229} 204}
230# nologin causes a conflict with shadow-native 205# nologin causes a conflict with shadow-native
231# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir}) 206# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir})
232do_install_append_class-native () { 207do_install:append:class-native () {
233 rm -f ${D}${base_sbindir}/nologin 208 rm -f ${D}${base_sbindir}/nologin
234 rm -f ${D}${base_bindir}/kill 209 rm -f ${D}${base_bindir}/kill
235} 210}
236 211
212# dm-verity support introduces a circular build dependency, so util-linux-libuuid is split out for target builds
213# Need to build libuuid for uuidgen, but then delete it and let the other recipe ship it
214do_install:append () {
215 rm -rf ${D}${includedir}/uuid ${D}${libdir}/pkgconfig/uuid.pc ${D}${libdir}/libuuid* ${D}${base_libdir}/libuuid*
216}
217
237ALTERNATIVE_PRIORITY = "80" 218ALTERNATIVE_PRIORITY = "80"
238 219
239ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid" 220ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
240ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev" 221ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
241ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal" 222ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
223ALTERNATIVE_LINK_NAME[chfn] = "${bindir}/chfn"
224ALTERNATIVE_LINK_NAME[chsh] = "${bindir}/chsh"
242ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt" 225ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
243ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg" 226ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
244ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject" 227ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
245ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate" 228ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate"
246ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk" 229ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
230ALTERNATIVE_LINK_NAME[findfs] = "${sbindir}/findfs"
247ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock" 231ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock"
248ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck" 232ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
249ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze" 233ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
250ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim" 234ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim"
251ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt" 235ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
252ALTERNATIVE_${PN}-agetty = "getty" 236ALTERNATIVE:${PN}-agetty = "getty"
253ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty" 237ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
254ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty" 238ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
255ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump" 239ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump"
256ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock" 240ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
257ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice" 241ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice"
242ALTERNATIVE_LINK_NAME[ipcrm] = "${bindir}/ipcrm"
243ALTERNATIVE_LINK_NAME[ipcs] = "${bindir}/ipcs"
258ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill" 244ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
259ALTERNATIVE_${PN}-last = "last lastb" 245ALTERNATIVE:${PN}-last = "last lastb"
260ALTERNATIVE_LINK_NAME[last] = "${bindir}/last" 246ALTERNATIVE_LINK_NAME[last] = "${bindir}/last"
261ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb" 247ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb"
262ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger" 248ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger"
@@ -276,6 +262,7 @@ ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice"
276ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev" 262ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev"
277ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill" 263ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill"
278ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake" 264ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake"
265ALTERNATIVE_LINK_NAME[scriptreplay] = "${bindir}/scriptreplay"
279ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv" 266ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv"
280ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid" 267ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid"
281ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su" 268ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
@@ -290,13 +277,16 @@ ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump"
290ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen" 277ALTERNATIVE_LINK_NAME[uuidgen] = "${bindir}/uuidgen"
291ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall" 278ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall"
292 279
293ALTERNATIVE_${PN}-doc = "\ 280ALTERNATIVE:${PN}-doc = "\
294blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \ 281blkid.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\ 282mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\
296" 283"
297ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}" 284ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
285ALTERNATIVE:${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'chfn-chsh', 'chfn.1 chsh.1', '', d)}"
298 286
299ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8" 287ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
288ALTERNATIVE_LINK_NAME[chfn.1] = "${mandir}/man1/chfn.1"
289ALTERNATIVE_LINK_NAME[chsh.1] = "${mandir}/man1/chsh.1"
300ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1" 290ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
301ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8" 291ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
302ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8" 292ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
@@ -316,7 +306,6 @@ ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
316ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3" 306ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
317ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1" 307ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
318 308
319
320BBCLASSEXTEND = "native nativesdk" 309BBCLASSEXTEND = "native nativesdk"
321 310
322PTEST_BINDIR = "1" 311PTEST_BINDIR = "1"
@@ -335,25 +324,25 @@ do_install_ptest() {
335 cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/ 324 cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
336 cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH} 325 cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH}
337 326
338 # The original paths of executables to be tested point to a local folder containing 327 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. 328
340 # So strip the paths, the executables will be located via "which" 329 # chfn needs PAM
341 sed -i \ 330 if ! ${@bb.utils.contains('PACKAGECONFIG', 'pam', 'true', 'false', d)}; then
342 -e '/^TS_CMD/ s|$top_builddir/||g' \ 331 rm -rf ${D}${PTEST_PATH}/tests/ts/chfn
343 -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \ 332 fi
344 ${D}${PTEST_PATH}/tests/commands.sh 333 # remove raid tests, known failures and avoid dependency on mdadm therefore
345 334 # See https://github.com/util-linux/util-linux/commit/7519c3edab120b14623931d5ddb16fdc6e7cad5d
346 # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]' 335 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid0-whole
347 sed -i -e \ 336 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-part
348 '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \ 337 rm -rf ${D}${PTEST_PATH}/tests/ts/blkid/md-raid1-whole
349 ${D}${PTEST_PATH}/tests/functions.sh 338 rm -rf ${D}${PTEST_PATH}/tests/ts/fdisk/align-512-4K-md
350 339}
351 # Running "kill" without the the complete path would use the shell's built-in kill
352 sed -i -e \
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 340
341# Delete tests not working on musl
342do_install_ptest:append:libc-musl() {
343 for t in tests/ts/col/multibyte \
344 tests/ts/lib/timeutils \
345 tests/ts/dmesg/limit; do
346 rm -rf ${D}${PTEST_PATH}/$t
347 done
359} 348}