Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-apps/baselayout/
Date: Mon, 27 Sep 2021 22:09:58
Message-Id: 1632780573.6569413acb19c0a23e0c6aeea9270f2787762589.williamh@gentoo
1 commit: 6569413acb19c0a23e0c6aeea9270f2787762589
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 27 22:09:07 2021 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 27 22:09:33 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6569413a
7
8 sys-apps/baselayout: 2.8 bump (no keywords)
9
10 Package-Manager: Portage-3.0.20, Repoman-3.0.3
11 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
12
13 sys-apps/baselayout/Manifest | 1 +
14 sys-apps/baselayout/baselayout-2.8.ebuild | 338 ++++++++++++++++++++++++++++++
15 sys-apps/baselayout/x | 11 +
16 3 files changed, 350 insertions(+)
17
18 diff --git a/sys-apps/baselayout/Manifest b/sys-apps/baselayout/Manifest
19 index 112675aad11..a24c7a1d49b 100644
20 --- a/sys-apps/baselayout/Manifest
21 +++ b/sys-apps/baselayout/Manifest
22 @@ -1 +1,2 @@
23 DIST baselayout-2.7.tar.bz2 30317 BLAKE2B 7b7c284b7d0a9608a0d03dbde0d62d793829b61d5361f5062fdeb8880a2f792c142e20acf7fa92e713e2ebb0bd1609ca65bc8a4191f2bf2c5df4f474eaeef1ee SHA512 8b28d2dc20fd5887db5c0e6b67a4217c4d0730529023fc57fb1ee95a431e1f492fb21e3e66980bef766819e9f542dc7e4ad3ae25465390194bbf970c3653c88e
24 +DIST baselayout-2.8.tar.bz2 30236 BLAKE2B 0bac62dd5585f1f550da8c99d06a7f8ab6cdd473b0499a8f0ac58a5c43e3883b42adb7f80c172d894fae93a6ddb6fec7a65cad9897f4a2532b481c82065ed96b SHA512 506d7cc8399b530eabc9ba2d16cbb6c024350f9487a2a9168c670cee9876f62e5a716942f698c4883013d6ccc9591c2d7fc2ac9d782f0ce8d724371ca94c739a
25
26 diff --git a/sys-apps/baselayout/baselayout-2.8.ebuild b/sys-apps/baselayout/baselayout-2.8.ebuild
27 new file mode 100644
28 index 00000000000..17df4a83021
29 --- /dev/null
30 +++ b/sys-apps/baselayout/baselayout-2.8.ebuild
31 @@ -0,0 +1,338 @@
32 +# Copyright 1999-2021 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +inherit multilib prefix
38 +
39 +DESCRIPTION="Filesystem baselayout and init scripts"
40 +HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
41 +if [[ ${PV} = 9999 ]]; then
42 + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/${PN}.git"
43 + inherit git-r3
44 +else
45 + SRC_URI="https://gitweb.gentoo.org/proj/${PN}.git/snapshot/${P}.tar.bz2"
46 +# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
47 +fi
48 +
49 +LICENSE="GPL-2"
50 +SLOT="0"
51 +IUSE="build kernel_FreeBSD kernel_linux +split-usr"
52 +
53 +pkg_setup() {
54 + multilib_layout
55 +}
56 +
57 +riscv_compat_symlink() {
58 + # Here we apply some special sauce for riscv.
59 + # Two multilib layouts exist for now:
60 + # 1) one level libdirs, (32bit) "lib" and (64bit) "lib64"
61 + # these are chosen by us to closely resemble other arches
62 + # 2) two level libdirs, "lib64/lp64d" "lib64/lp64" "lib32/ilp32d" ...
63 + # this is the glibc/gcc default
64 + # Unfortunately, the default has only one fallback, which is "lib"
65 + # for both 32bit and 64bit. So things do not break in 1), we need
66 + # to provide compatibility symlinks...
67 +
68 + # This function has exactly two parameters:
69 + # - the default libdir, to determine if 1) or 2) applies
70 + # - the location of the symlink (which points to ".")
71 +
72 + # Note: we call this only in the ${SYMLINK_LIB} = no codepath, since
73 + # there never was a ${SYMLINK_LIB} = yes riscv profile.
74 +
75 + case ${CHOST} in
76 + riscv*)
77 + # are we on a one level libdir profile? is there no symlink yet?
78 + if [[ ${1} != */* && ! -L ${2} ]] ; then
79 + ln -s . $2 || die "Unable to make $2 riscv compatibility symlink"
80 + fi
81 + ;;
82 + esac
83 +}
84 +
85 +# Create our multilib dirs - the Makefile has no knowledge of this
86 +multilib_layout() {
87 + local dir def_libdir libdir libdirs
88 + local prefix prefix_lst
89 + def_libdir=$(get_abi_LIBDIR $DEFAULT_ABI)
90 + libdirs=$(get_all_libdirs)
91 +
92 + if [[ -z "${SYMLINK_LIB}" || ${SYMLINK_LIB} = no ]] ; then
93 + prefix_lst=( "${EROOT}"/{,usr/,usr/local/} )
94 + for prefix in "${prefix_lst[@]}"; do
95 + for libdir in ${libdirs}; do
96 + dir="${prefix}${libdir}"
97 + if [[ -e "${dir}" ]]; then
98 + [[ ! -d "${dir}" ]] &&
99 + die "${dir} exists but is not a directory"
100 + continue
101 + fi
102 + if ! use split-usr && [[ ${prefix} = ${EROOT}/ ]]; then
103 + libdir="${libdir%%/*}"
104 + dir="${prefix}${libdir}"
105 + einfo "symlinking ${dir} to usr/${libdir}"
106 + ln -s usr/${libdir} ${dir} ||
107 + die "Unable to make ${dir} symlink"
108 + else
109 + einfo "creating directory ${dir}"
110 + mkdir -p "${dir}" ||
111 + die "Unable to create ${dir} directory"
112 + fi
113 + done
114 + riscv_compat_symlink "${def_libdir}" "${prefix}${def_libdir}/${DEFAULT_ABI}"
115 + done
116 + return 0
117 + fi
118 +
119 + [ -z "${def_libdir}" ] &&
120 + die "your DEFAULT_ABI=$DEFAULT_ABI appears to be invalid"
121 +
122 + # figure out which paths should be symlinks and which should be directories
123 + local dirs syms exp d
124 + for libdir in ${libdirs} ; do
125 + if use split-usr ; then
126 + exp=( {,usr/,usr/local/}${libdir} )
127 + else
128 + exp=( {usr/,usr/local/}${libdir} )
129 + fi
130 + for d in "${exp[@]}" ; do
131 + # most things should be dirs
132 + if [ "${SYMLINK_LIB}" = "yes" ] && [ "${libdir}" = "lib" ] ; then
133 + [ ! -h "${d}" ] && [ -e "${d}" ] && dirs+=" ${d}"
134 + else
135 + [ -h "${d}" ] && syms+=" ${d}"
136 + fi
137 + done
138 + done
139 + if [ -n "${syms}${dirs}" ] ; then
140 + ewarn "Your system profile has SYMLINK_LIB=${SYMLINK_LIB:-no}, so that means you need to"
141 + ewarn "have these paths configured as follows:"
142 + [ -n "${dirs}" ] && ewarn "symlinks to '${def_libdir}':${dirs}"
143 + [ -n "${syms}" ] && ewarn "directories:${syms}"
144 + ewarn "The ebuild will attempt to fix these, but only for trivial conversions."
145 + ewarn "If things fail, you will need to manually create/move the directories."
146 + echo
147 + fi
148 +
149 + # setup symlinks and dirs where we expect them to be; do not migrate
150 + # data ... just fall over in that case.
151 + if use split-usr ; then
152 + prefix_lst=( "${EROOT}"/{,usr/,usr/local/} )
153 + else
154 + prefix_lst=( "${EROOT}"/{usr/,usr/local/} )
155 + fi
156 + for prefix in "${prefix_lst[@]}"; do
157 + if [ "${SYMLINK_LIB}" = yes ] ; then
158 + # we need to make sure "lib" points to the native libdir
159 + if [ -h "${prefix}lib" ] ; then
160 + # it's already a symlink! assume it's pointing to right place ...
161 + continue
162 + elif [ -d "${prefix}lib" ] ; then
163 + # "lib" is a dir, so need to convert to a symlink
164 + ewarn "Converting ${prefix}lib from a dir to a symlink"
165 + rm -f "${prefix}lib"/.keep || die
166 + if rmdir "${prefix}lib" 2>/dev/null ; then
167 + ln -s ${def_libdir} "${prefix}lib" || die
168 + else
169 + die "non-empty dir found where we needed a symlink: ${prefix}lib"
170 + fi
171 + else
172 + # nothing exists, so just set it up sanely
173 + ewarn "Initializing ${prefix}lib as a symlink"
174 + mkdir -p "${prefix}" || die
175 + rm -f "${prefix}lib" || die
176 + ln -s ${def_libdir} "${prefix}lib" || die
177 + mkdir -p "${prefix}${def_libdir}" || die #423571
178 + fi
179 + else
180 + # we need to make sure "lib" is a dir
181 + if [ -h "${prefix}lib" ] ; then
182 + # "lib" is a symlink, so need to convert to a dir
183 + ewarn "Converting ${prefix}lib from a symlink to a dir"
184 + rm -f "${prefix}lib" || die
185 + if [ -d "${prefix}lib32" ] ; then
186 + ewarn "Migrating ${prefix}lib32 to ${prefix}lib"
187 + mv "${prefix}lib32" "${prefix}lib" || die
188 + else
189 + mkdir -p "${prefix}lib" || die
190 + fi
191 + elif [ -d "${prefix}lib" ] && ! has lib32 ${libdirs} ; then
192 + # make sure the old "lib" ABI location does not exist; we
193 + # only symlinked the lib dir on systems where we moved it
194 + # to "lib32" ...
195 + case ${CHOST} in
196 + *-gentoo-freebsd*) ;; # We want it the other way on fbsd.
197 + i?86*|x86_64*|powerpc*|sparc*|s390*)
198 + if [[ -d ${prefix}lib32 && ! -h ${prefix}lib32 ]] ; then
199 + rm -f "${prefix}lib32"/.keep || die
200 + if ! rmdir "${prefix}lib32" 2>/dev/null ; then
201 + ewarn "You need to merge ${prefix}lib32 into ${prefix}lib"
202 + die "non-empty dir found where there should be none: ${prefix}lib32"
203 + fi
204 + fi
205 + ;;
206 + esac
207 + else
208 + # nothing exists, so just set it up sanely
209 + ewarn "Initializing ${prefix}lib as a dir"
210 + mkdir -p "${prefix}lib" || die
211 + fi
212 + fi
213 + done
214 + if ! use split-usr ; then
215 + for libdir in ${libdirs}; do
216 + if [[ ! -e "${EROOT}${libdir}" ]]; then
217 + ln -s usr/"${libdir}" "${EROOT}${libdir}" ||
218 + die "Unable to make ${EROOT}${libdir} symlink"
219 + fi
220 + done
221 + fi
222 +}
223 +
224 +pkg_preinst() {
225 + # This is written in src_install (so it's in CONTENTS), but punt all
226 + # pending updates to avoid user having to do etc-update (and make the
227 + # pkg_postinst logic simpler).
228 + rm -f "${EROOT}"/etc/._cfg????_gentoo-release || die
229 +
230 + # We need to install directories and maybe some dev nodes when building
231 + # stages, but they cannot be in CONTENTS.
232 + # Also, we cannot reference $S as binpkg will break so we do this.
233 + multilib_layout
234 + if use build ; then
235 + if use split-usr ; then
236 + emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout
237 + else
238 + emake -C "${ED}/usr/share/${PN}" DESTDIR="${EROOT}" layout-usrmerge
239 + fi
240 + fi
241 + rm -f "${ED}"/usr/share/${PN}/Makefile || die
242 +}
243 +
244 +src_prepare() {
245 + default
246 + if use prefix; then
247 + hprefixify -e "/EUID/s,0,${EUID}," -q '"' etc/profile
248 + hprefixify etc/{env.d/50baselayout,shells} share.Linux/passwd
249 + echo PATH=/usr/sbin:/sbin:/usr/bin:/bin >> etc/env.d/99host
250 + fi
251 +
252 + # don't want symlinked directories in PATH on systems with usr-merge
253 + if ! use split-usr; then
254 + sed \
255 + -e 's|/usr/local/sbin:||g' \
256 + -e 's|:/usr/sbin:|:|g' \
257 + -e 's|:/sbin:|:|g' \
258 + -e 's|:/bin:|:|g' \
259 + -i etc/env.d/50baselayout || die
260 + fi
261 +
262 + # handle multilib paths. do it here because we want this behavior
263 + # regardless of the C library that you're using. we do explicitly
264 + # list paths which the native ldconfig searches, but this isn't
265 + # problematic as it doesn't change the resulting ld.so.cache or
266 + # take longer to generate. similarly, listing both the native
267 + # path and the symlinked path doesn't change the resulting cache.
268 + local libdir ldpaths
269 + for libdir in $(get_all_libdirs) ; do
270 + use split-usr && ldpaths+=":${EPREFIX}/${libdir}"
271 + ldpaths+=":${EPREFIX}/usr/${libdir}"
272 + ldpaths+=":${EPREFIX}/usr/local/${libdir}"
273 + done
274 + echo "LDPATH='${ldpaths#:}'" >> etc/env.d/50baselayout
275 +}
276 +
277 +src_install() {
278 + emake \
279 + OS=$(usex kernel_FreeBSD BSD Linux) \
280 + DESTDIR="${ED}" \
281 + install
282 +
283 + # need the makefile in pkg_preinst
284 + insinto /usr/share/${PN}
285 + doins Makefile
286 +
287 + dodoc ChangeLog
288 +}
289 +
290 +pkg_postinst() {
291 + local x
292 +
293 + # We installed some files to /usr/share/baselayout instead of /etc to stop
294 + # (1) overwriting the user's settings
295 + # (2) screwing things up when attempting to merge files
296 + # (3) accidentally packaging up personal files with quickpkg
297 + # If they don't exist then we install them
298 + for x in master.passwd passwd shadow group fstab ; do
299 + [ -e "${EROOT}/etc/${x}" ] && continue
300 + [ -e "${EROOT}/usr/share/baselayout/${x}" ] || continue
301 + cp -p "${EROOT}/usr/share/baselayout/${x}" "${EROOT}"/etc || die
302 + done
303 +
304 + # Force shadow permissions to not be world-readable #260993
305 + for x in shadow ; do
306 + if [ -e "${EROOT}/etc/${x}" ] ; then
307 + chmod o-rwx "${EROOT}/etc/${x}" || die
308 + fi
309 + done
310 +
311 + # Take care of the etc-update for the user
312 + if [ -e "${EROOT}"/etc/._cfg0000_gentoo-release ] ; then
313 + mv "${EROOT}"/etc/._cfg0000_gentoo-release "${EROOT}"/etc/gentoo-release || die
314 + fi
315 +
316 + # whine about users that lack passwords #193541
317 + if [[ -e "${EROOT}"/etc/shadow ]] ; then
318 + local bad_users=$(sed -n '/^[^:]*::/s|^\([^:]*\)::.*|\1|p' "${EROOT}"/etc/shadow)
319 + if [[ -n ${bad_users} ]] ; then
320 + echo
321 + ewarn "The following users lack passwords!"
322 + ewarn ${bad_users}
323 + fi
324 + fi
325 +
326 + # whine about users with invalid shells #215698
327 + if [[ -e "${EROOT}"/etc/passwd ]] ; then
328 + local bad_shells=$(awk -F: 'system("test -e ${ROOT}" $7) { print $1 " - " $7}' "${EROOT}"/etc/passwd | sort)
329 + if [[ -n ${bad_shells} ]] ; then
330 + echo
331 + ewarn "The following users have non-existent shells!"
332 + ewarn "${bad_shells}"
333 + fi
334 + fi
335 +
336 + # https://bugs.gentoo.org/361349
337 + if use kernel_linux; then
338 + mkdir -p "${EROOT}"/run || die
339 +
340 + local found fstype mountpoint
341 + while read -r _ mountpoint fstype _; do
342 + [[ ${mountpoint} = /run ]] && [[ ${fstype} = tmpfs ]] && found=1
343 + done < "${ROOT}"/proc/mounts
344 + [[ -z ${found} ]] &&
345 + ewarn "You should reboot now to get /run mounted with tmpfs!"
346 + fi
347 +
348 + for x in ${REPLACING_VERSIONS}; do
349 + if ver_test 2.4 -lt ${x}; then
350 + ewarn "After updating ${EROOT}/etc/profile, please run"
351 + ewarn "env-update && . /etc/profile"
352 + fi
353 +
354 + if ver_test 2.6 -lt ${x}; then
355 + ewarn "Please run env-update then log out and back in to"
356 + ewarn "update your path."
357 + fi
358 + # clean up after 2.5 typos
359 + # https://bugs.gentoo.org/show_bug.cgi?id=656380
360 + if [[ ${x} == 2.5 ]]; then
361 + rm -fr "${EROOT}/{,usr" || die
362 + fi
363 + done
364 +
365 + if [[ -e "${EROOT}"/etc/env.d/00basic ]]; then
366 + ewarn "${EROOT}/etc/env.d/00basic is now ${EROOT}/etc/env.d/50baselayout"
367 + ewarn "Please migrate your changes."
368 + fi
369 +}
370
371 diff --git a/sys-apps/baselayout/x b/sys-apps/baselayout/x
372 new file mode 100644
373 index 00000000000..a6859d9f723
374 --- /dev/null
375 +++ b/sys-apps/baselayout/x
376 @@ -0,0 +1,11 @@
377 +--- baselayout-2.8.ebuild 2021-09-27 16:54:24.631071046 -0500
378 ++++ baselayout-9999.ebuild 2021-09-27 15:56:09.320772518 -0500
379 +@@ -12,7 +12,7 @@
380 + inherit git-r3
381 + else
382 + SRC_URI="https://gitweb.gentoo.org/proj/${PN}.git/snapshot/${P}.tar.bz2"
383 +-# KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
384 ++ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
385 + fi
386 +
387 + LICENSE="GPL-2"