summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2020-08-23 22:20:00 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-25 16:00:10 +0100
commit64bc355805f4fdb671f397962fe3f62fe80e2908 (patch)
tree0be957790e6cf0b5d3e7d57f490d30403b912c15 /meta/recipes-core
parent980ab49cdaacb42c19a82ec4cb3e29dab0394eca (diff)
downloadpoky-64bc355805f4fdb671f397962fe3f62fe80e2908.tar.gz
util-linux: merge .inc into .bb
(From OE-Core rev: 06e6a1dcfe5e1ef3767b407d40696ed21e084e9e) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/util-linux/util-linux.inc348
-rw-r--r--meta/recipes-core/util-linux/util-linux_2.36.bb348
2 files changed, 346 insertions, 350 deletions
diff --git a/meta/recipes-core/util-linux/util-linux.inc b/meta/recipes-core/util-linux/util-linux.inc
deleted file mode 100644
index 06fbf7a229..0000000000
--- a/meta/recipes-core/util-linux/util-linux.inc
+++ /dev/null
@@ -1,348 +0,0 @@
1SUMMARY = "A suite of basic system administration utilities"
2HOMEPAGE = "http://userweb.kernel.org/~kzak/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
29#gtk-doc is not enabled as it requires xmlto which requires util-linux
30inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest
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 "
36
37PACKAGES =+ "${PN}-swaponoff"
38PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}"
39
40python util_linux_binpackages () {
41 def pkg_hook(f, pkg, file_regex, output_pattern, modulename):
42 pn = d.getVar('PN')
43 d.appendVar('RRECOMMENDS_%s' % pn, ' %s' % pkg)
44
45 if d.getVar('ALTERNATIVE_' + pkg):
46 return
47 if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename):
48 d.setVar('ALTERNATIVE_' + pkg, modulename)
49
50 bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split())))
51 for dir in bindirs:
52 do_split_packages(d, root=dir,
53 file_regex=r'(.*)', output_pattern='${PN}-%s',
54 description='${PN} %s',
55 hook=pkg_hook, extra_depends='')
56
57 # There are some symlinks for some binaries which we have ignored
58 # above. Add them to the package owning the binary they are
59 # pointing to
60 extras = {}
61 dvar = d.getVar('PKGD')
62 for root in bindirs:
63 for walkroot, dirs, files in os.walk(dvar + root):
64 for f in files:
65 file = os.path.join(walkroot, f)
66 if not os.path.islink(file):
67 continue
68
69 pkg = os.path.basename(os.readlink(file))
70 extras[pkg] = extras.get(pkg, '') + ' ' + file.replace(dvar, '', 1)
71
72 pn = d.getVar('PN')
73 for pkg, links in extras.items():
74 of = d.getVar('FILES_' + pn + '-' + pkg)
75 links = of + links
76 d.setVar('FILES_' + pn + '-' + pkg, links)
77}
78
79# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS
80PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages "
81
82python util_linux_libpackages() {
83 do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(.*)\.so\..*$',
84 output_pattern='${PN}-lib%s',
85 description='${PN} lib%s',
86 extra_depends='', prepend=True, allow_links=True)
87}
88
89PACKAGESPLITFUNCS =+ "util_linux_libpackages"
90
91PACKAGES_DYNAMIC = "^${PN}-.*"
92
93CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
94UTIL_LINUX_LIBDIR = "${libdir}"
95UTIL_LINUX_LIBDIR_class-target = "${base_libdir}"
96EXTRA_OECONF = "\
97 --enable-libuuid --enable-libblkid \
98 \
99 --enable-fsck --enable-kill --enable-last --enable-mesg \
100 --enable-mount --enable-partx --enable-raw --enable-rfkill \
101 --enable-unshare --enable-write \
102 \
103 --disable-bfs --disable-chfn-chsh --disable-login \
104 --disable-makeinstall-chown --disable-minix --disable-newgrp \
105 --disable-use-tty-group --disable-vipw \
106 \
107 --without-udev \
108 \
109 usrsbin_execdir='${sbindir}' \
110 --libdir='${UTIL_LINUX_LIBDIR}' \
111"
112
113EXTRA_OECONF_append_class-target = " --enable-setpriv"
114EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv"
115EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv"
116EXTRA_OECONF_append = " --disable-hwclock-gplv3"
117
118# enable pcre2 for native/nativesdk to match host distros
119# this helps to keep same expectations when using the SDK or
120# build host versions during development
121#
122PACKAGECONFIG ?= "pcre2"
123PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
124# inherit manpages requires this to be present, however util-linux does not have
125# configuration options, and installs manpages always
126PACKAGECONFIG[manpages] = ""
127PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
128# Respect the systemd feature for uuidd
129PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd"
130# Build python bindings for libmount
131PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3"
132# Readline support
133PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
134# PCRE support in hardlink
135PACKAGECONFIG[pcre2] = ",,libpcre2"
136
137EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
138
139ALLOW_EMPTY_${PN} = "1"
140FILES_${PN} = ""
141FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
142FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
143FILES_${PN}-mount = "${sysconfdir}/default/mountall"
144FILES_${PN}-runuser = "${sysconfdir}/pam.d/runuser*"
145FILES_${PN}-su = "${sysconfdir}/pam.d/su-l"
146CONFFILES_${PN}-su = "${sysconfdir}/pam.d/su-l"
147FILES_${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
148 ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
149 ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
150
151# Util-linux' blkid replaces the e2fsprogs one
152RCONFLICTS_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
153RREPLACES_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
154
155RRECOMMENDS_${PN}_class-native = ""
156RRECOMMENDS_${PN}_class-nativesdk = ""
157RDEPENDS_${PN}_class-native = ""
158RDEPENDS_${PN}_class-nativesdk = ""
159
160RPROVIDES_${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev ${PN}-libuuid-dev"
161
162RDEPENDS_${PN}-bash-completion += "${PN}-lsblk"
163RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs grep iproute2 kmod mdadm procps sed socat which xz"
164RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug"
165RDEPENDS_${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
166ALLOW_EMPTY_${PN}-swaponoff = "1"
167
168#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
169SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service"
170SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable"
171SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service"
172SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable"
173
174do_install () {
175 # with ccache the timestamps on compiled files may
176 # end up earlier than on their inputs, this allows
177 # for the resultant compilation in the install step.
178 oe_runmake 'CC=${CC}' 'LD=${LD}' \
179 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install
180
181 mkdir -p ${D}${base_bindir}
182
183 sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
184 sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin"
185 binprogs_a="dmesg getopt kill more umount mount login su mountpoint"
186
187 if [ "${base_sbindir}" != "${sbindir}" ]; then
188 mkdir -p ${D}${base_sbindir}
189 for p in $sbinprogs $sbinprogs_a; do
190 if [ -f "${D}${sbindir}/$p" ]; then
191 mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
192 fi
193 done
194 fi
195
196 if [ "${base_bindir}" != "${bindir}" ]; then
197 mkdir -p ${D}${base_bindir}
198 for p in $binprogs_a; do
199 if [ -f "${D}${bindir}/$p" ]; then
200 mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
201 fi
202 done
203 fi
204
205 install -d ${D}${sysconfdir}/default/
206 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
207
208 rm -f ${D}${bindir}/chkdupexe
209}
210
211do_install_append_class-target () {
212 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
213 install -d ${D}${sysconfdir}/pam.d
214 install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
215 install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
216 # Required for "su -" aka "su --login" because
217 # otherwise it uses "other", which has "auth pam_deny.so"
218 # and thus prevents the operation.
219 ln -s su ${D}${sysconfdir}/pam.d/su-l
220 fi
221}
222# nologin causes a conflict with shadow-native
223# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir})
224do_install_append_class-native () {
225 rm -f ${D}${base_sbindir}/nologin
226 rm -f ${D}${base_bindir}/kill
227}
228
229ALTERNATIVE_PRIORITY = "80"
230
231ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
232ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
233ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
234ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
235ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
236ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
237ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate"
238ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
239ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock"
240ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
241ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
242ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim"
243ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
244ALTERNATIVE_${PN}-agetty = "getty"
245ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
246ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
247ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump"
248ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
249ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice"
250ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
251ALTERNATIVE_${PN}-last = "last lastb"
252ALTERNATIVE_LINK_NAME[last] = "${bindir}/last"
253ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb"
254ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger"
255ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
256ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg"
257ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
258ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
259ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
260ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
261ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
262ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter"
263ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
264ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
265ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice"
266ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev"
267ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill"
268ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake"
269ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv"
270ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid"
271ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
272ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
273ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
274ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
275ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
276ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset"
277ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
278ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare"
279ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump"
280ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall"
281
282ALTERNATIVE_${PN}-doc = "\
283blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \
284mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\
285"
286ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
287
288ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
289ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
290ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
291ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
292ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
293ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
294ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
295ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3"
296ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
297ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
298ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
299ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
300ALTERNATIVE_LINK_NAME[rfkill.8] = "${mandir}/man8/rfkill.8"
301ALTERNATIVE_LINK_NAME[setpriv.1] = "${mandir}/man1/setpriv.1"
302ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
303ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
304ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
305ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
306ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
307
308
309BBCLASSEXTEND = "native nativesdk"
310
311PTEST_BINDIR = "1"
312do_compile_ptest() {
313 oe_runmake buildtest-TESTS
314}
315
316do_install_ptest() {
317 mkdir -p ${D}${PTEST_PATH}/tests/ts
318 find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
319 find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
320 find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
321
322 cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/
323 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
324 cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
325 cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH}
326
327 # The original paths of executables to be tested point to a local folder containing
328 # the executables. We want to test the installed executables, not the local copies.
329 # So strip the paths, the executables will be located via "which"
330 sed -i \
331 -e '/^TS_CMD/ s|$top_builddir/||g' \
332 -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \
333 ${D}${PTEST_PATH}/tests/commands.sh
334
335 # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]'
336 sed -i -e \
337 '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \
338 ${D}${PTEST_PATH}/tests/functions.sh
339
340 # Running "kill" without the the complete path would use the shell's built-in kill
341 sed -i -e \
342 '/^TS_CMD_KILL/ s|kill|${PTEST_PATH}/bin/kill|g' \
343 ${D}${PTEST_PATH}/tests/commands.sh
344
345
346 sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
347
348}
diff --git a/meta/recipes-core/util-linux/util-linux_2.36.bb b/meta/recipes-core/util-linux/util-linux_2.36.bb
index 9feb717f00..2fac9793a2 100644
--- a/meta/recipes-core/util-linux/util-linux_2.36.bb
+++ b/meta/recipes-core/util-linux/util-linux_2.36.bb
@@ -1,6 +1,37 @@
1require util-linux.inc 1SUMMARY = "A suite of basic system administration utilities"
2HOMEPAGE = "http://userweb.kernel.org/~kzak/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."
2 6
3SRC_URI += "${KERNELORG_MIRROR}/linux/utils/${BPN}/v${MAJOR_VERSION}/${BP}.tar.xz \ 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
29#gtk-doc is not enabled as it requires xmlto which requires util-linux
30inherit autotools gettext manpages pkgconfig systemd update-alternatives python3-dir bash-completion ptest
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 \
4 file://configure-sbindir.patch \ 35 file://configure-sbindir.patch \
5 file://runuser.pamd \ 36 file://runuser.pamd \
6 file://runuser-l.pamd \ 37 file://runuser-l.pamd \
@@ -10,3 +41,316 @@ SRC_URI += "${KERNELORG_MIRROR}/linux/utils/${BPN}/v${MAJOR_VERSION}/${BP}.tar.x
10 file://avoid_parallel_tests.patch \ 41 file://avoid_parallel_tests.patch \
11 " 42 "
12SRC_URI[sha256sum] = "9e4b1c67eb13b9b67feb32ae1dc0d50e08ce9e5d82e1cccd0ee771ad2fa9e0b1" 43SRC_URI[sha256sum] = "9e4b1c67eb13b9b67feb32ae1dc0d50e08ce9e5d82e1cccd0ee771ad2fa9e0b1"
44
45PACKAGES =+ "${PN}-swaponoff"
46PACKAGES += "${@bb.utils.contains('PACKAGECONFIG', 'pylibmount', '${PN}-pylibmount', '', d)}"
47
48python util_linux_binpackages () {
49 def pkg_hook(f, pkg, file_regex, output_pattern, modulename):
50 pn = d.getVar('PN')
51 d.appendVar('RRECOMMENDS_%s' % pn, ' %s' % pkg)
52
53 if d.getVar('ALTERNATIVE_' + pkg):
54 return
55 if d.getVarFlag('ALTERNATIVE_LINK_NAME', modulename):
56 d.setVar('ALTERNATIVE_' + pkg, modulename)
57
58 bindirs = sorted(list(set(d.expand("${base_sbindir} ${base_bindir} ${sbindir} ${bindir}").split())))
59 for dir in bindirs:
60 do_split_packages(d, root=dir,
61 file_regex=r'(.*)', output_pattern='${PN}-%s',
62 description='${PN} %s',
63 hook=pkg_hook, extra_depends='')
64
65 # There are some symlinks for some binaries which we have ignored
66 # above. Add them to the package owning the binary they are
67 # pointing to
68 extras = {}
69 dvar = d.getVar('PKGD')
70 for root in bindirs:
71 for walkroot, dirs, files in os.walk(dvar + root):
72 for f in files:
73 file = os.path.join(walkroot, f)
74 if not os.path.islink(file):
75 continue
76
77 pkg = os.path.basename(os.readlink(file))
78 extras[pkg] = extras.get(pkg, '') + ' ' + file.replace(dvar, '', 1)
79
80 pn = d.getVar('PN')
81 for pkg, links in extras.items():
82 of = d.getVar('FILES_' + pn + '-' + pkg)
83 links = of + links
84 d.setVar('FILES_' + pn + '-' + pkg, links)
85}
86
87# we must execute before update-alternatives PACKAGE_PREPROCESS_FUNCS
88PACKAGE_PREPROCESS_FUNCS =+ "util_linux_binpackages "
89
90python util_linux_libpackages() {
91 do_split_packages(d, root=d.getVar('UTIL_LINUX_LIBDIR'), file_regex=r'^lib(.*)\.so\..*$',
92 output_pattern='${PN}-lib%s',
93 description='${PN} lib%s',
94 extra_depends='', prepend=True, allow_links=True)
95}
96
97PACKAGESPLITFUNCS =+ "util_linux_libpackages"
98
99PACKAGES_DYNAMIC = "^${PN}-.*"
100
101CACHED_CONFIGUREVARS += "scanf_cv_alloc_modifier=ms"
102UTIL_LINUX_LIBDIR = "${libdir}"
103UTIL_LINUX_LIBDIR_class-target = "${base_libdir}"
104EXTRA_OECONF = "\
105 --enable-libuuid --enable-libblkid \
106 \
107 --enable-fsck --enable-kill --enable-last --enable-mesg \
108 --enable-mount --enable-partx --enable-raw --enable-rfkill \
109 --enable-unshare --enable-write \
110 \
111 --disable-bfs --disable-chfn-chsh --disable-login \
112 --disable-makeinstall-chown --disable-minix --disable-newgrp \
113 --disable-use-tty-group --disable-vipw \
114 \
115 --without-udev \
116 \
117 usrsbin_execdir='${sbindir}' \
118 --libdir='${UTIL_LINUX_LIBDIR}' \
119"
120
121EXTRA_OECONF_append_class-target = " --enable-setpriv"
122EXTRA_OECONF_append_class-native = " --without-cap-ng --disable-setpriv"
123EXTRA_OECONF_append_class-nativesdk = " --without-cap-ng --disable-setpriv"
124EXTRA_OECONF_append = " --disable-hwclock-gplv3"
125
126# enable pcre2 for native/nativesdk to match host distros
127# this helps to keep same expectations when using the SDK or
128# build host versions during development
129#
130PACKAGECONFIG ?= "pcre2"
131PACKAGECONFIG_class-target ?= "${@bb.utils.filter('DISTRO_FEATURES', 'pam', d)}"
132# inherit manpages requires this to be present, however util-linux does not have
133# configuration options, and installs manpages always
134PACKAGECONFIG[manpages] = ""
135PACKAGECONFIG[pam] = "--enable-su --enable-runuser,--disable-su --disable-runuser, libpam,"
136# Respect the systemd feature for uuidd
137PACKAGECONFIG[systemd] = "--with-systemd --with-systemdsystemunitdir=${systemd_system_unitdir}, --without-systemd --without-systemdsystemunitdir,systemd"
138# Build python bindings for libmount
139PACKAGECONFIG[pylibmount] = "--with-python=3 --enable-pylibmount,--without-python --disable-pylibmount,python3"
140# Readline support
141PACKAGECONFIG[readline] = "--with-readline,--without-readline,readline"
142# PCRE support in hardlink
143PACKAGECONFIG[pcre2] = ",,libpcre2"
144
145EXTRA_OEMAKE = "ARCH=${TARGET_ARCH} CPU= CPUOPT= 'OPT=${CFLAGS}'"
146
147ALLOW_EMPTY_${PN} = "1"
148FILES_${PN} = ""
149FILES_${PN}-doc += "${datadir}/getopt/getopt-*.*"
150FILES_${PN}-dev += "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.la"
151FILES_${PN}-mount = "${sysconfdir}/default/mountall"
152FILES_${PN}-runuser = "${sysconfdir}/pam.d/runuser*"
153FILES_${PN}-su = "${sysconfdir}/pam.d/su-l"
154CONFFILES_${PN}-su = "${sysconfdir}/pam.d/su-l"
155FILES_${PN}-pylibmount = "${PYTHON_SITEPACKAGES_DIR}/libmount/pylibmount.so \
156 ${PYTHON_SITEPACKAGES_DIR}/libmount/__init__.* \
157 ${PYTHON_SITEPACKAGES_DIR}/libmount/__pycache__/*"
158
159# Util-linux' blkid replaces the e2fsprogs one
160RCONFLICTS_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
161RREPLACES_${PN}-blkid = "${MLPREFIX}e2fsprogs-blkid"
162
163RRECOMMENDS_${PN}_class-native = ""
164RRECOMMENDS_${PN}_class-nativesdk = ""
165RDEPENDS_${PN}_class-native = ""
166RDEPENDS_${PN}_class-nativesdk = ""
167
168RPROVIDES_${PN}-dev = "${PN}-libblkid-dev ${PN}-libmount-dev ${PN}-libuuid-dev"
169
170RDEPENDS_${PN}-bash-completion += "${PN}-lsblk"
171RDEPENDS_${PN}-ptest += "bash bc btrfs-tools coreutils e2fsprogs grep iproute2 kmod mdadm procps sed socat which xz"
172RRECOMMENDS_${PN}-ptest += "kernel-module-scsi-debug"
173RDEPENDS_${PN}-swaponoff = "${PN}-swapon ${PN}-swapoff"
174ALLOW_EMPTY_${PN}-swaponoff = "1"
175
176#SYSTEMD_PACKAGES = "${PN}-uuidd ${PN}-fstrim"
177SYSTEMD_SERVICE_${PN}-uuidd = "uuidd.socket uuidd.service"
178SYSTEMD_AUTO_ENABLE_${PN}-uuidd = "disable"
179SYSTEMD_SERVICE_${PN}-fstrim = "fstrim.timer fstrim.service"
180SYSTEMD_AUTO_ENABLE_${PN}-fstrim = "disable"
181
182do_install () {
183 # with ccache the timestamps on compiled files may
184 # end up earlier than on their inputs, this allows
185 # for the resultant compilation in the install step.
186 oe_runmake 'CC=${CC}' 'LD=${LD}' \
187 'LDFLAGS=${LDFLAGS}' 'DESTDIR=${D}' install
188
189 mkdir -p ${D}${base_bindir}
190
191 sbinprogs="agetty ctrlaltdel cfdisk vipw vigr"
192 sbinprogs_a="pivot_root hwclock mkswap losetup swapon swapoff fdisk fsck blkid blockdev fstrim sulogin switch_root nologin"
193 binprogs_a="dmesg getopt kill more umount mount login su mountpoint"
194
195 if [ "${base_sbindir}" != "${sbindir}" ]; then
196 mkdir -p ${D}${base_sbindir}
197 for p in $sbinprogs $sbinprogs_a; do
198 if [ -f "${D}${sbindir}/$p" ]; then
199 mv "${D}${sbindir}/$p" "${D}${base_sbindir}/$p"
200 fi
201 done
202 fi
203
204 if [ "${base_bindir}" != "${bindir}" ]; then
205 mkdir -p ${D}${base_bindir}
206 for p in $binprogs_a; do
207 if [ -f "${D}${bindir}/$p" ]; then
208 mv "${D}${bindir}/$p" "${D}${base_bindir}/$p"
209 fi
210 done
211 fi
212
213 install -d ${D}${sysconfdir}/default/
214 echo 'MOUNTALL="-t nonfs,nosmbfs,noncpfs"' > ${D}${sysconfdir}/default/mountall
215
216 rm -f ${D}${bindir}/chkdupexe
217}
218
219do_install_append_class-target () {
220 if [ "${@bb.utils.filter('PACKAGECONFIG', 'pam', d)}" ]; then
221 install -d ${D}${sysconfdir}/pam.d
222 install -m 0644 ${WORKDIR}/runuser.pamd ${D}${sysconfdir}/pam.d/runuser
223 install -m 0644 ${WORKDIR}/runuser-l.pamd ${D}${sysconfdir}/pam.d/runuser-l
224 # Required for "su -" aka "su --login" because
225 # otherwise it uses "other", which has "auth pam_deny.so"
226 # and thus prevents the operation.
227 ln -s su ${D}${sysconfdir}/pam.d/su-l
228 fi
229}
230# nologin causes a conflict with shadow-native
231# kill causes a conflict with coreutils-native (if ${bindir}==${base_bindir})
232do_install_append_class-native () {
233 rm -f ${D}${base_sbindir}/nologin
234 rm -f ${D}${base_bindir}/kill
235}
236
237ALTERNATIVE_PRIORITY = "80"
238
239ALTERNATIVE_LINK_NAME[blkid] = "${base_sbindir}/blkid"
240ALTERNATIVE_LINK_NAME[blockdev] = "${base_sbindir}/blockdev"
241ALTERNATIVE_LINK_NAME[cal] = "${bindir}/cal"
242ALTERNATIVE_LINK_NAME[chrt] = "${bindir}/chrt"
243ALTERNATIVE_LINK_NAME[dmesg] = "${base_bindir}/dmesg"
244ALTERNATIVE_LINK_NAME[eject] = "${bindir}/eject"
245ALTERNATIVE_LINK_NAME[fallocate] = "${bindir}/fallocate"
246ALTERNATIVE_LINK_NAME[fdisk] = "${base_sbindir}/fdisk"
247ALTERNATIVE_LINK_NAME[flock] = "${bindir}/flock"
248ALTERNATIVE_LINK_NAME[fsck] = "${base_sbindir}/fsck"
249ALTERNATIVE_LINK_NAME[fsfreeze] = "${sbindir}/fsfreeze"
250ALTERNATIVE_LINK_NAME[fstrim] = "${base_sbindir}/fstrim"
251ALTERNATIVE_LINK_NAME[getopt] = "${base_bindir}/getopt"
252ALTERNATIVE_${PN}-agetty = "getty"
253ALTERNATIVE_LINK_NAME[getty] = "${base_sbindir}/getty"
254ALTERNATIVE_TARGET[getty] = "${base_sbindir}/agetty"
255ALTERNATIVE_LINK_NAME[hexdump] = "${bindir}/hexdump"
256ALTERNATIVE_LINK_NAME[hwclock] = "${base_sbindir}/hwclock"
257ALTERNATIVE_LINK_NAME[ionice] = "${bindir}/ionice"
258ALTERNATIVE_LINK_NAME[kill] = "${base_bindir}/kill"
259ALTERNATIVE_${PN}-last = "last lastb"
260ALTERNATIVE_LINK_NAME[last] = "${bindir}/last"
261ALTERNATIVE_LINK_NAME[lastb] = "${bindir}/lastb"
262ALTERNATIVE_LINK_NAME[logger] = "${bindir}/logger"
263ALTERNATIVE_LINK_NAME[losetup] = "${base_sbindir}/losetup"
264ALTERNATIVE_LINK_NAME[mesg] = "${bindir}/mesg"
265ALTERNATIVE_LINK_NAME[mkswap] = "${base_sbindir}/mkswap"
266ALTERNATIVE_LINK_NAME[more] = "${base_bindir}/more"
267ALTERNATIVE_LINK_NAME[mount] = "${base_bindir}/mount"
268ALTERNATIVE_LINK_NAME[mountpoint] = "${base_bindir}/mountpoint"
269ALTERNATIVE_LINK_NAME[nologin] = "${base_sbindir}/nologin"
270ALTERNATIVE_LINK_NAME[nsenter] = "${bindir}/nsenter"
271ALTERNATIVE_LINK_NAME[pivot_root] = "${base_sbindir}/pivot_root"
272ALTERNATIVE_LINK_NAME[readprofile] = "${sbindir}/readprofile"
273ALTERNATIVE_LINK_NAME[renice] = "${bindir}/renice"
274ALTERNATIVE_LINK_NAME[rev] = "${bindir}/rev"
275ALTERNATIVE_LINK_NAME[rfkill] = "${sbindir}/rfkill"
276ALTERNATIVE_LINK_NAME[rtcwake] = "${sbindir}/rtcwake"
277ALTERNATIVE_LINK_NAME[setpriv] = "${bindir}/setpriv"
278ALTERNATIVE_LINK_NAME[setsid] = "${bindir}/setsid"
279ALTERNATIVE_LINK_NAME[su] = "${base_bindir}/su"
280ALTERNATIVE_LINK_NAME[sulogin] = "${base_sbindir}/sulogin"
281ALTERNATIVE_LINK_NAME[swapoff] = "${base_sbindir}/swapoff"
282ALTERNATIVE_LINK_NAME[swapon] = "${base_sbindir}/swapon"
283ALTERNATIVE_LINK_NAME[switch_root] = "${base_sbindir}/switch_root"
284ALTERNATIVE_LINK_NAME[taskset] = "${bindir}/taskset"
285ALTERNATIVE_LINK_NAME[umount] = "${base_bindir}/umount"
286ALTERNATIVE_LINK_NAME[unshare] = "${bindir}/unshare"
287ALTERNATIVE_LINK_NAME[utmpdump] = "${bindir}/utmpdump"
288ALTERNATIVE_LINK_NAME[wall] = "${bindir}/wall"
289
290ALTERNATIVE_${PN}-doc = "\
291blkid.8 eject.1 findfs.8 fsck.8 kill.1 last.1 lastb.1 libblkid.3 logger.1 mesg.1 \
292mountpoint.1 nologin.8 rfkill.8 sulogin.8 utmpdump.1 uuid.3 wall.1\
293"
294ALTERNATIVE_${PN}-doc += "${@bb.utils.contains('PACKAGECONFIG', 'pam', 'su.1', '', d)}"
295
296ALTERNATIVE_LINK_NAME[blkid.8] = "${mandir}/man8/blkid.8"
297ALTERNATIVE_LINK_NAME[eject.1] = "${mandir}/man1/eject.1"
298ALTERNATIVE_LINK_NAME[findfs.8] = "${mandir}/man8/findfs.8"
299ALTERNATIVE_LINK_NAME[fsck.8] = "${mandir}/man8/fsck.8"
300ALTERNATIVE_LINK_NAME[kill.1] = "${mandir}/man1/kill.1"
301ALTERNATIVE_LINK_NAME[last.1] = "${mandir}/man1/last.1"
302ALTERNATIVE_LINK_NAME[lastb.1] = "${mandir}/man1/lastb.1"
303ALTERNATIVE_LINK_NAME[libblkid.3] = "${mandir}/man3/libblkid.3"
304ALTERNATIVE_LINK_NAME[logger.1] = "${mandir}/man1/logger.1"
305ALTERNATIVE_LINK_NAME[mesg.1] = "${mandir}/man1/mesg.1"
306ALTERNATIVE_LINK_NAME[mountpoint.1] = "${mandir}/man1/mountpoint.1"
307ALTERNATIVE_LINK_NAME[nologin.8] = "${mandir}/man8/nologin.8"
308ALTERNATIVE_LINK_NAME[rfkill.8] = "${mandir}/man8/rfkill.8"
309ALTERNATIVE_LINK_NAME[setpriv.1] = "${mandir}/man1/setpriv.1"
310ALTERNATIVE_LINK_NAME[su.1] = "${mandir}/man1/su.1"
311ALTERNATIVE_LINK_NAME[sulogin.8] = "${mandir}/man8/sulogin.8"
312ALTERNATIVE_LINK_NAME[utmpdump.1] = "${mandir}/man1/utmpdump.1"
313ALTERNATIVE_LINK_NAME[uuid.3] = "${mandir}/man3/uuid.3"
314ALTERNATIVE_LINK_NAME[wall.1] = "${mandir}/man1/wall.1"
315
316
317BBCLASSEXTEND = "native nativesdk"
318
319PTEST_BINDIR = "1"
320do_compile_ptest() {
321 oe_runmake buildtest-TESTS
322}
323
324do_install_ptest() {
325 mkdir -p ${D}${PTEST_PATH}/tests/ts
326 find . -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
327 find ./.libs -name 'sample*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
328 find ./.libs -name 'test*' -maxdepth 1 -type f -perm -111 -exec cp {} ${D}${PTEST_PATH} \;
329
330 cp ${S}/tests/*.sh ${D}${PTEST_PATH}/tests/
331 cp -pR ${S}/tests/expected ${D}${PTEST_PATH}/tests/expected
332 cp -pR ${S}/tests/ts ${D}${PTEST_PATH}/tests/
333 cp ${WORKDIR}/build/config.h ${D}${PTEST_PATH}
334
335 # The original paths of executables to be tested point to a local folder containing
336 # the executables. We want to test the installed executables, not the local copies.
337 # So strip the paths, the executables will be located via "which"
338 sed -i \
339 -e '/^TS_CMD/ s|$top_builddir/||g' \
340 -e '/^TS_HELPER/ s|$top_builddir|${PTEST_PATH}|g' \
341 ${D}${PTEST_PATH}/tests/commands.sh
342
343 # Change 'if [ ! -x "$1" ]' to 'if [ ! -x "`which $1 2>/dev/null`"]'
344 sed -i -e \
345 '/^\tif[[:space:]]\[[[:space:]]![[:space:]]-x[[:space:]]"$1"/s|$1|`which $1 2>/dev/null`|g' \
346 ${D}${PTEST_PATH}/tests/functions.sh
347
348 # Running "kill" without the the complete path would use the shell's built-in kill
349 sed -i -e \
350 '/^TS_CMD_KILL/ s|kill|${PTEST_PATH}/bin/kill|g' \
351 ${D}${PTEST_PATH}/tests/commands.sh
352
353
354 sed -i 's|@base_sbindir@|${base_sbindir}|g' ${D}${PTEST_PATH}/run-ptest
355
356}