Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/util-linux/, sys-apps/util-linux/files/
Date: Sun, 03 Oct 2021 11:28:41
Message-Id: 1633260477.a210ae9d88fbde5434dc594023d5f56f1cba5978.soap@gentoo
1 commit: a210ae9d88fbde5434dc594023d5f56f1cba5978
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Sun Oct 3 11:27:57 2021 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sun Oct 3 11:27:57 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a210ae9d
7
8 sys-apps/util-linux: drop 2.36.2-r1, 2.37.1-r1
9
10 Signed-off-by: David Seifert <soap <AT> gentoo.org>
11
12 sys-apps/util-linux/Manifest | 2 -
13 .../util-linux-2.37.1-ipcutils_calloc_check.patch | 25 --
14 .../util-linux-2.37.1-libmount_setgroups_fix.patch | 38 ---
15 ...l-linux-2.37.1-lscpu_NULL_dereference_fix.patch | 50 ---
16 sys-apps/util-linux/util-linux-2.36.2-r1.ebuild | 315 -------------------
17 sys-apps/util-linux/util-linux-2.37.1-r1.ebuild | 338 ---------------------
18 6 files changed, 768 deletions(-)
19
20 diff --git a/sys-apps/util-linux/Manifest b/sys-apps/util-linux/Manifest
21 index c330ae5648b..89d96ed0137 100644
22 --- a/sys-apps/util-linux/Manifest
23 +++ b/sys-apps/util-linux/Manifest
24 @@ -1,3 +1 @@
25 -DIST util-linux-2.36.2.tar.xz 5348032 BLAKE2B 17e49515f8d0430f3ed26b80bf1d6e811d847141020d0dae1340dc92887549b7b711f3db6e3913120871fc912435def73586a7aef09d8d9cc6ff7ca331b2770f SHA512 6ab141f44ca4cb6b600081f10eae17e15d23abd122a37eb3ac6c845513a6a4396dc9dcff30b3032de80116ddde50e27dfbc86f92708c1051f84f0c919194664b
26 -DIST util-linux-2.37.1.tar.xz 5628360 BLAKE2B 309ea7202f32c0ec750cb01486cf32c3e9dd457d83e5beab8d6b97a5e7f312332ecfcd1ddbb88ae5ec9ee483bb15452b8d58bce1f931f9dfa35be3ce042da3da SHA512 ec300c830869e10a0d7f8c0b99e9bb46e0b88fc51f3c6c6a4d9752a89f035e8d69d81f25fd103ef8d7d253e81440695ef3f5d72dccc94815ec8d5f6f949f7555
27 DIST util-linux-2.37.2.tar.xz 5621624 BLAKE2B 40ab80485781dfc58e6d0e98dae115b96f11ee0cc370524e1e13d3c4a4dfed3a5a4a248311f8ca645f6f84bbaf4785412ca8282b840af4e37a01312764885abe SHA512 38f0fe820445e3bfa79550e6581c230f98c7661566ccc4daa51c7208a5f972c61b4e57dfc86bed074fdbc7c40bc79f856be8f6a05a8860c1c0cecc4208e8b81d
28
29 diff --git a/sys-apps/util-linux/files/util-linux-2.37.1-ipcutils_calloc_check.patch b/sys-apps/util-linux/files/util-linux-2.37.1-ipcutils_calloc_check.patch
30 deleted file mode 100644
31 index 44490ce1bd0..00000000000
32 --- a/sys-apps/util-linux/files/util-linux-2.37.1-ipcutils_calloc_check.patch
33 +++ /dev/null
34 @@ -1,25 +0,0 @@
35 -From 86d5de52d43501711586054e7b601fbc57403085 Mon Sep 17 00:00:00 2001
36 -From: Karel Zak <kzak@××××××.com>
37 -Date: Tue, 27 Jul 2021 11:58:31 +0200
38 -Subject: [PATCH] sys-utils/ipcutils: be careful when call calloc() for uint64
39 - nmembs
40 -
41 -Fix: https://github.com/karelzak/util-linux/issues/1395
42 -Signed-off-by: Karel Zak <kzak@××××××.com>
43 ----
44 - sys-utils/ipcutils.c | 2 +-
45 - 1 file changed, 1 insertion(+), 1 deletion(-)
46 -
47 -diff --git a/sys-utils/ipcutils.c b/sys-utils/ipcutils.c
48 -index e784c4dcb9..18868cfd38 100644
49 ---- a/sys-utils/ipcutils.c
50 -+++ b/sys-utils/ipcutils.c
51 -@@ -218,7 +218,7 @@ static void get_sem_elements(struct sem_data *p)
52 - {
53 - size_t i;
54 -
55 -- if (!p || !p->sem_nsems || p->sem_perm.id < 0)
56 -+ if (!p || !p->sem_nsems || p->sem_nsems > SIZE_MAX || p->sem_perm.id < 0)
57 - return;
58 -
59 - p->elements = xcalloc(p->sem_nsems, sizeof(struct sem_elem));
60
61 diff --git a/sys-apps/util-linux/files/util-linux-2.37.1-libmount_setgroups_fix.patch b/sys-apps/util-linux/files/util-linux-2.37.1-libmount_setgroups_fix.patch
62 deleted file mode 100644
63 index ebde207986b..00000000000
64 --- a/sys-apps/util-linux/files/util-linux-2.37.1-libmount_setgroups_fix.patch
65 +++ /dev/null
66 @@ -1,38 +0,0 @@
67 -From 420e914c4cc4c2ba34fd75790ea194d7f4a47d2c Mon Sep 17 00:00:00 2001
68 -From: Karel Zak <kzak@××××××.com>
69 -Date: Thu, 29 Jul 2021 11:50:48 +0200
70 -Subject: [PATCH] libmount: fix setgroups() use
71 -
72 -* keep process in single supplementary group, which is the real group ID for the process
73 -
74 -* make sure we have rights to call setgroups(), requires group permissions
75 -
76 -Fixes: https://github.com/karelzak/util-linux/issues/1398
77 -Signed-off-by: Karel Zak <kzak@××××××.com>
78 ----
79 - include/c.h | 6 ++++--
80 - 1 file changed, 4 insertions(+), 2 deletions(-)
81 -
82 -diff --git a/include/c.h b/include/c.h
83 -index c1e4c5ffc..a4504e3ba 100644
84 ---- a/include/c.h
85 -+++ b/include/c.h
86 -@@ -340,14 +340,16 @@ static inline size_t get_hostname_max(void)
87 -
88 - static inline int drop_permissions(void)
89 - {
90 -+ gid_t newgid = getgid();
91 -+
92 - errno = 0;
93 -
94 - /* drop supplementary groups */
95 -- if (setgroups(0, NULL) != 0)
96 -+ if (geteuid() == 0 && setgroups(1, &newgid) != 0)
97 - goto fail;
98 -
99 - /* drop GID */
100 -- if (setgid(getgid()) < 0)
101 -+ if (setgid(newgid) < 0)
102 - goto fail;
103 -
104 - /* drop UID */
105
106 diff --git a/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_NULL_dereference_fix.patch b/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_NULL_dereference_fix.patch
107 deleted file mode 100644
108 index 50322e63a8e..00000000000
109 --- a/sys-apps/util-linux/files/util-linux-2.37.1-lscpu_NULL_dereference_fix.patch
110 +++ /dev/null
111 @@ -1,50 +0,0 @@
112 -From 0d7cef3ddbd2aacbea8c11e8524a3de68dfb8ff6 Mon Sep 17 00:00:00 2001
113 -From: Karel Zak <kzak@××××××.com>
114 -Date: Fri, 30 Jul 2021 14:35:25 +0200
115 -Subject: [PATCH] lscpu: fix NULL dereference
116 -
117 -Fixes: https://github.com/karelzak/util-linux/issues/1401
118 -Signed-off-by: Karel Zak <kzak@××××××.com>
119 ----
120 - sys-utils/lscpu-cputype.c | 2 +-
121 - sys-utils/lscpu.c | 6 +++---
122 - 2 files changed, 4 insertions(+), 4 deletions(-)
123 -
124 -diff --git a/sys-utils/lscpu-cputype.c b/sys-utils/lscpu-cputype.c
125 -index 795a4acf5..be16199e0 100644
126 ---- a/sys-utils/lscpu-cputype.c
127 -+++ b/sys-utils/lscpu-cputype.c
128 -@@ -569,7 +569,7 @@ int lscpu_read_cpuinfo(struct lscpu_cxt *cxt)
129 - /* Set the default type to CPUs which are missing (or not parsed)
130 - * in cpuinfo */
131 - ct = lscpu_cputype_get_default(cxt);
132 -- for (i = 0; i < cxt->npossibles; i++) {
133 -+ for (i = 0; ct && i < cxt->npossibles; i++) {
134 - struct lscpu_cpu *cpu = cxt->cpus[i];
135 -
136 - if (cpu && !cpu->type)
137 -diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
138 -index 827e84a6d..e11b2f42f 100644
139 ---- a/sys-utils/lscpu.c
140 -+++ b/sys-utils/lscpu.c
141 -@@ -991,7 +991,7 @@ static void print_summary(struct lscpu_cxt *cxt)
142 - *(p - 2) = '\0';
143 - add_summary_s(tb, sec, _("CPU op-mode(s):"), buf);
144 - }
145 -- if (ct->addrsz)
146 -+ if (ct && ct->addrsz)
147 - add_summary_s(tb, sec, _("Address sizes:"), ct->addrsz);
148 - #if !defined(WORDS_BIGENDIAN)
149 - add_summary_s(tb, sec, _("Byte Order:"), "Little Endian");
150 -@@ -1033,9 +1033,9 @@ static void print_summary(struct lscpu_cxt *cxt)
151 - sec = NULL;
152 -
153 - /* Section: cpu type description */
154 -- if (ct->vendor)
155 -+ if (ct && ct->vendor)
156 - sec = add_summary_s(tb, NULL, _("Vendor ID:"), ct->vendor);
157 -- if (ct->bios_vendor)
158 -+ if (ct && ct->bios_vendor)
159 - add_summary_s(tb, sec, _("BIOS Vendor ID:"), ct->bios_vendor);
160 -
161 - for (i = 0; i < cxt->ncputypes; i++)
162
163 diff --git a/sys-apps/util-linux/util-linux-2.36.2-r1.ebuild b/sys-apps/util-linux/util-linux-2.36.2-r1.ebuild
164 deleted file mode 100644
165 index 92191cf91ea..00000000000
166 --- a/sys-apps/util-linux/util-linux-2.36.2-r1.ebuild
167 +++ /dev/null
168 @@ -1,315 +0,0 @@
169 -# Copyright 1999-2021 Gentoo Authors
170 -# Distributed under the terms of the GNU General Public License v2
171 -
172 -EAPI=7
173 -
174 -PYTHON_COMPAT=( python3_{7,8,9} )
175 -
176 -inherit toolchain-funcs libtool flag-o-matic bash-completion-r1 usr-ldscript \
177 - pam python-r1 multilib-minimal multiprocessing systemd
178 -
179 -MY_PV="${PV/_/-}"
180 -MY_P="${PN}-${MY_PV}"
181 -
182 -if [[ ${PV} == 9999 ]] ; then
183 - inherit git-r3 autotools
184 - EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git"
185 -else
186 - [[ "${PV}" = *_rc* ]] || \
187 - KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
188 - SRC_URI="https://www.kernel.org/pub/linux/utils/util-linux/v${PV:0:4}/${MY_P}.tar.xz"
189 -fi
190 -
191 -DESCRIPTION="Various useful Linux utilities"
192 -HOMEPAGE="https://www.kernel.org/pub/linux/utils/util-linux/ https://github.com/karelzak/util-linux"
193 -
194 -LICENSE="GPL-2 GPL-3 LGPL-2.1 BSD-4 MIT public-domain"
195 -SLOT="0"
196 -IUSE="audit build caps +cramfs cryptsetup fdformat hardlink kill +logger magic ncurses nls pam python +readline selinux slang static-libs su +suid systemd test tty-helpers udev unicode userland_GNU"
197 -
198 -# Most lib deps here are related to programs rather than our libs,
199 -# so we rarely need to specify ${MULTILIB_USEDEP}.
200 -RDEPEND="
201 - virtual/libcrypt:=
202 - audit? ( >=sys-process/audit-2.6:= )
203 - caps? ( sys-libs/libcap-ng )
204 - cramfs? ( sys-libs/zlib:= )
205 - cryptsetup? ( >=sys-fs/cryptsetup-2.1.0 )
206 - hardlink? ( dev-libs/libpcre2:= )
207 - ncurses? (
208 - sys-libs/ncurses:=[unicode(+)?]
209 - magic? ( sys-apps/file:0= )
210 - )
211 - nls? ( virtual/libintl[${MULTILIB_USEDEP}] )
212 - pam? ( sys-libs/pam )
213 - ppc? ( sys-libs/librtas )
214 - ppc64? ( sys-libs/librtas )
215 - python? ( ${PYTHON_DEPS} )
216 - readline? ( sys-libs/readline:0= )
217 - selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
218 - slang? ( sys-libs/slang )
219 - !build? ( systemd? ( sys-apps/systemd ) )
220 - udev? ( virtual/libudev:= )"
221 -BDEPEND="
222 - virtual/pkgconfig
223 - nls? ( sys-devel/gettext )
224 - test? ( sys-devel/bc )
225 -"
226 -DEPEND="
227 - ${RDEPEND}
228 - virtual/os-headers
229 -"
230 -RDEPEND+="
231 - hardlink? ( !app-arch/hardlink )
232 - logger? ( !>=app-admin/sysklogd-2.0[logger] )
233 - kill? (
234 - !sys-apps/coreutils[kill]
235 - !sys-process/procps[kill]
236 - )
237 - su? (
238 - !<sys-apps/shadow-4.7-r2
239 - !>=sys-apps/shadow-4.7-r2[su]
240 - )
241 - !net-wireless/rfkill
242 - !<app-shells/bash-completion-2.7-r1"
243 -
244 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
245 -RESTRICT="!test? ( test )"
246 -
247 -S="${WORKDIR}/${MY_P}"
248 -
249 -src_prepare() {
250 - default
251 -
252 - # Prevent uuidd test failure due to socket path limit. #593304
253 - sed -i \
254 - -e "s|UUIDD_SOCKET=\"\$(mktemp -u \"\${TS_OUTDIR}/uuiddXXXXXXXXXXXXX\")\"|UUIDD_SOCKET=\"\$(mktemp -u \"${T}/uuiddXXXXXXXXXXXXX.sock\")\"|g" \
255 - tests/ts/uuid/uuidd || die "Failed to fix uuidd test"
256 -
257 - if ! use userland_GNU; then
258 - # test runner is using GNU-specific xargs call
259 - sed -i -e 's:xargs:gxargs:' tests/run.sh || die
260 - # test requires util-linux uuidgen (which we don't build)
261 - rm tests/ts/uuid/oids || die
262 - fi
263 -
264 - if [[ ${PV} == 9999 ]] ; then
265 - po/update-potfiles
266 - eautoreconf
267 - fi
268 -
269 - elibtoolize
270 -}
271 -
272 -lfs_fallocate_test() {
273 - # Make sure we can use fallocate with LFS #300307
274 - cat <<-EOF > "${T}"/fallocate.${ABI}.c
275 - #define _GNU_SOURCE
276 - #include <fcntl.h>
277 - main() { return fallocate(0, 0, 0, 0); }
278 - EOF
279 - append-lfs-flags
280 - $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} "${T}"/fallocate.${ABI}.c -o /dev/null >/dev/null 2>&1 \
281 - || export ac_cv_func_fallocate=no
282 - rm -f "${T}"/fallocate.${ABI}.c
283 -}
284 -
285 -python_configure() {
286 - local myeconfargs=(
287 - "${commonargs[@]}"
288 - --disable-all-programs
289 - --disable-bash-completion
290 - --without-systemdsystemunitdir
291 - --with-python
292 - )
293 - if use userland_GNU; then
294 - myeconfargs+=(
295 - --enable-libblkid
296 - --enable-libmount
297 - --enable-pylibmount
298 - )
299 - fi
300 - mkdir "${BUILD_DIR}" || die
301 - pushd "${BUILD_DIR}" >/dev/null || die
302 - ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
303 - popd >/dev/null || die
304 -}
305 -
306 -multilib_src_configure() {
307 - lfs_fallocate_test
308 - # The scanf test in a run-time test which fails while cross-compiling.
309 - # Blindly assume a POSIX setup since we require libmount, and libmount
310 - # itself fails when the scanf test fails. #531856
311 - tc-is-cross-compiler && export scanf_cv_alloc_modifier=ms
312 - export ac_cv_header_security_pam_misc_h=$(multilib_native_usex pam) #485486
313 - export ac_cv_header_security_pam_appl_h=$(multilib_native_usex pam) #545042
314 -
315 - # Undo bad ncurses handling by upstream. Fall back to pkg-config. #601530
316 - export NCURSES6_CONFIG=false NCURSES5_CONFIG=false
317 - export NCURSESW6_CONFIG=false NCURSESW5_CONFIG=false
318 -
319 - # configure args shared by python and non-python builds
320 - local commonargs=(
321 - --enable-fs-paths-extra="${EPREFIX}/usr/sbin:${EPREFIX}/bin:${EPREFIX}/usr/bin"
322 - )
323 -
324 - local myeconfargs=(
325 - "${commonargs[@]}"
326 - --with-bashcompletiondir="$(get_bashcompdir)"
327 - --without-python
328 - $(multilib_native_use_enable suid makeinstall-chown)
329 - $(multilib_native_use_enable suid makeinstall-setuid)
330 - $(multilib_native_use_with readline)
331 - $(multilib_native_use_with slang)
332 - $(multilib_native_use_with systemd)
333 - $(multilib_native_use_with udev)
334 - $(multilib_native_usex ncurses "$(use_with magic libmagic)" '--without-libmagic')
335 - $(multilib_native_usex ncurses "$(use_with unicode ncursesw)" '--without-ncursesw')
336 - $(multilib_native_usex ncurses "$(use_with !unicode ncurses)" '--without-ncurses')
337 - $(multilib_native_use_with audit)
338 - $(tc-has-tls || echo --disable-tls)
339 - $(use_enable nls)
340 - $(use_enable unicode widechar)
341 - $(use_enable static-libs static)
342 - $(use_with ncurses tinfo)
343 - $(use_with selinux)
344 - )
345 - # build programs only on GNU, on *BSD we want libraries only
346 - if multilib_is_native_abi && use userland_GNU; then
347 - myeconfargs+=(
348 - --disable-chfn-chsh
349 - --disable-login
350 - --disable-nologin
351 - --disable-pylibmount
352 - --enable-agetty
353 - --enable-bash-completion
354 - --enable-line
355 - --enable-partx
356 - --enable-raw
357 - --enable-rename
358 - --enable-rfkill
359 - --enable-schedutils
360 - --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
361 - $(use_enable caps setpriv)
362 - $(use_enable cramfs)
363 - $(use_enable fdformat)
364 - $(use_enable hardlink)
365 - $(use_enable kill)
366 - $(use_enable logger)
367 - $(use_enable ncurses pg)
368 - $(use_enable su)
369 - $(use_enable tty-helpers mesg)
370 - $(use_enable tty-helpers wall)
371 - $(use_enable tty-helpers write)
372 - $(use_with cryptsetup)
373 - )
374 - else
375 - myeconfargs+=(
376 - --disable-all-programs
377 - --disable-bash-completion
378 - --without-systemdsystemunitdir
379 - # build libraries
380 - --enable-libuuid
381 - --enable-libblkid
382 - --enable-libsmartcols
383 - --enable-libfdisk
384 - )
385 - if use userland_GNU; then
386 - # those libraries don't work on *BSD
387 - myeconfargs+=(
388 - --enable-libmount
389 - )
390 - fi
391 - fi
392 - ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
393 -
394 - if multilib_is_native_abi && use python; then
395 - python_foreach_impl python_configure
396 - fi
397 -}
398 -
399 -python_compile() {
400 - pushd "${BUILD_DIR}" >/dev/null || die
401 - emake all
402 - popd >/dev/null || die
403 -}
404 -
405 -multilib_src_compile() {
406 - emake all
407 -
408 - if multilib_is_native_abi && use python; then
409 - python_foreach_impl python_compile
410 - fi
411 -}
412 -
413 -python_test() {
414 - pushd "${BUILD_DIR}" >/dev/null || die
415 - emake check TS_OPTS="--parallel=$(makeopts_jobs) --nonroot"
416 - popd >/dev/null || die
417 -}
418 -
419 -multilib_src_test() {
420 - emake check TS_OPTS="--parallel=$(makeopts_jobs) --nonroot"
421 - if multilib_is_native_abi && use python; then
422 - python_foreach_impl python_test
423 - fi
424 -}
425 -
426 -python_install() {
427 - pushd "${BUILD_DIR}" >/dev/null || die
428 - emake DESTDIR="${D}" install
429 - python_optimize
430 - popd >/dev/null || die
431 -}
432 -
433 -multilib_src_install() {
434 - if multilib_is_native_abi && use python; then
435 - python_foreach_impl python_install
436 - fi
437 -
438 - # This needs to be called AFTER python_install call (#689190)
439 - emake DESTDIR="${D}" install
440 -
441 - if multilib_is_native_abi && use userland_GNU; then
442 - # need the libs in /
443 - gen_usr_ldscript -a blkid fdisk mount smartcols uuid
444 - fi
445 -}
446 -
447 -multilib_src_install_all() {
448 - dodoc AUTHORS NEWS README* Documentation/{TODO,*.txt,releases/*}
449 - chmod -x "${ED}"/usr/share/doc/util-linux-${PVR}/getopt/getopt-parse* || die
450 -
451 - # e2fsprogs-libs didnt install .la files, and .pc work fine
452 - find "${ED}" -name "*.la" -delete || die
453 -
454 - if ! use userland_GNU; then
455 - # manpage collisions
456 - # TODO: figure out a good way to keep them
457 - rm "${ED}"/usr/share/man/man3/uuid* || die
458 - fi
459 -
460 - if use pam; then
461 - newpamd "${FILESDIR}/runuser.pamd" runuser
462 - newpamd "${FILESDIR}/runuser-l.pamd" runuser-l
463 - fi
464 -
465 - # Note:
466 - # Bash completion for "runuser" command is provided by same file which
467 - # would also provide bash completion for "su" command. However, we don't
468 - # use "su" command from this package.
469 - # This triggers a known QA warning which we ignore for now to magically
470 - # keep bash completion for "su" command which shadow package does not
471 - # provide.
472 -}
473 -
474 -pkg_postinst() {
475 - if ! use tty-helpers; then
476 - elog "The mesg/wall/write tools have been disabled due to USE=-tty-helpers."
477 - fi
478 -
479 - if [[ -z ${REPLACING_VERSIONS} ]]; then
480 - elog "The agetty util now clears the terminal by default. You"
481 - elog "might want to add --noclear to your /etc/inittab lines."
482 - fi
483 -}
484
485 diff --git a/sys-apps/util-linux/util-linux-2.37.1-r1.ebuild b/sys-apps/util-linux/util-linux-2.37.1-r1.ebuild
486 deleted file mode 100644
487 index fa2c51c57e1..00000000000
488 --- a/sys-apps/util-linux/util-linux-2.37.1-r1.ebuild
489 +++ /dev/null
490 @@ -1,338 +0,0 @@
491 -# Copyright 1999-2021 Gentoo Authors
492 -# Distributed under the terms of the GNU General Public License v2
493 -
494 -EAPI=7
495 -
496 -PYTHON_COMPAT=( python3_{7..9} )
497 -
498 -inherit toolchain-funcs libtool flag-o-matic bash-completion-r1 usr-ldscript \
499 - pam python-r1 multilib-minimal multiprocessing systemd
500 -
501 -MY_PV="${PV/_/-}"
502 -MY_P="${PN}-${MY_PV}"
503 -
504 -if [[ ${PV} == 9999 ]] ; then
505 - inherit git-r3 autotools
506 - EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git"
507 -else
508 - [[ "${PV}" = *_rc* ]] || \
509 - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
510 - SRC_URI="https://www.kernel.org/pub/linux/utils/util-linux/v${PV:0:4}/${MY_P}.tar.xz"
511 -fi
512 -
513 -DESCRIPTION="Various useful Linux utilities"
514 -HOMEPAGE="https://www.kernel.org/pub/linux/utils/util-linux/ https://github.com/karelzak/util-linux"
515 -
516 -LICENSE="GPL-2 GPL-3 LGPL-2.1 BSD-4 MIT public-domain"
517 -SLOT="0"
518 -IUSE="audit build caps +cramfs cryptsetup fdformat hardlink kill +logger magic ncurses nls pam python +readline selinux slang static-libs su +suid systemd test tty-helpers udev unicode userland_GNU"
519 -
520 -# Most lib deps here are related to programs rather than our libs,
521 -# so we rarely need to specify ${MULTILIB_USEDEP}.
522 -RDEPEND="
523 - virtual/libcrypt:=
524 - audit? ( >=sys-process/audit-2.6:= )
525 - caps? ( sys-libs/libcap-ng )
526 - cramfs? ( sys-libs/zlib:= )
527 - cryptsetup? ( >=sys-fs/cryptsetup-2.1.0 )
528 - hardlink? ( dev-libs/libpcre2:= )
529 - ncurses? (
530 - sys-libs/ncurses:=[unicode(+)?]
531 - magic? ( sys-apps/file:0= )
532 - )
533 - nls? ( virtual/libintl[${MULTILIB_USEDEP}] )
534 - pam? ( sys-libs/pam )
535 - ppc? ( sys-libs/librtas )
536 - ppc64? ( sys-libs/librtas )
537 - python? ( ${PYTHON_DEPS} )
538 - readline? ( sys-libs/readline:0= )
539 - selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
540 - slang? ( sys-libs/slang )
541 - !build? ( systemd? ( sys-apps/systemd ) )
542 - udev? ( virtual/libudev:= )"
543 -BDEPEND="
544 - virtual/pkgconfig
545 - nls? ( sys-devel/gettext )
546 - test? ( sys-devel/bc )
547 -"
548 -DEPEND="
549 - ${RDEPEND}
550 - virtual/os-headers
551 -"
552 -RDEPEND+="
553 - hardlink? ( !app-arch/hardlink )
554 - logger? ( !>=app-admin/sysklogd-2.0[logger] )
555 - kill? (
556 - !sys-apps/coreutils[kill]
557 - !sys-process/procps[kill]
558 - )
559 - su? (
560 - !<sys-apps/shadow-4.7-r2
561 - !>=sys-apps/shadow-4.7-r2[su]
562 - )
563 - !net-wireless/rfkill
564 - !<app-shells/bash-completion-2.7-r1
565 -"
566 -
567 -# Required for man-page generation
568 -if [[ "${PV}" == 9999 ]] ; then
569 - BDEPEND+="
570 - dev-ruby/asciidoctor
571 - "
572 -fi
573 -
574 -REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
575 -RESTRICT="!test? ( test )"
576 -
577 -S="${WORKDIR}/${MY_P}"
578 -
579 -PATCHES=(
580 - "${FILESDIR}"/${PN}-2.37.1-ipcutils_calloc_check.patch #806070
581 - "${FILESDIR}"/${PN}-2.37.1-libmount_setgroups_fix.patch #805218
582 - "${FILESDIR}"/${PN}-2.37.1-agetty_ctrl-c_erase.patch #804972
583 - "${FILESDIR}"/${PN}-2.37.1-lscpu_NULL_dereference_fix.patch #802606
584 -)
585 -
586 -src_prepare() {
587 - default
588 -
589 - # Prevent uuidd test failure due to socket path limit. #593304
590 - sed -i \
591 - -e "s|UUIDD_SOCKET=\"\$(mktemp -u \"\${TS_OUTDIR}/uuiddXXXXXXXXXXXXX\")\"|UUIDD_SOCKET=\"\$(mktemp -u \"${T}/uuiddXXXXXXXXXXXXX.sock\")\"|g" \
592 - tests/ts/uuid/uuidd || die "Failed to fix uuidd test"
593 -
594 - if ! use userland_GNU ; then
595 - # test runner is using GNU-specific xargs call
596 - sed -i -e 's:xargs:gxargs:' tests/run.sh || die
597 - # test requires util-linux uuidgen (which we don't build)
598 - rm tests/ts/uuid/oids || die
599 - fi
600 -
601 - if [[ ${PV} == 9999 ]] ; then
602 - po/update-potfiles
603 - eautoreconf
604 - fi
605 -
606 - elibtoolize
607 -}
608 -
609 -lfs_fallocate_test() {
610 - # Make sure we can use fallocate with LFS #300307
611 - cat <<-EOF > "${T}"/fallocate.${ABI}.c
612 - #define _GNU_SOURCE
613 - #include <fcntl.h>
614 - main() { return fallocate(0, 0, 0, 0); }
615 - EOF
616 - append-lfs-flags
617 - $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} "${T}"/fallocate.${ABI}.c -o /dev/null >/dev/null 2>&1 \
618 - || export ac_cv_func_fallocate=no
619 - rm -f "${T}"/fallocate.${ABI}.c
620 -}
621 -
622 -python_configure() {
623 - local myeconfargs=(
624 - "${commonargs[@]}"
625 - --disable-all-programs
626 - --disable-bash-completion
627 - --without-systemdsystemunitdir
628 - --with-python
629 - )
630 - if use userland_GNU ; then
631 - myeconfargs+=(
632 - --enable-libblkid
633 - --enable-libmount
634 - --enable-pylibmount
635 - )
636 - fi
637 - mkdir "${BUILD_DIR}" || die
638 - pushd "${BUILD_DIR}" >/dev/null || die
639 - ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
640 - popd >/dev/null || die
641 -}
642 -
643 -multilib_src_configure() {
644 - lfs_fallocate_test
645 - # The scanf test in a run-time test which fails while cross-compiling.
646 - # Blindly assume a POSIX setup since we require libmount, and libmount
647 - # itself fails when the scanf test fails. #531856
648 - tc-is-cross-compiler && export scanf_cv_alloc_modifier=ms
649 - export ac_cv_header_security_pam_misc_h=$(multilib_native_usex pam) #485486
650 - export ac_cv_header_security_pam_appl_h=$(multilib_native_usex pam) #545042
651 -
652 - # Undo bad ncurses handling by upstream. Fall back to pkg-config. #601530
653 - export NCURSES6_CONFIG=false NCURSES5_CONFIG=false
654 - export NCURSESW6_CONFIG=false NCURSESW5_CONFIG=false
655 -
656 - # configure args shared by python and non-python builds
657 - local commonargs=(
658 - --enable-fs-paths-extra="${EPREFIX}/usr/sbin:${EPREFIX}/bin:${EPREFIX}/usr/bin"
659 - )
660 -
661 - local myeconfargs=(
662 - "${commonargs[@]}"
663 - --with-bashcompletiondir="$(get_bashcompdir)"
664 - --without-python
665 - $(multilib_native_use_enable suid makeinstall-chown)
666 - $(multilib_native_use_enable suid makeinstall-setuid)
667 - $(multilib_native_use_with readline)
668 - $(multilib_native_use_with slang)
669 - $(multilib_native_use_with systemd)
670 - $(multilib_native_use_with udev)
671 - $(multilib_native_usex ncurses "$(use_with magic libmagic)" '--without-libmagic')
672 - $(multilib_native_usex ncurses "$(use_with unicode ncursesw)" '--without-ncursesw')
673 - $(multilib_native_usex ncurses "$(use_with !unicode ncurses)" '--without-ncurses')
674 - $(multilib_native_use_with audit)
675 - $(tc-has-tls || echo --disable-tls)
676 - $(use_enable nls)
677 - $(use_enable unicode widechar)
678 - $(use_enable static-libs static)
679 - $(use_with ncurses tinfo)
680 - $(use_with selinux)
681 - )
682 - # build programs only on GNU, on *BSD we want libraries only
683 - if multilib_is_native_abi && use userland_GNU ; then
684 - myeconfargs+=(
685 - --disable-chfn-chsh
686 - --disable-login
687 - --disable-newgrp
688 - --disable-nologin
689 - --disable-pylibmount
690 - --disable-vipw
691 - --enable-agetty
692 - --enable-bash-completion
693 - --enable-line
694 - --enable-partx
695 - --enable-raw
696 - --enable-rename
697 - --enable-rfkill
698 - --enable-schedutils
699 - --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
700 - $(use_enable caps setpriv)
701 - $(use_enable cramfs)
702 - $(use_enable fdformat)
703 - $(use_enable hardlink)
704 - $(use_enable kill)
705 - $(use_enable logger)
706 - $(use_enable ncurses pg)
707 - $(use_enable su)
708 - $(use_enable tty-helpers mesg)
709 - $(use_enable tty-helpers wall)
710 - $(use_enable tty-helpers write)
711 - $(use_with cryptsetup)
712 - )
713 - if [[ ${PV} == *9999 ]] ; then
714 - myeconfargs+=( --enable-asciidoc )
715 - else
716 - # Upstream is shipping pre-generated man-pages for releases
717 - myeconfargs+=( --disable-asciidoc )
718 - fi
719 - else
720 - myeconfargs+=(
721 - --disable-all-programs
722 - --disable-asciidoc
723 - --disable-bash-completion
724 - --without-systemdsystemunitdir
725 - # build libraries
726 - --enable-libuuid
727 - --enable-libblkid
728 - --enable-libsmartcols
729 - --enable-libfdisk
730 - )
731 - if use userland_GNU ; then
732 - # those libraries don't work on *BSD
733 - myeconfargs+=(
734 - --enable-libmount
735 - )
736 - fi
737 - fi
738 - ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
739 -
740 - if multilib_is_native_abi && use python ; then
741 - python_foreach_impl python_configure
742 - fi
743 -}
744 -
745 -python_compile() {
746 - pushd "${BUILD_DIR}" >/dev/null || die
747 - emake all
748 - popd >/dev/null || die
749 -}
750 -
751 -multilib_src_compile() {
752 - emake all
753 -
754 - if multilib_is_native_abi && use python ; then
755 - python_foreach_impl python_compile
756 - fi
757 -}
758 -
759 -python_test() {
760 - pushd "${BUILD_DIR}" >/dev/null || die
761 - emake check TS_OPTS="--parallel=$(makeopts_jobs) --nonroot"
762 - popd >/dev/null || die
763 -}
764 -
765 -multilib_src_test() {
766 - emake check TS_OPTS="--parallel=$(makeopts_jobs) --nonroot"
767 - if multilib_is_native_abi && use python ; then
768 - python_foreach_impl python_test
769 - fi
770 -}
771 -
772 -python_install() {
773 - pushd "${BUILD_DIR}" >/dev/null || die
774 - emake DESTDIR="${D}" install
775 - python_optimize
776 - popd >/dev/null || die
777 -}
778 -
779 -multilib_src_install() {
780 - if multilib_is_native_abi && use python ; then
781 - python_foreach_impl python_install
782 - fi
783 -
784 - # This needs to be called AFTER python_install call (#689190)
785 - emake DESTDIR="${D}" install
786 -
787 - if multilib_is_native_abi && use userland_GNU ; then
788 - # need the libs in /
789 - gen_usr_ldscript -a blkid fdisk mount smartcols uuid
790 - fi
791 -}
792 -
793 -multilib_src_install_all() {
794 - dodoc AUTHORS NEWS README* Documentation/{TODO,*.txt,releases/*}
795 -
796 - # e2fsprogs-libs didnt install .la files, and .pc work fine
797 - find "${ED}" -name "*.la" -delete || die
798 -
799 - if ! use userland_GNU ; then
800 - # manpage collisions
801 - # TODO: figure out a good way to keep them
802 - rm "${ED}"/usr/share/man/man3/uuid* || die
803 - fi
804 -
805 - if use pam ; then
806 - newpamd "${FILESDIR}/runuser.pamd" runuser
807 - newpamd "${FILESDIR}/runuser-l.pamd" runuser-l
808 - fi
809 -
810 - # Note:
811 - # Bash completion for "runuser" command is provided by same file which
812 - # would also provide bash completion for "su" command. However, we don't
813 - # use "su" command from this package.
814 - # This triggers a known QA warning which we ignore for now to magically
815 - # keep bash completion for "su" command which shadow package does not
816 - # provide.
817 -}
818 -
819 -pkg_postinst() {
820 - if ! use tty-helpers ; then
821 - elog "The mesg/wall/write tools have been disabled due to USE=-tty-helpers."
822 - fi
823 -
824 - if [[ -z ${REPLACING_VERSIONS} ]] ; then
825 - elog "The agetty util now clears the terminal by default. You"
826 - elog "might want to add --noclear to your /etc/inittab lines."
827 - fi
828 -}