From 9b52abc662b3594d70392fab05769cb2118810cb Mon Sep 17 00:00:00 2001 From: slyfox Date: Sat, 12 Aug 2017 16:30:06 +0000 Subject: glibc: make locale-gen parallel, bug #592300 Speed up locale generation on multicore machines. Patch is written by Tobias Klausmann. Bug: https://bugs.gentoo.org/592300 --- locale-gen | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/locale-gen b/locale-gen index 31e38c4..6653cad 100755 --- a/locale-gen +++ b/locale-gen @@ -52,7 +52,7 @@ show_usage() { } show_version() { local b="(" a=")" - local cvsver="$Revision: 1.41 $b $Date: 2015/10/14 13:55:56 $a" + local cvsver="$Revision: 1.42 $b $Date: 2017/08/12 16:30:06 $a" echo "locale-gen-${cvsver//: }" exit 0 } @@ -149,15 +149,6 @@ for option in ${options} ; do done unset IFS -if ${LOCALE_ARCHIVE} ; then - if [[ ${JOBS_MAX} != 1 ]] ; then - ewarn "Generating locale-archive: forcing # of jobs to 1" - JOBS_MAX=1 - fi -else - LOCALEDEF_OPTS="--no-archive ${LOCALEDEF_OPTS}" -fi - [[ -n ${ALL} ]] && CONFIG=${SUPPORTED} # Extract the location of the locale dir on the fly as `localedef --help` has: @@ -256,6 +247,7 @@ generate_locale() { x=$( [[ -n ${output} ]] && ebegin "${output}" "${DESTDIR}"usr/bin/localedef ${LOCALEDEF_OPTS} \ + --no-archive \ -i "${input}" \ -f "${charmap}" \ -A "${ALIAS}" \ @@ -347,6 +339,33 @@ ret=$(( 0 ${JOB_RETS[@]/#/+} )) [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \ einfo "Generation complete" +if ${LOCALE_ARCHIVE} ; then + ebegin "Adding locales to archive" + # The pattern ends with / on purpose: we don't care about files (like + # locale-archive) in the locale subdir, and we definitely don't want to + # delete them! + for LOC in "${LOCALEDIR}"/*/; do + LOC=${LOC%/} # Strip trailing /, since localedef doesn't like it + x=$( + "${DESTDIR}"usr/bin/localedef \ + --add-to-archive "${LOC}" \ + --replace \ + --prefix "${DESTDIR%${EPREFIX}/}/" + ret=$? + if [[ -n ${output} ]] ; then + echo "${x}" + elif [[ ${ret} -ne 0 ]] ; then + eerror "${disp}: ${x}" + fi + if [[ $ret -eq 0 ]]; then + rm -r "${LOC}" + fi + exit ${ret} + ) + done + eend $ret +fi + # Remove locales that existed but were not requested if [[ -n ${UPDATE} ]] ; then # Ignore these pseudo locales -- cgit v1.2.3-65-gdbad