public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Andreas K. Hüttel" <dilfridge@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/locale-gen:master commit in: /
Date: Mon, 27 Jul 2020 10:36:13 +0000 (UTC)	[thread overview]
Message-ID: <1595846150.550b6726e3fed643c3eb3ce19bd56887b5a3a840.dilfridge@gentoo> (raw)

commit:     550b6726e3fed643c3eb3ce19bd56887b5a3a840
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 27 10:35:50 2020 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 27 10:35:50 2020 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=550b6726

Further logic improvements

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 locale-gen | 114 ++++++++++++++++++++++++++++++++-----------------------------
 1 file changed, 60 insertions(+), 54 deletions(-)

diff --git a/locale-gen b/locale-gen
index f740d70..93616b3 100755
--- a/locale-gen
+++ b/locale-gen
@@ -191,19 +191,6 @@ if [[ -z ${locales_to_generate} ]] && [[ -e ${CONFIG} ]] ; then
 	fi
 fi
 
-if [[ -z ${locales_to_generate} ]] ; then
-	[[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
-		ewarn "No locales to generate found, keeping locale archive"
-	exit 0
-fi
-
-mkdir -p "${LOCALEDIR}"
-if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
-	# Remove all old locale dir and locale-archive before generating new
-	# locale data.  Scrubbing via update is done elsewhere.
-	rm -rf "${LOCALEDIR}"/* &> /dev/null || true
-fi
-
 # Transform the name in locales.gen to the name used when storing
 # the locale data in /usr/lib/locale/ ... this normalize algo is
 # taken out of the glibc localedef source code ...
@@ -227,10 +214,27 @@ locales_disp=$(echo "${locales_to_generate}" | sed \
 	-e '/^[^@]*$/s:[[:space:]]*\([^.[:space:]]*\)\([^[:space:]]*\)[[:space:]]\+\([^[:space:]]*\):\1.\3:')
 
 # Now check the normalized version for C.UTF-8, and add it if not present
-if echo ${locales_disp} | grep -vq 'C.UTF-8' ; then
-	locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
-	locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
-	CUTF_ADDED="true"
+if [[ -z ${locales_to_generate} ]] ; then
+	if [[ -z ${JUST_LIST} ]] ; then
+		[[ ${QUIET} -eq 0 ]] && \
+			ewarn "No locales to generate found, keeping archive but ensuring C.UTF-8 is present"
+		KEEP=1
+		UPDATE=1
+		locales_disp='C.UTF-8'
+		locales_to_generate='C.UTF-8 UTF-8'
+	fi
+else
+	if echo ${locales_disp} | grep -vqi 'C.UTF-8' ; then
+		locales_to_generate=$(echo "${locales_to_generate}" ; echo -n 'C.UTF-8 UTF-8')
+		locales_disp=$(echo "${locales_disp}" ; echo -n 'C.UTF-8')
+	fi
+fi
+
+mkdir -p "${LOCALEDIR}"
+if [[ -z ${KEEP} && -z ${UPDATE} ]] ; then
+	# Remove all old locale dir and locale-archive before generating new
+	# locale data.  Scrubbing via update is done elsewhere.
+	rm -rf "${LOCALEDIR}"/* &> /dev/null || true
 fi
 
 eval declare -a locales_disp=(${locales_disp})
@@ -372,44 +376,46 @@ ret=$(( 0 ${JOB_RETS[@]/#/+} ))
 einfo "Generation complete"
 
 if ${LOCALE_ARCHIVE} && [[ -z ${JUST_LIST} ]] ; 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=$(
-			# In most cases, localedef can just use the system glibc.
-			# However, if we are within a major glibc upgrade, this may fail
-			# in src_* phases since the new localedef links against the new
-			# glibc, but the new glibc is not installed yet...
-			if [[ -z ${INPLACE_GLIBC} ]] ; then
-				"${DESTDIR}"usr/bin/localedef \
-					--add-to-archive "${LOC}" \
-					--replace \
-					--prefix "${DESTDIR%${EPREFIX}/}/"
-			else
-				# We assume that the current directory is "${ED}"/$(get_libdir),
-				# see the glibc ebuild, function glibc_sanity_check(), for why.
-				LC_ALL=C ./ld-*.so --library-path . \
+	if true ; then  # need to check that at least one locale has to be added
+		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=$(
+				# In most cases, localedef can just use the system glibc.
+				# However, if we are within a major glibc upgrade, this may fail
+				# in src_* phases since the new localedef links against the new
+				# glibc, but the new glibc is not installed yet...
+				if [[ -z ${INPLACE_GLIBC} ]] ; then
 					"${DESTDIR}"usr/bin/localedef \
-					--add-to-archive "${LOC}" \
-					--replace \
-					--prefix "${DESTDIR%${EPREFIX}/}/"
-			fi
-			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
+						--add-to-archive "${LOC}" \
+						--replace \
+						--prefix "${DESTDIR%${EPREFIX}/}/"
+				else
+					# We assume that the current directory is "${ED}"/$(get_libdir),
+					# see the glibc ebuild, function glibc_sanity_check(), for why.
+					LC_ALL=C ./ld-*.so --library-path . \
+						"${DESTDIR}"usr/bin/localedef \
+						--add-to-archive "${LOC}" \
+						--replace \
+						--prefix "${DESTDIR%${EPREFIX}/}/"
+				fi
+				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
 fi
 
 # Remove locales that existed but were not requested


             reply	other threads:[~2020-07-27 10:36 UTC|newest]

Thread overview: 148+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 10:36 Andreas K. Hüttel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-09-18 23:06 [gentoo-commits] proj/locale-gen:master commit in: / Kerin Millar
2025-09-18 23:04 Kerin Millar
2025-09-18 23:04 Kerin Millar
2025-09-15  5:08 Kerin Millar
2025-09-15  4:07 Kerin Millar
2025-09-15  4:07 Kerin Millar
2025-09-15  4:07 Kerin Millar
2025-09-14  4:24 Kerin Millar
2025-09-14  4:20 Kerin Millar
2025-09-13 23:53 Kerin Millar
2025-09-13 23:51 Kerin Millar
2025-09-13 23:51 Kerin Millar
2025-09-13 23:23 Kerin Millar
2025-09-13 23:23 Kerin Millar
2025-09-13  9:42 Kerin Millar
2025-09-13  9:35 Kerin Millar
2025-09-13  9:27 Kerin Millar
2025-09-13  8:46 Kerin Millar
2025-09-13  8:42 Kerin Millar
2025-09-13  1:23 Kerin Millar
2025-09-13  1:14 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-09-12 16:59 Kerin Millar
2025-08-22 23:42 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-22 23:12 Kerin Millar
2025-08-20  2:39 Kerin Millar
2025-08-20  2:39 Kerin Millar
2025-08-19 13:37 Kerin Millar
2025-08-19 13:19 Kerin Millar
2025-08-18  2:46 Kerin Millar
2025-08-18  1:18 Kerin Millar
2025-08-18  1:18 Kerin Millar
2025-08-17  2:01 Kerin Millar
2025-08-16 23:17 Kerin Millar
2025-08-16 23:17 Kerin Millar
2025-08-16  3:46 Kerin Millar
2025-08-15 22:29 Kerin Millar
2025-08-15 22:29 Kerin Millar
2025-08-15 22:18 Kerin Millar
2025-08-15  5:35 Kerin Millar
2025-08-15  4:07 Kerin Millar
2025-08-15  3:57 Kerin Millar
2025-08-13 23:49 Kerin Millar
2025-08-13 22:53 Kerin Millar
2025-08-13 22:45 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 21:42 Kerin Millar
2025-08-13 10:09 Kerin Millar
2025-08-13 10:09 Kerin Millar
2025-08-12 17:32 Kerin Millar
2025-08-12  5:06 Kerin Millar
2025-08-12  5:06 Kerin Millar
2025-08-11 22:43 Kerin Millar
2025-08-11 16:04 Kerin Millar
2025-08-11 16:04 Kerin Millar
2025-08-11  0:39 Kerin Millar
2025-08-10 22:53 Kerin Millar
2025-08-10 22:22 Kerin Millar
2025-08-10 22:22 Kerin Millar
2025-08-10 17:05 Kerin Millar
2025-08-10  8:15 Kerin Millar
2025-08-10  1:22 Kerin Millar
2025-08-09 20:18 Kerin Millar
2025-08-09 19:42 Kerin Millar
2025-08-09 19:42 Kerin Millar
2025-08-09 19:42 Kerin Millar
2025-08-08 17:44 Kerin Millar
2025-08-08 17:44 Kerin Millar
2025-08-08 17:44 Kerin Millar
2025-08-08 17:44 Kerin Millar
2025-08-07 23:20 Kerin Millar
2025-08-07 23:20 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 22:59 Kerin Millar
2025-08-07 19:43 Kerin Millar
2025-08-07 19:41 Kerin Millar
2025-08-07 19:41 Kerin Millar
2025-08-07 16:35 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-07 16:20 Kerin Millar
2025-08-06 17:02 Kerin Millar
2025-08-06  7:44 Kerin Millar
2025-08-06  6:48 Kerin Millar
2025-08-05 23:00 Kerin Millar
2025-08-05 21:53 Kerin Millar
2025-08-05 21:53 Kerin Millar
2025-08-05 21:53 Kerin Millar
2025-08-05 10:55 Kerin Millar
2025-08-05 10:32 Kerin Millar
2025-08-05 10:29 Kerin Millar
2025-08-05 10:29 Kerin Millar
2025-08-04 16:02 Kerin Millar
2025-08-04 12:13 Kerin Millar
2025-08-04 12:13 Kerin Millar
2025-08-04 11:56 Kerin Millar
2025-08-04 11:25 Kerin Millar
2025-08-04 11:19 Sam James
2025-07-01 21:02 Andreas K. Hüttel
2023-05-11 22:23 Andreas K. Hüttel
2023-03-21 17:37 Andreas K. Hüttel
2021-09-27  6:49 Mike Frysinger
2021-09-27  6:49 Mike Frysinger
2021-09-27  6:49 Mike Frysinger
2021-09-27  6:49 Mike Frysinger
2021-09-27  6:49 Mike Frysinger
2021-09-27  6:49 Mike Frysinger
2021-09-27  5:46 Mike Frysinger
2021-08-06 21:09 Andreas K. Hüttel
2021-03-12 16:28 Mike Frysinger
2020-07-27 15:38 Andreas K. Hüttel
2020-07-26 17:37 Andreas K. Hüttel
2020-07-26 17:37 Andreas K. Hüttel
2020-07-15  1:56 Andreas K. Hüttel
2020-07-15  1:56 Andreas K. Hüttel
2020-05-12  4:23 Andreas K. Hüttel
2020-05-12  4:23 Andreas K. Hüttel
2020-05-12  4:23 Andreas K. Hüttel
2020-05-12  4:23 Andreas K. Hüttel
2020-05-12  4:23 Andreas K. Hüttel
2020-05-12  4:23 Andreas K. Hüttel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1595846150.550b6726e3fed643c3eb3ce19bd56887b5a3a840.dilfridge@gentoo \
    --to=dilfridge@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox