Re: [OpenWrt-Devel] [PATCH 2/2] Prevent more gzip timestamps

2015-07-14 Thread Florian Fainelli
On 14/07/15 15:05, Reiner Herrmann wrote:
> On Sun, Jul 12, 2015 at 12:06:01PM -0700, Florian Fainelli wrote:
>> 2015-07-12 9:41 GMT-07:00 Reiner Herrmann :
>>> To improve reproducibility, prevent the inclusion of timestamps
>>> in the gzip header.
>>
>> This looks fine to me, this also unveils a lot of repetition in how we
>> invoke gzip and its parameters, would you mind factoring this in a
>> variable such that we control how gzip options are set globally?
>> Eventually someone will want to be able to turn back on timestamps and
>> original names in how gzip generates compressed files, and we might as
>> well have a single location to fix this.
> 
> The commands that are currently available in variables are named
> just in uppercase (FIND, TAR, etc.).
> But gzip also interprets the variable GZIP to parse additional
> options, so naming the variable for the command also GZIP will
> probably cause problems.

Ah good point. How about GZIP_CMD then?

> Or would it be better to just globally export GZIP with the
> default parameters (which would then differ from the currents
> semantics of having the command inside the variable)?

We could do that, I am just wondering if this would make it a bit more
difficult to debug in case we forgot to patch a given Makefile or that
we do reset the environment/do not inherit it.
--
Florian
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/2] Prevent more gzip timestamps

2015-07-14 Thread Reiner Herrmann
On Sun, Jul 12, 2015 at 12:06:01PM -0700, Florian Fainelli wrote:
> 2015-07-12 9:41 GMT-07:00 Reiner Herrmann :
> > To improve reproducibility, prevent the inclusion of timestamps
> > in the gzip header.
> 
> This looks fine to me, this also unveils a lot of repetition in how we
> invoke gzip and its parameters, would you mind factoring this in a
> variable such that we control how gzip options are set globally?
> Eventually someone will want to be able to turn back on timestamps and
> original names in how gzip generates compressed files, and we might as
> well have a single location to fix this.

The commands that are currently available in variables are named
just in uppercase (FIND, TAR, etc.).
But gzip also interprets the variable GZIP to parse additional
options, so naming the variable for the command also GZIP will
probably cause problems.
Or would it be better to just globally export GZIP with the
default parameters (which would then differ from the currents
semantics of having the command inside the variable)?



signature.asc
Description: Digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/2] Prevent more gzip timestamps

2015-07-14 Thread John Crispin


On 12/07/2015 21:06, Florian Fainelli wrote:
> 2015-07-12 9:41 GMT-07:00 Reiner Herrmann :
>> To improve reproducibility, prevent the inclusion of timestamps
>> in the gzip header.
> 
> This looks fine to me, this also unveils a lot of repetition in how we
> invoke gzip and its parameters, would you mind factoring this in a
> variable such that we control how gzip options are set globally?
> Eventually someone will want to be able to turn back on timestamps and
> original names in how gzip generates compressed files, and we might as
> well have a single location to fix this.
> 
> Let's just hope that nobody relies on the original file names (does
> not look like it).
> 


lets do the gzip variable refactoring globally in a different patch
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH 2/2] Prevent more gzip timestamps

2015-07-12 Thread Florian Fainelli
2015-07-12 9:41 GMT-07:00 Reiner Herrmann :
> To improve reproducibility, prevent the inclusion of timestamps
> in the gzip header.

This looks fine to me, this also unveils a lot of repetition in how we
invoke gzip and its parameters, would you mind factoring this in a
variable such that we control how gzip options are set globally?
Eventually someone will want to be able to turn back on timestamps and
original names in how gzip generates compressed files, and we might as
well have a single location to fix this.

Let's just hope that nobody relies on the original file names (does
not look like it).

