Gentoo Archives: gentoo-commits

From: Patrick McLean <chutzpah@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: Fri, 13 Jul 2018 16:41:56
Message-Id: 1531500091.94c60fe1a9fe3baeff8163e7197c4ce93ef199f8.chutzpah@gentoo
1 commit: 94c60fe1a9fe3baeff8163e7197c4ce93ef199f8
2 Author: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 13 16:41:31 2018 +0000
4 Commit: Patrick McLean <chutzpah <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 13 16:41:31 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94c60fe1
7
8 sys-apps/util-linux: Revbump to 2.32-r5, fix tests with py3 #624132
9
10 Revert back to unstable since we are adding a patch from upstream git.
11 Patch is from here: https://github.com/karelzak/util-linux/pull/664
12
13 Bug: https://bugs.gentoo.org/624132
14 Package-Manager: Portage-2.3.42, Repoman-2.3.9
15
16 .../files/util-linux-2.32-python3-tests.patch | 105 +++++++++
17 sys-apps/util-linux/util-linux-2.32-r5.ebuild | 242 +++++++++++++++++++++
18 2 files changed, 347 insertions(+)
19
20 diff --git a/sys-apps/util-linux/files/util-linux-2.32-python3-tests.patch b/sys-apps/util-linux/files/util-linux-2.32-python3-tests.patch
21 new file mode 100644
22 index 00000000000..7b8867ba034
23 --- /dev/null
24 +++ b/sys-apps/util-linux/files/util-linux-2.32-python3-tests.patch
25 @@ -0,0 +1,105 @@
26 +From 8a12ab57755afc36546834f175ef0b9e9376ba59 Mon Sep 17 00:00:00 2001
27 +From: Frank Schaefer <kelledin@×××××.com>
28 +Date: Tue, 10 Jul 2018 20:21:02 -0500
29 +Subject: [PATCH] * break up large strings for PySys_WriteStdout()
30 +
31 +---
32 + libmount/python/fs.c | 56 ++++++++++++++++++++++++++++++++++++++++------------
33 + 1 file changed, 43 insertions(+), 13 deletions(-)
34 +
35 +diff --git a/libmount/python/fs.c b/libmount/python/fs.c
36 +index d6490d248..634a914ef 100644
37 +--- a/libmount/python/fs.c
38 ++++ b/libmount/python/fs.c
39 +@@ -63,32 +63,62 @@ static PyObject *Fs_get_devno(FsObject *self)
40 + return PyObjectResultInt(mnt_fs_get_devno(self->fs));
41 + }
42 +
43 ++static void _dump_debug_string(const char *lead, const char *s, char quote)
44 ++{
45 ++ /* PySys_WriteStdout() will automatically truncate any '%s' token
46 ++ * longer than a certain length (documented as 1000 bytes, but we
47 ++ * give ourselves some margin here just in case). The only way I
48 ++ * know to get around this is to print such strings in bite-sized
49 ++ * chunks.
50 ++ */
51 ++ static const unsigned int _PY_MAX_LEN = 900;
52 ++ static const char *_PY_MAX_LEN_FMT = "%.900s";
53 ++ unsigned int len;
54 ++
55 ++ if (lead != NULL)
56 ++ PySys_WriteStdout("%s", lead);
57 ++
58 ++ if (quote != 0)
59 ++ PySys_WriteStdout("%c", quote);
60 ++
61 ++ for (len = strlen(s); len > _PY_MAX_LEN; len -= _PY_MAX_LEN, s += _PY_MAX_LEN)
62 ++ PySys_WriteStdout(_PY_MAX_LEN_FMT, s);
63 ++
64 ++ if (len > 0)
65 ++ PySys_WriteStdout(_PY_MAX_LEN_FMT, s);
66 ++
67 ++ if (quote != 0)
68 ++ PySys_WriteStdout("%c\n", quote);
69 ++ else
70 ++ PySys_WriteStdout("\n");
71 ++}
72 ++
73 + #define Fs_print_debug_HELP "print_debug()\n\n"
74 + static PyObject *Fs_print_debug(FsObject *self)
75 + {
76 + PySys_WriteStdout("------ fs: %p\n", self->fs);
77 +- PySys_WriteStdout("source: %s\n", mnt_fs_get_source(self->fs));
78 +- PySys_WriteStdout("target: %s\n", mnt_fs_get_target(self->fs));
79 +- PySys_WriteStdout("fstype: %s\n", mnt_fs_get_fstype(self->fs));
80 ++ _dump_debug_string("source: ", mnt_fs_get_source(self->fs), 0);
81 ++ _dump_debug_string("target: ", mnt_fs_get_target(self->fs), 0);
82 ++ _dump_debug_string("fstype: ", mnt_fs_get_fstype(self->fs), 0);
83 +
84 + if (mnt_fs_get_options(self->fs))
85 +- PySys_WriteStdout("optstr: %s\n", mnt_fs_get_options(self->fs));
86 ++ _dump_debug_string("optstr: ", mnt_fs_get_options(self->fs), 0);
87 + if (mnt_fs_get_vfs_options(self->fs))
88 +- PySys_WriteStdout("VFS-optstr: %s\n", mnt_fs_get_vfs_options(self->fs));
89 ++ _dump_debug_string("VFS-optstr: ", mnt_fs_get_vfs_options(self->fs), 0);
90 + if (mnt_fs_get_fs_options(self->fs))
91 +- PySys_WriteStdout("FS-opstr: %s\n", mnt_fs_get_fs_options(self->fs));
92 ++ _dump_debug_string("FS-opstr: ", mnt_fs_get_fs_options(self->fs), 0);
93 + if (mnt_fs_get_user_options(self->fs))
94 +- PySys_WriteStdout("user-optstr: %s\n", mnt_fs_get_user_options(self->fs));
95 ++ _dump_debug_string("user-optstr: ", mnt_fs_get_user_options(self->fs), 0);
96 + if (mnt_fs_get_optional_fields(self->fs))
97 +- PySys_WriteStdout("optional-fields: '%s'\n", mnt_fs_get_optional_fields(self->fs));
98 ++ _dump_debug_string("optional-fields: ", mnt_fs_get_optional_fields(self->fs), '\'');
99 + if (mnt_fs_get_attributes(self->fs))
100 +- PySys_WriteStdout("attributes: %s\n", mnt_fs_get_attributes(self->fs));
101 ++ _dump_debug_string("attributes: ", mnt_fs_get_attributes(self->fs), 0);
102 +
103 + if (mnt_fs_get_root(self->fs))
104 +- PySys_WriteStdout("root: %s\n", mnt_fs_get_root(self->fs));
105 ++ _dump_debug_string("root: ", mnt_fs_get_root(self->fs), 0);
106 +
107 + if (mnt_fs_get_swaptype(self->fs))
108 +- PySys_WriteStdout("swaptype: %s\n", mnt_fs_get_swaptype(self->fs));
109 ++ _dump_debug_string("swaptype: ", mnt_fs_get_swaptype(self->fs), 0);
110 + if (mnt_fs_get_size(self->fs))
111 + PySys_WriteStdout("size: %jd\n", mnt_fs_get_size(self->fs));
112 + if (mnt_fs_get_usedsize(self->fs))
113 +@@ -97,7 +127,7 @@ static PyObject *Fs_print_debug(FsObject *self)
114 + PySys_WriteStdout("priority: %d\n", mnt_fs_get_priority(self->fs));
115 +
116 + if (mnt_fs_get_bindsrc(self->fs))
117 +- PySys_WriteStdout("bindsrc: %s\n", mnt_fs_get_bindsrc(self->fs));
118 ++ _dump_debug_string("bindsrc: ", mnt_fs_get_bindsrc(self->fs), 0);
119 + if (mnt_fs_get_freq(self->fs))
120 + PySys_WriteStdout("freq: %d\n", mnt_fs_get_freq(self->fs));
121 + if (mnt_fs_get_passno(self->fs))
122 +@@ -112,7 +142,7 @@ static PyObject *Fs_print_debug(FsObject *self)
123 + if (mnt_fs_get_tid(self->fs))
124 + PySys_WriteStdout("tid: %d\n", mnt_fs_get_tid(self->fs));
125 + if (mnt_fs_get_comment(self->fs))
126 +- PySys_WriteStdout("comment: '%s'\n", mnt_fs_get_comment(self->fs));
127 ++ _dump_debug_string("comment: ", mnt_fs_get_comment(self->fs), '\'');
128 + return UL_IncRef(self);
129 + }
130 + /*
131
132 diff --git a/sys-apps/util-linux/util-linux-2.32-r5.ebuild b/sys-apps/util-linux/util-linux-2.32-r5.ebuild
133 new file mode 100644
134 index 00000000000..1bce9daa5a9
135 --- /dev/null
136 +++ b/sys-apps/util-linux/util-linux-2.32-r5.ebuild
137 @@ -0,0 +1,242 @@
138 +# Copyright 1999-2018 Gentoo Foundation
139 +# Distributed under the terms of the GNU General Public License v2
140 +
141 +EAPI=6
142 +
143 +PYTHON_COMPAT=( python2_7 python3_{4,5,6} )
144 +
145 +inherit toolchain-funcs libtool flag-o-matic bash-completion-r1 \
146 + pam python-single-r1 multilib-minimal multiprocessing systemd
147 +
148 +MY_PV="${PV/_/-}"
149 +MY_P="${PN}-${MY_PV}"
150 +
151 +if [[ ${PV} == 9999 ]] ; then
152 + inherit git-r3 autotools
153 + EGIT_REPO_URI="https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git"
154 +else
155 + [[ "${PV}" = *_rc* ]] || \
156 + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~amd64-linux ~arm-linux ~x86-linux"
157 + SRC_URI="mirror://kernel/linux/utils/util-linux/v${PV:0:4}/${MY_P}.tar.xz"
158 +fi
159 +
160 +DESCRIPTION="Various useful Linux utilities"
161 +HOMEPAGE="https://www.kernel.org/pub/linux/utils/util-linux/ https://github.com/karelzak/util-linux"
162 +
163 +LICENSE="GPL-2 LGPL-2.1 BSD-4 MIT public-domain"
164 +SLOT="0"
165 +IUSE="build caps +cramfs fdformat kill ncurses nls pam python +readline selinux slang static-libs +suid systemd test tty-helpers udev unicode userland_GNU"
166 +
167 +# Most lib deps here are related to programs rather than our libs,
168 +# so we rarely need to specify ${MULTILIB_USEDEP}.
169 +RDEPEND="caps? ( sys-libs/libcap-ng )
170 + cramfs? ( sys-libs/zlib:= )
171 + ncurses? ( >=sys-libs/ncurses-5.2-r2:0=[unicode?] )
172 + nls? ( virtual/libintl[${MULTILIB_USEDEP}] )
173 + pam? ( sys-libs/pam )
174 + python? ( ${PYTHON_DEPS} )
175 + readline? ( sys-libs/readline:0= )
176 + selinux? ( >=sys-libs/libselinux-2.2.2-r4[${MULTILIB_USEDEP}] )
177 + slang? ( sys-libs/slang )
178 + !build? ( systemd? ( sys-apps/systemd ) )
179 + udev? ( virtual/libudev:= )"
180 +DEPEND="${RDEPEND}
181 + virtual/pkgconfig
182 + nls? ( sys-devel/gettext )
183 + test? ( sys-devel/bc )
184 + virtual/os-headers"
185 +RDEPEND+="
186 + kill? (
187 + !sys-apps/coreutils[kill]
188 + !sys-process/procps[kill]
189 + )
190 + !net-wireless/rfkill
191 + !sys-process/schedutils
192 + !sys-apps/setarch
193 + !<sys-apps/sysvinit-2.88-r7
194 + !<sys-libs/e2fsprogs-libs-1.41.8
195 + !<sys-fs/e2fsprogs-1.41.8
196 + !<app-shells/bash-completion-2.7-r1"
197 +
198 +REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
199 +
200 +S="${WORKDIR}/${MY_P}"
201 +
202 +PATCHES=(
203 + "${FILESDIR}/util-linux-2.32-python3-tests.patch"
204 +)
205 +
206 +pkg_setup() {
207 + use python && python-single-r1_pkg_setup
208 +}
209 +
210 +src_prepare() {
211 + default
212 +
213 + eapply "${FILESDIR}"/${P}-add-missing-lintl.patch
214 + touch -r "${S}"/configure "${S}"/libsmartcols/src/Makemodule.am || die
215 + touch -r "${S}"/configure "${S}"/libuuid/src/Makemodule.am || die
216 +
217 + # Prevent uuidd test failure due to socket path limit. #593304
218 + sed -i \
219 + -e "s|UUIDD_SOCKET=\"\$(mktemp -u \"\${TS_OUTDIR}/uuiddXXXXXXXXXXXXX\")\"|UUIDD_SOCKET=\"\$(mktemp -u \"${T}/uuiddXXXXXXXXXXXXX.sock\")\"|g" \
220 + tests/ts/uuid/uuidd || die "Failed to fix uuidd test"
221 +
222 + if ! use userland_GNU; then
223 + # test runner is using GNU-specific xargs call
224 + sed -i -e 's:xargs:gxargs:' tests/run.sh || die
225 + # test requires util-linux uuidgen (which we don't build)
226 + rm tests/ts/uuid/oids || die
227 + fi
228 +
229 + if [[ ${PV} == 9999 ]] ; then
230 + po/update-potfiles
231 + eautoreconf
232 + fi
233 +
234 + # Undo bad ncurses handling by upstream. #601530
235 + sed -i -E \
236 + -e '/NCURSES_/s:(ncursesw?)[56]-config:$PKG_CONFIG \1:' \
237 + -e 's:(ncursesw?)[56]-config --version:$PKG_CONFIG --exists --print-errors \1:' \
238 + configure || die
239 +
240 + elibtoolize
241 +}
242 +
243 +lfs_fallocate_test() {
244 + # Make sure we can use fallocate with LFS #300307
245 + cat <<-EOF > "${T}"/fallocate.${ABI}.c
246 + #define _GNU_SOURCE
247 + #include <fcntl.h>
248 + main() { return fallocate(0, 0, 0, 0); }
249 + EOF
250 + append-lfs-flags
251 + $(tc-getCC) ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} "${T}"/fallocate.${ABI}.c -o /dev/null >/dev/null 2>&1 \
252 + || export ac_cv_func_fallocate=no
253 + rm -f "${T}"/fallocate.${ABI}.c
254 +}
255 +
256 +multilib_src_configure() {
257 + lfs_fallocate_test
258 + # The scanf test in a run-time test which fails while cross-compiling.
259 + # Blindly assume a POSIX setup since we require libmount, and libmount
260 + # itself fails when the scanf test fails. #531856
261 + tc-is-cross-compiler && export scanf_cv_alloc_modifier=ms
262 + export ac_cv_header_security_pam_misc_h=$(multilib_native_usex pam) #485486
263 + export ac_cv_header_security_pam_appl_h=$(multilib_native_usex pam) #545042
264 +
265 + local myeconfargs=(
266 + --enable-fs-paths-extra="${EPREFIX}/usr/sbin:${EPREFIX}/bin:${EPREFIX}/usr/bin"
267 + --with-bashcompletiondir="$(get_bashcompdir)"
268 + $(multilib_native_use_enable suid makeinstall-chown)
269 + $(multilib_native_use_enable suid makeinstall-setuid)
270 + $(multilib_native_use_with python)
271 + $(multilib_native_use_with readline)
272 + $(multilib_native_use_with slang)
273 + $(multilib_native_use_with systemd)
274 + $(multilib_native_use_with udev)
275 + $(multilib_native_usex ncurses "$(use_with unicode ncursesw)" '--without-ncursesw')
276 + $(multilib_native_usex ncurses "$(use_with !unicode ncurses)" '--without-ncurses')
277 + $(tc-has-tls || echo --disable-tls)
278 + $(use_enable nls)
279 + $(use_enable unicode widechar)
280 + $(use_enable static-libs static)
281 + $(use_with selinux)
282 + $(usex ncurses '' '--without-tinfo')
283 + )
284 + # build programs only on GNU, on *BSD we want libraries only
285 + if multilib_is_native_abi && use userland_GNU; then
286 + myeconfargs+=(
287 + --disable-chfn-chsh
288 + --disable-login
289 + --disable-nologin
290 + --disable-su
291 + --enable-agetty
292 + --enable-bash-completion
293 + --enable-line
294 + --enable-partx
295 + --enable-raw
296 + --enable-rename
297 + --enable-rfkill
298 + --enable-schedutils
299 + --with-systemdsystemunitdir="$(systemd_get_systemunitdir)"
300 + $(use_enable caps setpriv)
301 + $(use_enable cramfs)
302 + $(use_enable fdformat)
303 + $(use_enable tty-helpers mesg)
304 + $(use_enable tty-helpers wall)
305 + $(use_enable tty-helpers write)
306 + $(use_enable kill)
307 + )
308 + else
309 + myeconfargs+=(
310 + --disable-all-programs
311 + --disable-bash-completion
312 + --without-systemdsystemunitdir
313 + # build libraries
314 + --enable-libuuid
315 + --enable-libblkid
316 + --enable-libsmartcols
317 + --enable-libfdisk
318 + )
319 + if use userland_GNU; then
320 + # those libraries don't work on *BSD
321 + myeconfargs+=(
322 + --enable-libmount
323 + )
324 + fi
325 + fi
326 + ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
327 +}
328 +
329 +multilib_src_test() {
330 + emake check TS_OPTS="--parallel=$(makeopts_jobs) --nonroot"
331 +}
332 +
333 +multilib_src_install() {
334 + emake DESTDIR="${D}" install
335 +
336 + if multilib_is_native_abi && use userland_GNU; then
337 + # need the libs in /
338 + gen_usr_ldscript -a blkid fdisk mount smartcols uuid
339 +
340 + use python && python_optimize
341 + fi
342 +}
343 +
344 +multilib_src_install_all() {
345 + dodoc AUTHORS NEWS README* Documentation/{TODO,*.txt,releases/*}
346 +
347 + # e2fsprogs-libs didnt install .la files, and .pc work fine
348 + find "${ED}" -name "*.la" -delete || die
349 +
350 + if ! use userland_GNU; then
351 + # manpage collisions
352 + # TODO: figure out a good way to keep them
353 + rm "${ED%/}"/usr/share/man/man3/uuid* || die
354 + fi
355 +
356 + if use pam; then
357 + newpamd "${FILESDIR}/runuser.pamd" runuser
358 + newpamd "${FILESDIR}/runuser-l.pamd" runuser-l
359 + fi
360 +
361 + # Note:
362 + # Bash completion for "runuser" command is provided by same file which
363 + # would also provide bash completion for "su" command. However, we don't
364 + # use "su" command from this package.
365 + # This triggers a known QA warning which we ignore for now to magically
366 + # keep bash completion for "su" command which shadow package does not
367 + # provide.
368 +}
369 +
370 +pkg_postinst() {
371 + if ! use tty-helpers; then
372 + elog "The mesg/wall/write tools have been disabled due to USE=-tty-helpers."
373 + fi
374 +
375 + if [[ -z ${REPLACING_VERSIONS} ]]; then
376 + elog "The agetty util now clears the terminal by default. You"
377 + elog "might want to add --noclear to your /etc/inittab lines."
378 + fi
379 +}