diff mbox

[09/12] reproducibility/fs/cpio: generate archive with host-cpio

Message ID 1465918277-30675-9-git-send-email-gilles.chanteperdrix@xenomai.org
State Changes Requested
Headers show

Commit Message

Gilles Chanteperdrix June 14, 2016, 3:31 p.m. UTC
Using the --reproducible option to generate a reproducible archive.

Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
---
 fs/cpio/cpio.mk | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Yann E. MORIN July 2, 2016, 10:18 a.m. UTC | #1
Gilles, All,

On 2016-06-14 17:31 +0200, Gilles Chanteperdrix spake thusly:
> Using the --reproducible option to generate a reproducible archive.
> 
> Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
> ---
>  fs/cpio/cpio.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
> index e82167e..4da6648 100644
> --- a/fs/cpio/cpio.mk
> +++ b/fs/cpio/cpio.mk
> @@ -27,9 +27,17 @@ endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
>  
>  ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
>  
> +ifneq ($(BR2_REPRODUCIBLE),y)
>  define ROOTFS_CPIO_CMD
>  	cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
>  endef
> +else
> +ROOTFS_CPIO_DEPENDENCIES += host-cpio
> +
> +define ROOTFS_CPIO_CMD
> +	cd $(TARGET_DIR) && find . | $(CPIO_REPRODUCIBLE) --quiet -o -H newc > $@
> +endef
> +endif

Rather than duplicate the commands, why not something like:

    ifeq ($(BR2_REPDUCIBLE),y)
    ROOTFS_CPIO_CPIO = $(CPIO)
    else
    ROOTFS_CPIO_CPIO = $(CPIO_REPRODUCIBLE)
    endif

    define ROOTFS_CPIO_CMD
        cd $(TARGET_DIR) && find . | $(ROOTFS_CPIO_CPIO) --quiet -o -H newc > $@
    endef

Regards,
Yann E. MORIN.

>  $(BINARIES_DIR)/rootfs.cpio.uboot: $(BINARIES_DIR)/rootfs.cpio host-uboot-tools
>  	$(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk \
> -- 
> 2.8.2
> 
> _______________________________________________
> buildroot mailing list
> buildroot@busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
Arnout Vandecappelle July 2, 2016, 11:11 a.m. UTC | #2
On 14-06-16 17:31, Gilles Chanteperdrix wrote:
> Using the --reproducible option to generate a reproducible archive.
> 
> Signed-off-by: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
> ---
>  fs/cpio/cpio.mk | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
> index e82167e..4da6648 100644
> --- a/fs/cpio/cpio.mk
> +++ b/fs/cpio/cpio.mk
> @@ -27,9 +27,17 @@ endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
>  
>  ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
>  
> +ifneq ($(BR2_REPRODUCIBLE),y)
>  define ROOTFS_CPIO_CMD
>  	cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
>  endef
> +else
> +ROOTFS_CPIO_DEPENDENCIES += host-cpio

 Instead of unconditionally building host-cpio, it would be better to check if
the installed cpio supports --reproducible. Cfr. what we do for tar, in
support/dependencies/check-host-tar.{sh,mk}.


 Regards,
 Arnout

> +
> +define ROOTFS_CPIO_CMD
> +	cd $(TARGET_DIR) && find . | $(CPIO_REPRODUCIBLE) --quiet -o -H newc > $@
> +endef
> +endif
>  
>  $(BINARIES_DIR)/rootfs.cpio.uboot: $(BINARIES_DIR)/rootfs.cpio host-uboot-tools
>  	$(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk \
>
diff mbox

Patch

diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
index e82167e..4da6648 100644
--- a/fs/cpio/cpio.mk
+++ b/fs/cpio/cpio.mk
@@ -27,9 +27,17 @@  endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
 
 ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
 
+ifneq ($(BR2_REPRODUCIBLE),y)
 define ROOTFS_CPIO_CMD
 	cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
 endef
+else
+ROOTFS_CPIO_DEPENDENCIES += host-cpio
+
+define ROOTFS_CPIO_CMD
+	cd $(TARGET_DIR) && find . | $(CPIO_REPRODUCIBLE) --quiet -o -H newc > $@
+endef
+endif
 
 $(BINARIES_DIR)/rootfs.cpio.uboot: $(BINARIES_DIR)/rootfs.cpio host-uboot-tools
 	$(MKIMAGE) -A $(MKIMAGE_ARCH) -T ramdisk \