[libvirt] [PATCH] po/Makefile.am: use SOURCE_DATE_EPOCH to set POT creation date

Pavel Hrdina posted 1 patch 4 years, 3 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/97ffe24d13b9ef16323beb892569b95bc5746dfd.1578407853.git.phrdina@redhat.com
po/Makefile.am | 9 +++++++++
1 file changed, 9 insertions(+)
[libvirt] [PATCH] po/Makefile.am: use SOURCE_DATE_EPOCH to set POT creation date
Posted by Pavel Hrdina 4 years, 3 months ago
When building RPMs for libvirt the PO files are part of libvirt-libs
package.  Now that we generate libvirt.pot during build time the POT
creation date is also generated at that time.

The issue here is that when building libvirt-libs for x86_64 and i686
the generated libvirt.pot file will have different POT creation date
which affects installed PO files as well which leads to conflict when
installing both x86_64 and i686 packages.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 po/Makefile.am | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/po/Makefile.am b/po/Makefile.am
index 443d8a4dc1..277dd89d7d 100644
--- a/po/Makefile.am
+++ b/po/Makefile.am
@@ -45,10 +45,19 @@ XGETTEXT_ARGS = \
 	--msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
 	$(NULL)
 
+POT_CREATION_DATE = $(shell \
+	if test -n "$$SOURCE_DATE_EPOCH"; \
+	then \
+		date --date="@$$SOURCE_DATE_EPOCH" +"%F %R%z"; \
+	else \
+		date +'%F %R%z'; \
+	fi)
+
 SED_PO_FIXUP_ARGS = \
        -e "s|text/plain; charset=CHARSET|text/plain; charset=UTF-8|g" \
        -e "s|SOME DESCRIPTIVE TITLE|Libvirt package strings|g" \
        -e "s|Copyright (C) YEAR|Copyright (C) $$(date +'%Y')|" \
+       -e "s|POT-Creation-Date:[^\]*|POT-Creation-Date: $(POT_CREATION_DATE)|" \
        $(NULL)
 
 update-po: $(POFILES)
-- 
2.24.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] po/Makefile.am: use SOURCE_DATE_EPOCH to set POT creation date
Posted by Daniel Henrique Barboza 4 years, 3 months ago
I believe this patch is making my 'make syntax-check' unhappy:

build-aux/syntax-check.mk: skipping test sc_flake8: flake8 not installed
make[1]: Entering directory '/home/danielhb/kvm-project/libvirt/build/src'
make[1]: Nothing to be done for 'generated-sources'.
make[1]: Leaving directory '/home/danielhb/kvm-project/libvirt/build/src'
../po/Makefile.am:60:       -e "s|POT-Creation-Date:[^\]*|POT-Creation-Date: $(POT_CREATION_DATE)|" \
build-aux/syntax-check.mk: Wrap long lines in Makefiles
make: *** [../build-aux/syntax-check.mk:827: sc_prohibit_long_lines] Error 1
make: *** Waiting for unfinished jobs....


Am I doing something wrong? At first glance it appears that one of
the lines added is a tad too long.


Thanks,


DHB


On 1/7/20 11:37 AM, Pavel Hrdina wrote:
> When building RPMs for libvirt the PO files are part of libvirt-libs
> package.  Now that we generate libvirt.pot during build time the POT
> creation date is also generated at that time.
> 
> The issue here is that when building libvirt-libs for x86_64 and i686
> the generated libvirt.pot file will have different POT creation date
> which affects installed PO files as well which leads to conflict when
> installing both x86_64 and i686 packages.
> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>   po/Makefile.am | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/po/Makefile.am b/po/Makefile.am
> index 443d8a4dc1..277dd89d7d 100644
> --- a/po/Makefile.am
> +++ b/po/Makefile.am
> @@ -45,10 +45,19 @@ XGETTEXT_ARGS = \
>   	--msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
>   	$(NULL)
>   
> +POT_CREATION_DATE = $(shell \
> +	if test -n "$$SOURCE_DATE_EPOCH"; \
> +	then \
> +		date --date="@$$SOURCE_DATE_EPOCH" +"%F %R%z"; \
> +	else \
> +		date +'%F %R%z'; \
> +	fi)
> +
>   SED_PO_FIXUP_ARGS = \
>          -e "s|text/plain; charset=CHARSET|text/plain; charset=UTF-8|g" \
>          -e "s|SOME DESCRIPTIVE TITLE|Libvirt package strings|g" \
>          -e "s|Copyright (C) YEAR|Copyright (C) $$(date +'%Y')|" \
> +       -e "s|POT-Creation-Date:[^\]*|POT-Creation-Date: $(POT_CREATION_DATE)|" \
>          $(NULL)
>   
>   update-po: $(POFILES)
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH] po/Makefile.am: use SOURCE_DATE_EPOCH to set POT creation date
Posted by Daniel Henrique Barboza 4 years, 3 months ago

On 1/7/20 2:09 PM, Daniel Henrique Barboza wrote:
> I believe this patch is making my 'make syntax-check' unhappy:
> 
> build-aux/syntax-check.mk: skipping test sc_flake8: flake8 not installed
> make[1]: Entering directory '/home/danielhb/kvm-project/libvirt/build/src'
> make[1]: Nothing to be done for 'generated-sources'.
> make[1]: Leaving directory '/home/danielhb/kvm-project/libvirt/build/src'
> ../po/Makefile.am:60:       -e "s|POT-Creation-Date:[^\]*|POT-Creation-Date: $(POT_CREATION_DATE)|" \
> build-aux/syntax-check.mk: Wrap long lines in Makefiles
> make: *** [../build-aux/syntax-check.mk:827: sc_prohibit_long_lines] Error 1
> make: *** Waiting for unfinished jobs....
> 
> 
> Am I doing something wrong? At first glance it appears that one of
> the lines added is a tad too long.


Nevermind, Michal fixed it with a patch of his own ("po: Fix indentation of
SED_PO_FIXUP_ARGS variable")


Thanks,


DHB


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] po/Makefile.am: use SOURCE_DATE_EPOCH to set POT creation date
Posted by Daniel P. Berrangé 4 years, 3 months ago
On Tue, Jan 07, 2020 at 03:37:44PM +0100, Pavel Hrdina wrote:
> When building RPMs for libvirt the PO files are part of libvirt-libs
> package.  Now that we generate libvirt.pot during build time the POT
> creation date is also generated at that time.
> 
> The issue here is that when building libvirt-libs for x86_64 and i686
> the generated libvirt.pot file will have different POT creation date
> which affects installed PO files as well which leads to conflict when
> installing both x86_64 and i686 packages.

Bad for distros doing reproducable builds too

> 
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  po/Makefile.am | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


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 :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list