Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v3 1/2] purge-locales: further refactoring after removing man paths
@ 2015-07-13 23:45 Arnout Vandecappelle
  2015-07-13 23:45 ` [Buildroot] [PATCH v3 2/2] purge-locales: fix handling of X11 locale.dir Arnout Vandecappelle
  2015-07-14  0:12 ` [Buildroot] [PATCH v3 1/2] purge-locales: further refactoring after removing man paths Thomas Petazzoni
  0 siblings, 2 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2015-07-13 23:45 UTC (permalink / raw)
  To: buildroot

Since the man paths have been removed, it is no longer necessary to
grep them out and the loop can be simplified.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
v3: Partial rebase, since v1 was already merged.
v2: remove the grep -v man as well, which allows us to use $dir/*
    instead of the funky ls construct.
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 02a1032..f764ae5 100644
--- a/Makefile
+++ b/Makefile
@@ -546,9 +546,9 @@ define PURGE_LOCALES
 
 	for dir in $(wildcard $(addprefix $(TARGET_DIR),/usr/share/locale /usr/share/X11/locale /usr/lib/locale)); \
 	do \
-		for lang in $$(cd $$dir; ls .|grep -v man); \
+		for langdir in $$dir/*; \
 		do \
-			grep -qx $$lang $(LOCALE_WHITELIST) || rm -rf $$dir/$$lang; \
+			grep -qx $${langdir##*/} $(LOCALE_WHITELIST) || rm -rf $$langdir; \
 		done; \
 	done
 endef
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v3 2/2] purge-locales: fix handling of X11 locale.dir
  2015-07-13 23:45 [Buildroot] [PATCH v3 1/2] purge-locales: further refactoring after removing man paths Arnout Vandecappelle
@ 2015-07-13 23:45 ` Arnout Vandecappelle
  2015-07-14  0:12 ` [Buildroot] [PATCH v3 1/2] purge-locales: further refactoring after removing man paths Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2015-07-13 23:45 UTC (permalink / raw)
  To: buildroot

From: Valentine Barshak <gvaxon@gmail.com>

The /usr/share/X11/locale/locale.dir file is needed by libX11.
Removing it breaks locale support in X11. However, make removes
not only directories but also all files, which are not listed
in the BR2_ENABLE_LOCALE_WHITELIST.

This re-creates locale.dir database file where needed.

Signed-off-by: Valentine Barshak <gvaxon@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
[Arnout: use a separate loop, and add some explanatory comments]
---
v3: No change
v2: [Arnout]: use a separate loop, add explanatory comments
---
 Makefile | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/Makefile b/Makefile
index f764ae5..8eb8c6d 100644
--- a/Makefile
+++ b/Makefile
@@ -540,6 +540,11 @@ ifeq ($(BR2_ENABLE_LOCALE_PURGE),y)
 LOCALE_WHITELIST = $(BUILD_DIR)/locales.nopurge
 LOCALE_NOPURGE = $(call qstrip,$(BR2_ENABLE_LOCALE_WHITELIST))
 
+# This piece of junk does the following:
+# First collect the whitelist in a file.
+# Then go over all the locale dirs and for each subdir, check if it exists
+# in the whitelist file. If it doesn't, kill it.
+# Finally, specifically for X11, regenerate locale.dir from the whitelist.
 define PURGE_LOCALES
 	rm -f $(LOCALE_WHITELIST)
 	for i in $(LOCALE_NOPURGE) locale-archive; do echo $$i >> $(LOCALE_WHITELIST); done
@@ -551,6 +556,16 @@ define PURGE_LOCALES
 			grep -qx $${langdir##*/} $(LOCALE_WHITELIST) || rm -rf $$langdir; \
 		done; \
 	done
+	if [ -d $(TARGET_DIR)/usr/share/X11/locale ]; \
+	then \
+		for lang in $(LOCALE_NOPURGE); \
+		do \
+			if [ -f $(TARGET_DIR)/usr/share/X11/locale/$$lang/XLC_LOCALE ]; \
+			then \
+				echo "$$lang/XLC_LOCALE: $$lang"; \
+			fi \
+		done > $(TARGET_DIR)/usr/share/X11/locale/locale.dir; \
+	fi
 endef
 TARGET_FINALIZE_HOOKS += PURGE_LOCALES
 endif
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH v3 1/2] purge-locales: further refactoring after removing man paths
  2015-07-13 23:45 [Buildroot] [PATCH v3 1/2] purge-locales: further refactoring after removing man paths Arnout Vandecappelle
  2015-07-13 23:45 ` [Buildroot] [PATCH v3 2/2] purge-locales: fix handling of X11 locale.dir Arnout Vandecappelle
@ 2015-07-14  0:12 ` Thomas Petazzoni
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni @ 2015-07-14  0:12 UTC (permalink / raw)
  To: buildroot

Dear Arnout Vandecappelle (Essensium/Mind),

On Tue, 14 Jul 2015 01:45:27 +0200, Arnout Vandecappelle
(Essensium/Mind) wrote:
> Since the man paths have been removed, it is no longer necessary to
> grep them out and the loop can be simplified.
> 
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
> v3: Partial rebase, since v1 was already merged.
> v2: remove the grep -v man as well, which allows us to use $dir/*
>     instead of the funky ls construct.
> ---
>  Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Both applied, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-07-14  0:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-13 23:45 [Buildroot] [PATCH v3 1/2] purge-locales: further refactoring after removing man paths Arnout Vandecappelle
2015-07-13 23:45 ` [Buildroot] [PATCH v3 2/2] purge-locales: fix handling of X11 locale.dir Arnout Vandecappelle
2015-07-14  0:12 ` [Buildroot] [PATCH v3 1/2] purge-locales: further refactoring after removing man paths Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox