Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH v2 1/2] package/cpio: add host version
@ 2019-07-16 17:35 Atharva Lele
  2019-07-16 17:35 ` [Buildroot] [PATCH v2 2/2] fs/cpio: make cpio rootfs reproducible Atharva Lele
  2019-07-17  6:54 ` [Buildroot] [PATCH v2 1/2] package/cpio: add host version Thomas Petazzoni
  0 siblings, 2 replies; 4+ messages in thread
From: Atharva Lele @ 2019-07-16 17:35 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

The latest cpio has a --reproducible option, which may come handy when
we try to, well, be reproducible...

Reported-by: Arnout Vandecappelle <arnout@mind.be>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
[Atharva: don't force --bindir, as noticed by Arnout]
Signed-off-by: Atharva Lele <itsatharva@gmail.com>
Acked-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>
Cc: Atharva Lele <itsatharva@gmail.com>
---
Changes v1 -> v2:
  - Add patch from Yann to my series
  - Fix [Atharva: ] comment
---
 package/cpio/cpio.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/cpio/cpio.mk b/package/cpio/cpio.mk
index 9a09279572..cc40838840 100644
--- a/package/cpio/cpio.mk
+++ b/package/cpio/cpio.mk
@@ -17,3 +17,4 @@ CPIO_DEPENDENCIES += argp-standalone
 endif
 
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2 2/2] fs/cpio: make cpio rootfs reproducible
  2019-07-16 17:35 [Buildroot] [PATCH v2 1/2] package/cpio: add host version Atharva Lele
@ 2019-07-16 17:35 ` Atharva Lele
  2019-07-17  6:56   ` Thomas Petazzoni
  2019-07-17  6:54 ` [Buildroot] [PATCH v2 1/2] package/cpio: add host version Thomas Petazzoni
  1 sibling, 1 reply; 4+ messages in thread
From: Atharva Lele @ 2019-07-16 17:35 UTC (permalink / raw)
  To: buildroot

Pass the recommended argument in the CPIO manual to make cpio archives
reproducible.

Reference: https://www.gnu.org/software/cpio/manual/cpio.html#Copy_002dpass-mode

Pre-patch diffoscope output: https://gitlab.com/snippets/1874745
Post-patch: https://gitlab.com/snippets/1874746

We can see that post-patch, the archive related differences are removed.
The differences are arising from utils/bin/getconf. This will have to
be investigated further. However, that is unrelated to cpio.

Signed-off-by: Atharva Lele <itsatharva@gmail.com>
Reviewed-by: Yann E. MORIN <yann.morin.1998@free.fr>
---
Changes v1 -> v2:
  - Added comment
  - Build host-cpio if we are reproducible, reason is --reproducible
    option does not exist prior to cpio 2.12. (suggested by Yann, Arnout)
  - Changed pure assignment to append-assignment
  - CPIO_OPTS -> ROOTFS_CPIO_OPTS to prevent clash with cpio package's options
    if added in future
---
 fs/cpio/cpio.mk | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/fs/cpio/cpio.mk b/fs/cpio/cpio.mk
index 1f0cafe62f..275064d9cb 100644
--- a/fs/cpio/cpio.mk
+++ b/fs/cpio/cpio.mk
@@ -29,8 +29,16 @@ endif # BR2_ROOTFS_DEVICE_CREATION_STATIC
 
 ROOTFS_CPIO_PRE_GEN_HOOKS += ROOTFS_CPIO_ADD_INIT
 
+# --repoducible option was not introduced until cpio v2.12. Some distros
+# like Ubuntu 16.04 or Debian oldstable which package v2.11. Hence build
+# host-cpio.
+ifeq ($(BR2_REPRODUCIBLE), y)
+ROOTFS_CPIO_DEPENDENCIES += host-cpio
+ROOTFS_CPIO_OPTS += --reproducible
+endif
+
 define ROOTFS_CPIO_CMD
-	cd $(TARGET_DIR) && find . | cpio --quiet -o -H newc > $@
+	cd $(TARGET_DIR) && find . | cpio $(ROOTFS_CPIO_OPTS) --quiet -o -H newc > $@
 endef
 
 ifeq ($(BR2_TARGET_ROOTFS_CPIO_UIMAGE),y)
-- 
2.22.0

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2 1/2] package/cpio: add host version
  2019-07-16 17:35 [Buildroot] [PATCH v2 1/2] package/cpio: add host version Atharva Lele
  2019-07-16 17:35 ` [Buildroot] [PATCH v2 2/2] fs/cpio: make cpio rootfs reproducible Atharva Lele
@ 2019-07-17  6:54 ` Thomas Petazzoni
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2019-07-17  6:54 UTC (permalink / raw)
  To: buildroot

On Tue, 16 Jul 2019 23:05:17 +0530
Atharva Lele <itsatharva@gmail.com> wrote:

> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> The latest cpio has a --reproducible option, which may come handy when
> we try to, well, be reproducible...
> 
> Reported-by: Arnout Vandecappelle <arnout@mind.be>
> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
> [Atharva: don't force --bindir, as noticed by Arnout]
> Signed-off-by: Atharva Lele <itsatharva@gmail.com>
> Acked-by: Yann E. MORIN <yann.morin.1998@free.fr>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> Cc: Atharva Lele <itsatharva@gmail.com>
> ---
> Changes v1 -> v2:
>   - Add patch from Yann to my series
>   - Fix [Atharva: ] comment
> ---
>  package/cpio/cpio.mk | 1 +
>  1 file changed, 1 insertion(+)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH v2 2/2] fs/cpio: make cpio rootfs reproducible
  2019-07-16 17:35 ` [Buildroot] [PATCH v2 2/2] fs/cpio: make cpio rootfs reproducible Atharva Lele
@ 2019-07-17  6:56   ` Thomas Petazzoni
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni @ 2019-07-17  6:56 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 16 Jul 2019 23:05:18 +0530
Atharva Lele <itsatharva@gmail.com> wrote:

> +# --repoducible option was not introduced until cpio v2.12. Some distros

The kind of double negation here "was not introduced until" looked a
bit complicated compared to just "--reproducible was introduced in cpio
v2.12". I've simplified the paragraph to:

+# --repoducible option was introduced in cpio v2.12, which may not be
+# available in some old distributions, so we build host-cpio

And of course now I notice that --repoducible has a typo, and should be
--reproducible. Oh well.

> +# like Ubuntu 16.04 or Debian oldstable which package v2.11. Hence build
> +# host-cpio.
> +ifeq ($(BR2_REPRODUCIBLE), y)

No space after comma. I fixed that up.

Applied with those changes. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-17  6:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-16 17:35 [Buildroot] [PATCH v2 1/2] package/cpio: add host version Atharva Lele
2019-07-16 17:35 ` [Buildroot] [PATCH v2 2/2] fs/cpio: make cpio rootfs reproducible Atharva Lele
2019-07-17  6:56   ` Thomas Petazzoni
2019-07-17  6:54 ` [Buildroot] [PATCH v2 1/2] package/cpio: add host version Thomas Petazzoni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox