[PATCH 1/2] localedata: allow reproducible & parallel install of locale-archive

Maximilian Bosch maximilian@mbosch.me
Thu Oct 9 19:05:16 GMT 2025


On Mon Oct 6, 2025 at 11:26 PM CEST, DJ Delorie wrote:
> Maximilian Bosch <maximilian@mbosch.me> writes:
>> +define install-all-locales
>> +  $(LOCALEDEF) $$flags --add-to-archive `find $(inst_complocaledir) -maxdepth 1 -mindepth 1 -type d | sort`
>> +endef
>
> We should be able to generate the list of files using the existing
> variables, esp the $(SUPPORTED-LOCALES) variable, rather than run `find`.

That's what I tried first, but SUPPORTED-LOCALES has a slightly
different format. Not the `language_territory.codeset@modifier` you pass
to `setlocale(3)`, but a different one where I'm not sure what this is
about, e.g. `ka_GE.UTF-8/UTF-8`.

Transforming this into the locale format we have in the end is what all
the sed-based surgery in `build-one-locale` is for.

In the end I figured that it's way simpler to use `find` here rather
than trying to split parts of `build-one-locale` out. Especially since
you get multiple variables out of this locale specification in
`build-one-locale` which is not the case for `install-all-locales`.

>
> $$flags is not set in the scope of this macro.
>
>>  # Create and install the locale-archive file.
>>  install-locale-archive: $(INSTALL-SUPPORTED-LOCALE-ARCHIVE)
>> +	$(install-all-locales)
>
> ^^ $$flags is not set here
>
>>  # Create and install the locales individually (no archive).
>>  install-locale-files: $(INSTALL-SUPPORTED-LOCALE-FILES)
>>  
>> @@ -565,6 +570,7 @@ define build-one-locale
>>  	$(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
>>  		     -i locales/$$input -f charmaps/$$charset \
>>  		     $(addprefix --prefix=,$(install_root)) $$locale \
>> +		     --no-archive \
>>  	&& echo ' done';
>>  endef
>
> This macro is called twice:
>
> 	$(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
> 		@flags=""; \
> 		$(build-one-locale)
>
> 	$(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
> 		@flags="--no-archive --no-hard-links"; \
> 		$(build-one-locale)
>
> Since flags IS set when invoking this macro, and the two instances
> differ by the --no-archive option, I think setting it unconditionally in
> the macro definition is wrong.  You should instead add --no-archive to
> the @flags="" line.  However, we now have little differences between
> those two rules.  I wonder if they could be combined, but I don't know
> how much the hard link difference matters.

Good catch!

Will modify as suggested and send a follow-up once we come to a
conclusion above :) 


More information about the Libc-alpha mailing list