>
> Signed-off-by: Reiner Herrmann 
> ---
>  docs/adding.tex| 2 +-
>  include/image.mk   | 2 +-
>  package/Makefile   | 2 +-
>  target/imagebuilder/files/Makefile | 2 +-
>  target/linux/adm5120/image/router_le.mk| 2 +-
>  target/linux/adm8668/image/Makefile| 2 +-
>  target/linux/ar71xx/image/Makefile | 6 +++---
>  target/linux/ath25/image/Makefile  | 2 +-
>  target/linux/brcm63xx/image/Makefile   | 2 +-
>  target/linux/generic/files/crypto/ocf/Makefile | 2 +-
>  target/linux/ipq806x/image/Makefile| 2 +-
>  target/linux/malta/image/Makefile  | 2 +-
>  target/linux/x86/image/Makefile| 4 ++--
>  target/linux/xburst/image/Makefile | 2 +-
>  14 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/docs/adding.tex b/docs/adding.tex
> index 97547ac..7b80c0d 100644
> --- a/docs/adding.tex
> +++ b/docs/adding.tex
> @@ -556,7 +556,7 @@ include $(INCLUDE_DIR)/image.mk
>
>  define Image/BuildKernel
>  cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-vmlinux.elf
> -gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
> +gzip -9n -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
>  $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
>  dd if=$(KDIR)/vmlinux.bin.l7 
> of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.lzma bs=65536 conv=sync
>  dd if=$(KDIR)/vmlinux.bin.gz 
> of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.gz bs=65536 conv=sync
> diff --git a/include/image.mk b/include/image.mk
> index 814e7dc..6767e76 100644
> --- a/include/image.mk
> +++ b/include/image.mk
> @@ -224,7 +224,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),)
>  endif
>
>  define Image/mkfs/cpiogz
> -   ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9 
> >$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
> +   ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9n 
> >$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
>  endef
>
>  define Image/mkfs/targz
> diff --git a/package/Makefile b/package/Makefile
> index 3ef34b1..cc691b5 100644
> --- a/package/Makefile
> +++ b/package/Makefile
> @@ -149,7 +149,7 @@ $(curdir)/index: FORCE
> mkdir -p $(PACKAGE_DIR)/$$d; \
> cd $(PACKAGE_DIR)/$$d || continue; \
> $(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \
> -   gzip -9c Packages > Packages.gz; \
> +   gzip -9nc Packages > Packages.gz; \
> ); done
>  ifdef CONFIG_SIGNED_PACKAGES
> @echo Signing package index...
> diff --git a/target/imagebuilder/files/Makefile 
> b/target/imagebuilder/files/Makefile
> index e28660f..8f25c4a 100644
> --- a/target/imagebuilder/files/Makefile
> +++ b/target/imagebuilder/files/Makefile
> @@ -121,7 +121,7 @@ package_index: FORCE
> @echo Building package index...
> @mkdir -p $(TMP_DIR) $(TARGET_DIR)/tmp
> (cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \
> -   gzip -9c Packages > Packages.gz \
> +   gzip -9nc Packages > Packages.gz \
> ) >/dev/null 2>/dev/null
> $(OPKG) update || true
>
> diff --git a/target/linux/adm5120/image/router_le.mk 
> b/target/linux/adm5120/image/router_le.mk
> index 6df6dcd..1e3d7f7 100644
> --- a/target/linux/adm5120/image/router_le.mk
> +++ b/target/linux/adm5120/image/router_le.mk
> @@ -72,7 +72,7 @@ define Image/Build/Cellvision
> $(call Image/Build/Loader,$(2),bin,0x8050,0x6D8,y,$(3))
> mkdir -p $(BIN_DIR)/tmp
> cp $(KDIR)/loader-$(2).bin $(BIN_DIR)/tmp/vmlinux.bin
> -   gzip -9 $(BIN_DIR)/tmp/vmlinux.bin
> +   gzip -9n $(BIN_DIR)/tmp/vmlinux.bin
> dd if=$(BIN_DIR)/tmp/vmlinux.bin.gz of=$(call 
> imgname,$(1),$(2))-xmodem.bin bs=64k conv=sync
> rm -rf $(BIN_DIR)/tmp
> $(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
> diff --git a/target/linux/adm8668/image/Makefile 
> b/target/linux/adm8668/image/Makefile
> index 9e25224..597b8f7 100644
> --- a/target/linux/adm8668/image/Makefile
> +++ b/target/linux/adm8668/image/Makefile
> @@ -16,7 +16,7 @@ endef
>
>
>  define CompressGzip
> -   gzip -9 -c $(1) > $(2)
> +   gzip -9n -c $(1) > $(2)
>  endef
>
>  define MkImage
> diff -

[OpenWrt-Devel] [PATCH 2/2] Prevent more gzip timestamps

2015-07-12 Thread Reiner Herrmann
To improve reproducibility, prevent the inclusion of timestamps
in the gzip header.

Signed-off-by: Reiner Herrmann 
---
 docs/adding.tex| 2 +-
 include/image.mk   | 2 +-
 package/Makefile   | 2 +-
 target/imagebuilder/files/Makefile | 2 +-
 target/linux/adm5120/image/router_le.mk| 2 +-
 target/linux/adm8668/image/Makefile| 2 +-
 target/linux/ar71xx/image/Makefile | 6 +++---
 target/linux/ath25/image/Makefile  | 2 +-
 target/linux/brcm63xx/image/Makefile   | 2 +-
 target/linux/generic/files/crypto/ocf/Makefile | 2 +-
 target/linux/ipq806x/image/Makefile| 2 +-
 target/linux/malta/image/Makefile  | 2 +-
 target/linux/x86/image/Makefile| 4 ++--
 target/linux/xburst/image/Makefile | 2 +-
 14 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/docs/adding.tex b/docs/adding.tex
index 97547ac..7b80c0d 100644
--- a/docs/adding.tex
+++ b/docs/adding.tex
@@ -556,7 +556,7 @@ include $(INCLUDE_DIR)/image.mk
 
 define Image/BuildKernel
 cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(BOARD)-vmlinux.elf
-gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
+gzip -9n -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
 $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
 dd if=$(KDIR)/vmlinux.bin.l7 
of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.lzma bs=65536 conv=sync
 dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(BOARD)-vmlinux.gz 
bs=65536 conv=sync
diff --git a/include/image.mk b/include/image.mk
index 814e7dc..6767e76 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -224,7 +224,7 @@ ifneq ($(CONFIG_TARGET_ROOTFS_UBIFS),)
 endif
 
 define Image/mkfs/cpiogz
-   ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9 
>$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
+   ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9n 
>$(BIN_DIR)/$(IMG_PREFIX)-rootfs.cpio.gz )
 endef
 
 define Image/mkfs/targz
