Gentoo Archives: gentoo-commits

From: Mike Gilbert <floppym@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-kernel/dracut/, sys-kernel/dracut/files/
Date: Tue, 09 Oct 2018 19:24:05
Message-Id: 1539113014.6093c44b4abfabbdd98b92aaf0faaf10c0646acc.floppym@gentoo
1 commit: 6093c44b4abfabbdd98b92aaf0faaf10c0646acc
2 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 9 19:23:34 2018 +0000
4 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 9 19:23:34 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6093c44b
7
8 sys-kernel/dracut: simplify ldd parsing logic in dracut-install
9
10 Closes: https://bugs.gentoo.org/667752
11 Package-Manager: Portage-2.3.50_p14, Repoman-2.3.11_p21
12 Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
13
14 sys-kernel/dracut/dracut-048-r1.ebuild | 154 +++++++++++++++++++++
15 ...dracut-install-simplify-ldd-parsing-logic.patch | 41 ++++++
16 2 files changed, 195 insertions(+)
17
18 diff --git a/sys-kernel/dracut/dracut-048-r1.ebuild b/sys-kernel/dracut/dracut-048-r1.ebuild
19 new file mode 100644
20 index 00000000000..5984c374472
21 --- /dev/null
22 +++ b/sys-kernel/dracut/dracut-048-r1.ebuild
23 @@ -0,0 +1,154 @@
24 +# Copyright 1999-2018 Gentoo Authors
25 +# Distributed under the terms of the GNU General Public License v2
26 +
27 +EAPI=6
28 +
29 +inherit bash-completion-r1 eutils linux-info systemd toolchain-funcs
30 +
31 +DESCRIPTION="Generic initramfs generation tool"
32 +HOMEPAGE="https://dracut.wiki.kernel.org"
33 +SRC_URI="mirror://kernel/linux/utils/boot/${PN}/${P}.tar.xz"
34 +
35 +LICENSE="GPL-2"
36 +SLOT="0"
37 +KEYWORDS="~alpha ~amd64 ~arm ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
38 +IUSE="debug selinux"
39 +
40 +# Tests need root privileges, bug #298014
41 +RESTRICT="test"
42 +
43 +COMMON_DEPEND=">=sys-apps/kmod-23[tools]
44 + virtual/pkgconfig
45 + virtual/udev
46 + "
47 +RDEPEND="${COMMON_DEPEND}
48 + app-arch/cpio
49 + >=app-shells/bash-4.0:0
50 + sys-apps/coreutils[xattr(-)]
51 + || (
52 + >=sys-apps/sysvinit-2.87-r3
53 + sys-apps/systemd[sysv-utils]
54 + )
55 + >=sys-apps/util-linux-2.21
56 +
57 + debug? ( dev-util/strace )
58 + selinux? (
59 + sec-policy/selinux-dracut
60 + sys-libs/libselinux
61 + sys-libs/libsepol
62 + )
63 + "
64 +DEPEND="${COMMON_DEPEND}
65 + app-text/asciidoc
66 + app-text/docbook-xml-dtd:4.5
67 + >=app-text/docbook-xsl-stylesheets-1.75.2
68 + >=dev-libs/libxslt-1.1.26
69 + "
70 +
71 +DOCS=( AUTHORS HACKING NEWS README README.generic README.kernel README.modules
72 + README.testsuite TODO )
73 +
74 +QA_MULTILIB_PATHS="usr/lib/dracut/.*"
75 +
76 +PATCHES=(
77 + "${FILESDIR}"/048-dracut-install-simplify-ldd-parsing-logic.patch
78 +)
79 +
80 +src_configure() {
81 + local myconf=(
82 + --prefix="${EPREFIX}/usr"
83 + --sysconfdir="${EPREFIX}/etc"
84 + --bashcompletiondir="$(get_bashcompdir)"
85 + --systemdsystemunitdir="$(systemd_get_systemunitdir)"
86 + )
87 +
88 + tc-export CC PKG_CONFIG
89 +
90 + echo ./configure "${myconf[@]}"
91 + ./configure "${myconf[@]}" || die
92 +}
93 +
94 +src_install() {
95 + default
96 +
97 + local libdirs=( /$(get_libdir) /usr/$(get_libdir) )
98 + if [[ ${SYMLINK_LIB} = yes && $(get_libdir) != lib ]]; then
99 + # Preserve lib -> lib64 symlinks in initramfs
100 + libdirs+=( /lib /usr/lib )
101 + fi
102 +
103 + einfo "Setting libdirs to \"${libdirs[*]}\" ..."
104 + echo "libdirs=\"${libdirs[*]}\"" > "${T}/gentoo.conf" || die
105 + insinto "/usr/lib/dracut/dracut.conf.d"
106 + doins "${T}/gentoo.conf"
107 +
108 + insinto /etc/logrotate.d
109 + newins dracut.logrotate dracut
110 +
111 + docinto html
112 + dodoc dracut.html
113 +}
114 +
115 +pkg_postinst() {
116 + if linux-info_get_any_version && linux_config_exists; then
117 + ewarn ""
118 + ewarn "If the following test report contains a missing kernel"
119 + ewarn "configuration option, you should reconfigure and rebuild your"
120 + ewarn "kernel before booting image generated with this Dracut version."
121 + ewarn ""
122 +
123 + local CONFIG_CHECK="~BLK_DEV_INITRD ~DEVTMPFS"
124 +
125 + # Kernel configuration options descriptions:
126 + local ERROR_DEVTMPFS='CONFIG_DEVTMPFS: "Maintain a devtmpfs filesystem to mount at /dev" '
127 + ERROR_DEVTMPFS+='is missing and REQUIRED'
128 + local ERROR_BLK_DEV_INITRD='CONFIG_BLK_DEV_INITRD: "Initial RAM filesystem and RAM disk '
129 + ERROR_BLK_DEV_INITRD+='(initramfs/initrd) support" is missing and REQUIRED'
130 +
131 + check_extra_config
132 + echo
133 + else
134 + ewarn ""
135 + ewarn "Your kernel configuration couldn't be checked."
136 + ewarn "Please check manually if following options are enabled:"
137 + ewarn ""
138 + ewarn " CONFIG_BLK_DEV_INITRD"
139 + ewarn " CONFIG_DEVTMPFS"
140 + ewarn ""
141 + fi
142 +
143 + elog "To get additional features, a number of optional runtime"
144 + elog "dependencies may be installed:"
145 + elog ""
146 + optfeature "Networking support" net-misc/curl "net-misc/dhcp[client]" \
147 + sys-apps/iproute2 "net-misc/iputils[arping]"
148 + optfeature \
149 + "Measure performance of the boot process for later visualisation" \
150 + app-benchmarks/bootchart2 app-admin/killproc sys-process/acct
151 + optfeature "Scan for Btrfs on block devices" sys-fs/btrfs-progs
152 + optfeature "Load kernel modules and drop this privilege for real init" \
153 + sys-libs/libcap
154 + optfeature "Support CIFS" net-fs/cifs-utils
155 + optfeature "Decrypt devices encrypted with cryptsetup/LUKS" \
156 + "sys-fs/cryptsetup[-static-libs]"
157 + optfeature "Support for GPG-encrypted keys for crypt module" \
158 + app-crypt/gnupg
159 + optfeature \
160 + "Allows use of dash instead of default bash (on your own risk)" \
161 + app-shells/dash
162 + optfeature "Framebuffer splash (media-gfx/splashutils)" \
163 + media-gfx/splashutils
164 + optfeature "Support iSCSI" sys-block/open-iscsi
165 + optfeature "Support Logical Volume Manager" sys-fs/lvm2
166 + optfeature "Support MD devices, also known as software RAID devices" \
167 + sys-fs/mdadm
168 + optfeature "Support Device Mapper multipathing" sys-fs/multipath-tools
169 + optfeature "Plymouth boot splash" '>=sys-boot/plymouth-0.8.5-r5'
170 + optfeature "Support network block devices" sys-block/nbd
171 + optfeature "Support NFS" net-fs/nfs-utils net-nds/rpcbind
172 + optfeature \
173 + "Install ssh and scp along with config files and specified keys" \
174 + net-misc/openssh
175 + optfeature "Enable logging with syslog-ng or rsyslog" app-admin/syslog-ng \
176 + app-admin/rsyslog
177 +}
178
179 diff --git a/sys-kernel/dracut/files/048-dracut-install-simplify-ldd-parsing-logic.patch b/sys-kernel/dracut/files/048-dracut-install-simplify-ldd-parsing-logic.patch
180 new file mode 100644
181 index 00000000000..aa9c543fdce
182 --- /dev/null
183 +++ b/sys-kernel/dracut/files/048-dracut-install-simplify-ldd-parsing-logic.patch
184 @@ -0,0 +1,41 @@
185 +From 6d886bb74d1608e4565d926aa259ea5afc9df7b9 Mon Sep 17 00:00:00 2001
186 +From: Mike Gilbert <floppym@g.o>
187 +Date: Thu, 4 Oct 2018 16:45:47 -0400
188 +Subject: [PATCH] dracut-install: simplify ldd parsing logic
189 +
190 +The previous logic would not handle absolute paths on the left side of
191 +the "=>" properly. For example, on Gentoo ARM64, ldd outputs this:
192 +
193 + /lib/ld-linux-aarch64.so.1 => /lib64/ld-linux-aarch64.so.1
194 +
195 +At runtime, the kernel tries to load the file from /lib, and fails if we
196 +only provide it in /lib64.
197 +
198 +Instead of looking for the first slash after the "=>", just look for the
199 +first slash, period. This would fail if we somehow had a relative path
200 +on the left side (foo/libbar.so), but I'm not aware of any binaries that
201 +would contain such an entry in DT_NEEDED.
202 +
203 +Bug: https://bugs.gentoo.org/667752
204 +Signed-off-by: Mike Gilbert <floppym@g.o>
205 +---
206 + install/dracut-install.c | 6 +-----
207 + 1 file changed, 1 insertion(+), 5 deletions(-)
208 +
209 +diff --git a/install/dracut-install.c b/install/dracut-install.c
210 +index 88bca1d44..5f352b360 100644
211 +--- a/install/dracut-install.c
212 ++++ b/install/dracut-install.c
213 +@@ -479,11 +479,7 @@ static int resolve_deps(const char *src)
214 + if (strstr(buf, destrootdir))
215 + break;
216 +
217 +- p = strstr(buf, "=>");
218 +- if (!p)
219 +- p = buf;
220 +-
221 +- p = strchr(p, '/');
222 ++ p = strchr(buf, '/');
223 + if (p) {
224 + char *q;
225 +