Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 473484 - sys-libs/glibc: locale-gen Prefix support
Summary: sys-libs/glibc: locale-gen Prefix support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: prefix-glibc
  Show dependency tree
 
Reported: 2013-06-16 12:21 UTC by Benda Xu
Modified: 2017-01-06 14:41 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
locale-gen_prefix.patch (locale-gen_prefix.patch,1.96 KB, patch)
2013-06-16 12:25 UTC, Benda Xu
Details | Diff
locale-gen_prefix.patch (locale-gen_prefix.patch,1.96 KB, patch)
2013-06-16 12:32 UTC, Benda Xu
Details | Diff
locale-gen_prefix.patch (locale-gen_prefix.patch,1.96 KB, patch)
2013-06-16 12:32 UTC, Benda Xu
Details | Diff
locale-gen_prefix.patch (locale-gen_prefix.patch,2.22 KB, patch)
2013-06-16 12:34 UTC, Benda Xu
Details | Diff
locale-gen_prefix.patch (locale-gen_prefix.patch,2.24 KB, patch)
2013-06-18 17:09 UTC, Benda Xu
Details | Diff
locale-gen_prefix.patch (locale-gen_prefix.patch,2.29 KB, patch)
2013-06-18 17:17 UTC, Benda Xu
Details | Diff
locale-gen_prefix.patch (locale-gen_prefix.patch,2.35 KB, patch)
2013-06-20 03:48 UTC, Benda Xu
Details | Diff
locale-gen_prefix.patch (locale-gen_prefix.patch,2.64 KB, patch)
2013-06-29 04:02 UTC, Benda Xu
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benda Xu gentoo-dev 2013-06-16 12:21:14 UTC
I am try to get sys-libs/glibc to support Prefix. Here is the first patch of the locale-gen script. Please review.

Reproducible: Always
Comment 1 Benda Xu gentoo-dev 2013-06-16 12:25:39 UTC
Created attachment 351104 [details, diff]
locale-gen_prefix.patch
Comment 2 Benda Xu gentoo-dev 2013-06-16 12:32:14 UTC
Created attachment 351106 [details, diff]
locale-gen_prefix.patch
Comment 3 Benda Xu gentoo-dev 2013-06-16 12:32:48 UTC
Created attachment 351108 [details, diff]
locale-gen_prefix.patch
Comment 4 Benda Xu gentoo-dev 2013-06-16 12:34:48 UTC
Created attachment 351110 [details, diff]
locale-gen_prefix.patch
Comment 5 SpanKY gentoo-dev 2013-06-17 02:31:00 UTC
Comment on attachment 351110 [details, diff]
locale-gen_prefix.patch

>-source /etc/init.d/functions.sh || {
>+source "${EPREFIX}"/etc/init.d/functions.sh || {

don't you need to encode EPREFIX in the shell script ?  or is it always set in the environment (even runtime) ?

>+# For log pathes, the line may get wrapped into two, in which case space (' ') is replaced

guessing you mean "long paths"

>+# by newline (\n).
>+LOCALEDIR=$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -e'/locale path/{N;s|.*:[ \n]\(.*\):/.*|\1|;p}')

don't escape things to get eregexp syntax.  use the -r flag with sed.
Comment 6 Fabian Groffen gentoo-dev 2013-06-17 08:06:41 UTC
(In reply to SpanKY from comment #5)
> Comment on attachment 351110 [details, diff] [details, diff]
> locale-gen_prefix.patch
> 
> >-source /etc/init.d/functions.sh || {
> >+source "${EPREFIX}"/etc/init.d/functions.sh || {
> 
> don't you need to encode EPREFIX in the shell script ?  or is it always set
> in the environment (even runtime) ?

Yes, you cannot rely on it being in the environment
Comment 7 Benda Xu gentoo-dev 2013-06-18 17:09:56 UTC
Created attachment 351322 [details, diff]
locale-gen_prefix.patch

Thanks for reviewing. Updated the patch according to the comments.
Comment 8 Benda Xu gentoo-dev 2013-06-18 17:17:25 UTC
Created attachment 351324 [details, diff]
locale-gen_prefix.patch

oops, forgot other EPREFIX occurences.

And inherit prefix / eprefixify is omitted this time because glibc in my overlay is behind gx86 tree.
Comment 9 SpanKY gentoo-dev 2013-06-20 02:13:41 UTC
Comment on attachment 351324 [details, diff]
locale-gen_prefix.patch

>+source "@GENTOO_PORTAGE_EPREFIX@"/etc/init.d/functions.sh || {

do this above:
EPREFIX="@GENTOO_PORTAGE_EPREFIX@"
if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then
  EPREFIX=""
fi

then you can use $EPREFIX like normal

>+	einfo "Using locale.gen from EROOT ${EROOT}etc/"

hmm, i'd prefer to keep saying "ROOT" in the output
Comment 10 Benda Xu gentoo-dev 2013-06-20 03:48:57 UTC
Created attachment 351434 [details, diff]
locale-gen_prefix.patch

updated accordingly. Thanks.
Comment 11 SpanKY gentoo-dev 2013-06-28 05:27:53 UTC
the code also does this:
  if [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
     [[ -e ${ROOT}etc/locales.build ]]
  then

shouldn't that be $EROOT ?
Comment 12 Benda Xu gentoo-dev 2013-06-28 12:13:05 UTC
(In reply to SpanKY from comment #11)
> the code also does this:
>   if [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \
>      [[ -e ${ROOT}etc/locales.build ]]
>   then
> 
> shouldn't that be $EROOT ?

From the following lines,

        ewarn "You should upgrade your /etc/locales.build to /etc/locale.gen"
        ewarn "and then remove /etc/locales.build when you're done.\n"

it is used for transition from some older version of locale-gen. Being introducting locale-gen afresh, we don't need to consider it in Prefix, do we?
Comment 13 SpanKY gentoo-dev 2013-06-28 18:30:47 UTC
(In reply to Benda Xu from comment #12)

more accurately, it's from when the glibc ebuild itself would read locales.build and we didn't have `locale-gen` at all yet.  you are right that prefix probably didn't exist (it's been deprecated for at least 4 years ... i'd have to go through the history to try and figure out when we started doing this new stuff).

however, let's say the file did exist on prefix systems.  using $EROOT is still the correct answer isn't it ?  i don't want the script using $EROOT in most places but then using $ROOT in a few random places.  it's pointlessly confusing and will lead to $ROOT getting copy & pasted in places where it should be $EROOT.
Comment 14 Benda Xu gentoo-dev 2013-06-29 04:02:08 UTC
Created attachment 352206 [details, diff]
locale-gen_prefix.patch

Good point, Mike. Updated the patch accordingly.
Comment 15 SpanKY gentoo-dev 2013-07-01 00:32:43 UTC
(In reply to Benda Xu from comment #14)

queued in the tree:
http://sources.gentoo.org/gentoo/src/patchsets/glibc/extra/locale/locale-gen?r1=1.32&r2=1.33

whenever a new patchset is generated, this will get included automatically
Comment 16 Benda Xu gentoo-dev 2013-07-01 06:03:35 UTC
Thanks, Mike.
Comment 17 Benda Xu gentoo-dev 2017-01-06 14:41:00 UTC
Now that the locale-gen is patched, we need to call eprefixify to the script.

Committed without changing keywords or revisions:

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=debdaa5625ac306670fbcf6fa10126cac8e4dab3