Skip to contentSkip to conversation

package/cpio: add host version

PATCH New Atharva Lele 2 participants 4 messages Jul 16, 2019 – Jul 17, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 package/cpio: add host version

From: "Yann E. MORIN" <[email protected]>

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

[Atharva: don't force --bindir, as noticed by Arnout]
Cc Arnout Vandecappelle <[email protected]>
Cc Atharva Lele <[email protected]>

---
Changes v1 -> v2:
- Add patch from Yann to my series
- Fix [Atharva: ] comment

---
 package/cpio/cpio.mk | 1 +
 1 file changed, 1 insertion(+)
package/cpio/cpio.mk +1 -0
index 9a09279572..cc40838840 100644
@@ -17,3 +17,4 @@ CPIO_DEPENDENCIES += argp-standalone
 endif
 
 $(eval $(autotools-package))
+$(eval $(host-autotools-package))
Signature · 1 line
2.22.0
#1 lore raw

PATCH v2 2/2 fs/cpio: make cpio rootfs reproducible

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.

---
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(-)
fs/cpio/cpio.mk +9 -1
index 1f0cafe62f..275064d9cb 100644
@@ -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)
Signature · 1 line
2.22.0
#2 lore raw

PATCH v2 2/2 fs/cpio: make cpio rootfs reproducible

Hello,

Quoted 1 line · On Tue, 16 Jul 2019 23:05:18 +0530 Atharva Lele <[email protected]> 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.

fs/cpio/cpio.mk endif # BR2_ROOTFS_DEVICE_CREATION_STATIC · line 35

Quoted 3 lines
fs/cpio/cpio.mk +3 -0
+# 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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#3 lore raw

PATCH v2 1/2 package/cpio: add host version

In reply to Atharva Lele
Quoted 12 lines · On Tue, 16 Jul 2019 23:05:17 +0530 Atharva Lele <[email protected]> wrote:

From: "Yann E. MORIN" <[email protected]>

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

[Atharva: don't force --bindir, as noticed by Arnout]
Cc Arnout Vandecappelle <[email protected]>
Cc Atharva Lele <[email protected]>
Quoted 7 lines

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

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com