1 |
vapier 13/07/01 00:32:15 |
2 |
|
3 |
Modified: locale-gen |
4 |
Log: |
5 |
add prefix support #473484 by Benda Xu |
6 |
|
7 |
Revision Changes Path |
8 |
1.33 src/patchsets/glibc/extra/locale/locale-gen |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/extra/locale/locale-gen?rev=1.33&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/extra/locale/locale-gen?rev=1.33&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/extra/locale/locale-gen?r1=1.32&r2=1.33 |
13 |
|
14 |
Index: locale-gen |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/extra/locale/locale-gen,v |
17 |
retrieving revision 1.32 |
18 |
retrieving revision 1.33 |
19 |
diff -u -r1.32 -r1.33 |
20 |
--- locale-gen 13 Dec 2011 21:15:03 -0000 1.32 |
21 |
+++ locale-gen 1 Jul 2013 00:32:15 -0000 1.33 |
22 |
@@ -8,7 +8,13 @@ |
23 |
umask 0022 |
24 |
|
25 |
argv0=${0##*/} |
26 |
-source /etc/init.d/functions.sh || { |
27 |
+ |
28 |
+EPREFIX="@GENTOO_PORTAGE_EPREFIX@" |
29 |
+if [[ ${EPREFIX} == "@"GENTOO_PORTAGE_EPREFIX"@" ]] ; then |
30 |
+ EPREFIX="" |
31 |
+fi |
32 |
+ |
33 |
+source "${EPREFIX}"/etc/init.d/functions.sh || { |
34 |
echo "${argv0}: Could not source /etc/init.d/functions.sh!" 1>&2 |
35 |
exit 1 |
36 |
} |
37 |
@@ -45,7 +51,7 @@ |
38 |
} |
39 |
show_version() { |
40 |
local b="(" a=")" |
41 |
- local cvsver="$Revision: 1.32 $b $Date: 2011/12/13 21:15:03 $a" |
42 |
+ local cvsver="$Revision: 1.33 $b $Date: 2013/07/01 00:32:15 $a" |
43 |
echo "locale-gen-${cvsver//: }" |
44 |
exit 0 |
45 |
} |
46 |
@@ -92,18 +98,19 @@ |
47 |
[[ -n ${GENERATE} ]] && UPDATE="true" && KEEP="true" |
48 |
|
49 |
: ${ROOT:=/} |
50 |
-[[ ${ROOT} != */ ]] && ROOT="${ROOT}/" |
51 |
+ROOT="${ROOT%/}/" |
52 |
if [[ -n ${DESTDIR} ]] && [[ ${ROOT} != "/" ]] ; then |
53 |
eerror "DESTDIR and ROOT are mutually exclusive options" |
54 |
exit 1 |
55 |
fi |
56 |
-if [[ ${ROOT} != "/" ]] ; then |
57 |
- einfo "Using locale.gen from ROOT ${ROOT}etc/" |
58 |
+: ${EROOT:="${ROOT%/}${EPREFIX}/"} |
59 |
+if [[ ${EROOT} != "/" ]] ; then |
60 |
+ einfo "Using locale.gen from ROOT ${EROOT}etc/" |
61 |
fi |
62 |
if [[ -n ${DESTDIR} ]] ; then |
63 |
einfo "Building locales in DESTDIR '${DESTDIR}'" |
64 |
else |
65 |
- DESTDIR=${ROOT} |
66 |
+ DESTDIR=${EROOT} |
67 |
fi |
68 |
|
69 |
# XXX: should fix this ... |
70 |
@@ -112,7 +119,7 @@ |
71 |
exit 0 |
72 |
fi |
73 |
|
74 |
-: ${CONFIG:=${ROOT}etc/locale.gen} |
75 |
+: ${CONFIG:=${EROOT}etc/locale.gen} |
76 |
LOCALES=${DESTDIR}usr/share/i18n/locales |
77 |
CHARMAPS=${DESTDIR}usr/share/i18n/charmaps |
78 |
SUPPORTED=${DESTDIR}usr/share/i18n/SUPPORTED |
79 |
@@ -150,7 +157,10 @@ |
80 |
|
81 |
# Extract the location of the locale dir on the fly as `localedef --help` has: |
82 |
# locale path : /usr/lib64/locale:/usr/share/i18n |
83 |
-LOCALEDIR=${DESTDIR}$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -e '/locale path/{s|.* : ||;s|:.*||;p}') |
84 |
+# For long paths, the line may get wrapped into two, in which case space (' ') is replaced |
85 |
+# by newline (\n). |
86 |
+LOCALEDIR=$(LC_ALL="C" "${DESTDIR}"usr/bin/localedef --help | sed -n -r '/locale path/{N;s|.*:[ \n](.*):/.*|\1|;p}') |
87 |
+LOCALEDIR="${DESTDIR}${LOCALEDIR#${EPREFIX}}" |
88 |
if [[ $? -ne 0 ]] || [[ -z ${LOCALEDIR} ]] || [[ ${LOCALEDIR} != ${DESTDIR}/usr/lib*/locale ]] ; then |
89 |
eerror "Unable to parse the output of your localedef utility." 1>&2 |
90 |
eerror "File a bug about this issue and include the output of 'localedef --help'." 1>&2 |
91 |
@@ -160,7 +170,7 @@ |
92 |
|
93 |
|
94 |
if [[ ${QUIET} -eq 0 ]] && [[ -z ${JUST_LIST} ]] && \ |
95 |
- [[ -e ${ROOT}etc/locales.build ]] |
96 |
+ [[ -e ${EROOT}etc/locales.build ]] |
97 |
then |
98 |
ewarn "You should upgrade your /etc/locales.build to /etc/locale.gen" |
99 |
ewarn "and then remove /etc/locales.build when you're done.\n" |
100 |
@@ -280,7 +290,7 @@ |
101 |
-i "${input}" \ |
102 |
-f "${charmap}" \ |
103 |
-A "${ALIAS}" \ |
104 |
- --prefix "${DESTDIR}" \ |
105 |
+ --prefix "${DESTDIR%${EPREFIX}/}/" \ |
106 |
"${locale}" 2>&1 |
107 |
ret=$? |
108 |
[[ -n ${output} ]] && eend ${ret} |