Skip to content
This repository has been archived by the owner on Sep 18, 2020. It is now read-only.

Commit

Permalink
glibc: apply CoreOS tweaks
Browse files Browse the repository at this point in the history
This time around our changes take a slightly different approach. Instead
of editing the ebuild to undo things done in the common eblit code the
eblits are edited directly, allowing for better customization. Also,
managing locales is now different. Inside the SDK all locales are built
at compile time, avoiding the need for locale-gen which is slow and
complicates setup of the SDK chroot. For cross-compiled targets (CoreOS
itself) final images don't include locale info either, again no need for
locale-gen.

The SDK is a bit bigger now, the compressed tarball is 20MB bigger and
200MB bigger extracted on disk. Considering how big it already is this
shouldn't be that big of a deal.
  • Loading branch information
marineam committed Dec 10, 2015
1 parent b982cc1 commit e998cb7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 59 deletions.
8 changes: 1 addition & 7 deletions sys-libs/glibc/files/eblits/pkg_postinst.eblit
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ eblit-glibc-pkg_postinst() {
# errors from this step #253697
/sbin/telinit U 2>/dev/null

# if the host locales.gen contains no entries, we'll install everything
local locale_list="${ROOT}etc/locale.gen"
if [[ -z $(locale-gen --list --config "${locale_list}") ]] ; then
ewarn "Generating all locales; edit /etc/locale.gen to save time/space"
locale_list="${ROOT}usr/share/i18n/SUPPORTED"
fi
locale-gen -j $(makeopts_jobs) --config "${locale_list}"
## COREOS: locale-gen is not installed
fi
}
6 changes: 1 addition & 5 deletions sys-libs/glibc/files/eblits/pkg_preinst.eblit
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ eblit-glibc-pkg_preinst() {
# prepare /etc/ld.so.conf.d/ for files
mkdir -p "${EROOT}"/etc/ld.so.conf.d

# Default /etc/hosts.conf:multi to on for systems with small dbs.
if [[ $(wc -l < "${EROOT}"/etc/hosts) -lt 1000 ]] ; then
sed -i '/^multi off/s:off:on:' "${ED}"/etc/host.conf
elog "Defaulting /etc/host.conf:multi to on"
fi
## COREOS: host.conf is not installed

[[ ${ROOT} != "/" ]] && return 0
[[ -d ${D}/$(get_libdir) ]] || return 0
Expand Down
64 changes: 17 additions & 47 deletions sys-libs/glibc/files/eblits/src_install.eblit
Original file line number Diff line number Diff line change
Expand Up @@ -133,70 +133,40 @@ toolchain-glibc_src_install() {
return 0
fi

# Files for Debian-style locale updating
dodir /usr/share/i18n
sed \
-e "/^#/d" \
-e "/SUPPORTED-LOCALES=/d" \
-e "s: \\\\::g" -e "s:/: :g" \
"${S}"/localedata/SUPPORTED > "${ED}"/usr/share/i18n/SUPPORTED \
|| die "generating /usr/share/i18n/SUPPORTED failed"
cd "${WORKDIR}"/extra/locale
dosbin locale-gen || die
doman *.[0-8]
insinto /etc
doins locale.gen || die
## COREOS ##
# For reference, the rest of this function has been modified to do:
# - The SDK just gets the full locale archive, no need for locale-gen.
# - CoreOS targets (which are cross compiled) don't get any locales.
# - Config files are installed by baselayout, not glibc.
# - Forget about nscd for now, we have the use flag off anyway.

if ! tc-is-cross-compiler ; then
emake install_root="${D}$(alt_prefix)" localedata/install-locales || die
# Sanity check the above command worked
[[ -f ${ED}/usr/$(get_libdir)/locale/locale-archive ]] || die
else
keepdir /usr/$(get_libdir)/locale
fi

# Make sure all the ABI's can find the locales and so we only
# have to generate one set
local a
keepdir /usr/$(get_libdir)/locale
for a in $(get_install_abis) ; do
if [[ ! -e ${ED}/usr/$(get_abi_LIBDIR ${a})/locale ]] ; then
dosym /usr/$(get_libdir)/locale /usr/$(get_abi_LIBDIR ${a})/locale
fi
done

cd "${S}"

# Install misc network config files
insinto /etc
doins nscd/nscd.conf posix/gai.conf nss/nsswitch.conf || die
doins "${WORKDIR}"/extra/etc/*.conf || die

if ! in_iuse nscd || use nscd ; then
doinitd "${WORKDIR}"/extra/etc/nscd || die

local nscd_args=(
-e "s:@PIDFILE@:$(strings "${ED}"/usr/sbin/nscd | grep nscd.pid):"
)
version_is_at_least 2.16 || nscd_args+=( -e 's: --foreground : :' )
sed -i "${nscd_args[@]}" "${ED}"/etc/init.d/nscd

# Newer versions of glibc include the nscd.service themselves.
# TODO: Drop the $FILESDIR copy once 2.19 goes stable.
if version_is_at_least 2.19 ; then
systemd_dounit nscd/nscd.service || die
systemd_newtmpfilesd nscd/nscd.tmpfiles nscd.conf || die
else
systemd_dounit "${FILESDIR}"/nscd.service || die
systemd_newtmpfilesd "${FILESDIR}"/nscd.tmpfilesd nscd.conf || die
fi
else
# Do this since extra/etc/*.conf above might have nscd.conf.
rm -f "${ED}"/etc/nscd.conf
fi
# Clean out any default configs
rm -rf "${ED}"/etc

echo 'LDPATH="include ld.so.conf.d/*.conf"' > "${T}"/00glibc
doenvd "${T}"/00glibc || die

cd "${S}"
for d in BUGS ChangeLog* CONFORMANCE FAQ NEWS NOTES PROJECTS README* ; do
[[ -s ${d} ]] && dodoc ${d}
done

# Prevent overwriting of the /etc/localtime symlink. We'll handle the
# creation of the "factory" symlink in pkg_postinst().
rm -f "${ED}"/etc/localtime
}

toolchain-glibc_headers_install() {
Expand Down

0 comments on commit e998cb7

Please sign in to comment.