[libvirt] [PATCH v3 06/20] po: generate files into build directory

Daniel P. Berrangé berrange at redhat.com
Fri Nov 8 10:04:13 UTC 2019


On Thu, Oct 24, 2019 at 03:05:24PM +0200, Pavel Hrdina wrote:
> Historically we did not support VPATH builds and everything was
> generated into source directory.  The introduction of VPATH builds
> did not changed the way how our translation files are handled.
> 
> This patch changes the rules to generate everything into build
> directory and stops distributing generated files in order to have
> properly separated VPATH builds.
> 
> Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
> ---
> 
> Notes:
>     Changes in v2:
>         - keep the zanata binary name, this will be fixed by separate patch
>     
>     Chnages in v3:
>         - update --transdir and --srcdir options as there are used by
>           python-zanata-client
>     
>     Changes in v2:
>         - keep the zanata binary name, this will be fixed by separate patch
> 
>  .gitignore     |  4 ----
>  po/Makefile.am | 35 +++++++++++++++++++++--------------
>  2 files changed, 21 insertions(+), 18 deletions(-)
> 
> diff --git a/.gitignore b/.gitignore
> index bd64eb5b1a..4c4807019c 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -39,12 +39,8 @@ Makefile.in
>  .git-module-status
>  
>  # libvirt related ignores
> -!/po/*.mini.po
>  /build/
>  /ci/scratch/
> -/po/*gmo
> -/po/*po
> -/po/*pot
>  /src/access/org.libvirt.api.policy
>  /src/access/viraccessapicheck.c
>  /src/access/viraccessapicheck.h
> diff --git a/po/Makefile.am b/po/Makefile.am
> index b0e2c15d44..7011890255 100644
> --- a/po/Makefile.am
> +++ b/po/Makefile.am
> @@ -16,17 +16,16 @@ LANGS := \
>  
>  
>  POTFILE_DEPS := $(shell $(SED) 's,^,$(top_srcdir)/,' $(srcdir)/POTFILES)
> -POTFILE := $(srcdir)/$(DOMAIN).pot
> -POFILES := $(LANGS:%=$(srcdir)/%.po)
> -GMOFILES := $(LANGS:%=$(srcdir)/%.gmo)
> +POTFILE := $(DOMAIN).pot
> +POMINIFILES := $(LANGS:%=%.mini.po)
> +POFILES := $(LANGS:%=%.po)
> +GMOFILES := $(LANGS:%=%.gmo)
>  
> -MAINTAINERCLEANFILES = $(POTFILE) $(POFILES) $(GMOFILES)
> +CLEANFILES = $(POTFILE) $(POFILES) $(GMOFILES)
>  
>  EXTRA_DIST = \
>  	POTFILES \
> -	$(POTFILE) \
> -	$(POFILES) \
> -	$(GMOFILES)
> +	$(POMINIFILES)
>  
>  if HAVE_GNU_GETTEXT_TOOLS
>  
> @@ -63,10 +62,18 @@ update-mini-po: $(POTFILE)
>  	done
>  
>  push-pot: $(POTFILE)
> -	zanata push --push-type=source
> +	zanata push \
> +		--project-config $(srcdir)/zanata.xml \
> +		--push-type=source \
> +		--transdir $(builddir) \
> +		--srcdir $(srcdir)
>  
>  pull-po: $(POTFILE)
> -	zanata pull --create-skeletons
> +	zanata pull \
> +		--project-config $(srcdir)/zanata.xml \
> +		--create-skeletons \
> +		--transdir $(builddir) \
> +		--srcdir $(srcdir)
>  	$(MAKE) update-mini-po
>  	$(MAKE) update-gmo
>  
> @@ -76,19 +83,17 @@ $(POTFILE): POTFILES $(POTFILE_DEPS)
>  	$(SED) $(SED_PO_FIXUP_ARGS) < $@-t > $@
>  	rm -f $@-t
>  
> -$(srcdir)/%.po: $(srcdir)/%.mini.po $(POTFILE)
> +%.po: %.mini.po $(POTFILE)
>  	$(MSGMERGE) --no-fuzzy-matching $< $(POTFILE) | \
>  	  $(SED) $(SED_PO_FIXUP_ARGS) > $@
>  
> -$(srcdir)/%.gmo: $(srcdir)/%.po
> +%.gmo: %.po
>  	rm -f $@ $@-t
>  	$(MSGFMT) -c -o $@-t $<
>  	mv $@-t $@
>  
>  .PRECIOUS: $(POTFILE) $(POFILES)
>  
> -endif HAVE_GNU_GETTEXT_TOOLS
> -
>  if ENABLE_NLS
>  
>  # Cannot use 'localedir' since this conflicts with autoconf.
> @@ -99,7 +104,7 @@ install-data-hook: $(GMOFILES)
>  	for lang in $(LANGS); do \
>  	  d=$(DESTDIR)$(langinstdir)/$$lang/LC_MESSAGES; \
>  	  mkdir -p $$d; \
> -	  install -m 0644 $(srcdir)/$$lang.gmo $$d/$(DOMAIN).mo; \
> +	  install -m 0644 $$lang.gmo $$d/$(DOMAIN).mo; \
>  	done
>  
>  uninstall-hook:
> @@ -109,3 +114,5 @@ uninstall-hook:
>  	done
>  
>  endif ENABLE_NLS
> +
> +endif HAVE_GNU_GETTEXT_TOOLS

Moving this HAVE_GNU_GETTEXT_TOOLS conditional means that on OS that
lack the GNU gettext impl, we are no longer able to 'make install'
the translation files, despite having them prebuilt & bundled in the
tarball.

IIRC, this affects any non-Linux host.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list