diff --git a/package/Makefile b/package/Makefile
index 3ef34b1..cc691b5 100644
--- a/package/Makefile
+++ b/package/Makefile
@@ -149,7 +149,7 @@ $(curdir)/index: FORCE
mkdir -p $(PACKAGE_DIR)/$$d; \
cd $(PACKAGE_DIR)/$$d || continue; \
$(SCRIPT_DIR)/ipkg-make-index.sh . 2>&1 > Packages && \
-   gzip -9c Packages > Packages.gz; \
+   gzip -9nc Packages > Packages.gz; \
); done
 ifdef CONFIG_SIGNED_PACKAGES
@echo Signing package index...
diff --git a/target/imagebuilder/files/Makefile 
b/target/imagebuilder/files/Makefile
index e28660f..8f25c4a 100644
--- a/target/imagebuilder/files/Makefile
+++ b/target/imagebuilder/files/Makefile
@@ -121,7 +121,7 @@ package_index: FORCE
@echo Building package index...
@mkdir -p $(TMP_DIR) $(TARGET_DIR)/tmp
(cd $(PACKAGE_DIR); $(SCRIPT_DIR)/ipkg-make-index.sh . > Packages && \
-   gzip -9c Packages > Packages.gz \
+   gzip -9nc Packages > Packages.gz \
) >/dev/null 2>/dev/null
$(OPKG) update || true
 
diff --git a/target/linux/adm5120/image/router_le.mk 
b/target/linux/adm5120/image/router_le.mk
index 6df6dcd..1e3d7f7 100644
--- a/target/linux/adm5120/image/router_le.mk
+++ b/target/linux/adm5120/image/router_le.mk
@@ -72,7 +72,7 @@ define Image/Build/Cellvision
$(call Image/Build/Loader,$(2),bin,0x8050,0x6D8,y,$(3))
mkdir -p $(BIN_DIR)/tmp
cp $(KDIR)/loader-$(2).bin $(BIN_DIR)/tmp/vmlinux.bin
-   gzip -9 $(BIN_DIR)/tmp/vmlinux.bin
+   gzip -9n $(BIN_DIR)/tmp/vmlinux.bin
dd if=$(BIN_DIR)/tmp/vmlinux.bin.gz of=$(call 
imgname,$(1),$(2))-xmodem.bin bs=64k conv=sync
rm -rf $(BIN_DIR)/tmp
$(call Image/Build/TRXNoloader,$(call imgname,$(1),$(2)).trx,$(1))
diff --git a/target/linux/adm8668/image/Makefile 
b/target/linux/adm8668/image/Makefile
index 9e25224..597b8f7 100644
--- a/target/linux/adm8668/image/Makefile
+++ b/target/linux/adm8668/image/Makefile
@@ -16,7 +16,7 @@ endef
 
 
 define CompressGzip
-   gzip -9 -c $(1) > $(2)
+   gzip -9n -c $(1) > $(2)
 endef
 
 define MkImage
diff --git a/target/linux/ar71xx/image/Makefile 
b/target/linux/ar71xx/image/Makefile
index 0351310..c8cf301 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -985,7 +985,7 @@ endef
 define PatchKernelGzip
cp $(KDIR)/vmlinux$(3) $(KDIR_TMP)/vmlinux$(3)-$(1)
$(STAGING_DIR_HOST)/bin/patch-cmdline $(KDIR_TMP)/vmlinux$(3)-$(1) 
"$(strip $(2))"
-   gzip -9 -c $(KDIR_TMP)/vmlinux$(3)-$(1) > 
$(KDIR_TMP)/vmlinux$(3)-$(1).bin.gz
+   gzip -9n -c $(KDIR_TMP)/vmlinux$(3)-$(1) > 
$(KDIR_TMP)/vmlinux$(3)-$(1).bin.gz
 endef
 
 ifneq ($(SUBTARGET),mikrotik)
@@ -2224,10 +2224,10 @@ define Image/Build/Initramfs
 endef
 
 define Image/Prepare
-   gzip -9 -c $(KDIR)/