From 095ddffaf73046849623590d944fb3cd99318282 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 18 Jun 2019 01:45:11 -0400 Subject: ob-buildopk: Fix non-deterministic mtimes in gzip headers --- diff --git a/NEWS b/NEWS index 790944e..b6aeaa9 100644 --- a/NEWS +++ b/NEWS @@ -10,7 +10,7 @@ Utilities: * opkbuild now sets the standardized [1] "SOURCE_DATE_EPOCH" environment variable to assist in making builds reproducible. * ob-buildopk now strives to build reproducible opk archives. - Specifically, archive member modification times are set to a + Specifically, archive and member modification times are set to a package's changelog date, owners and groups are set to 0, and file ordering is now deterministic. Setting modification times of symbolic links requires a "touch" utility that accepts the non- diff --git a/src/ob-buildopk.sh b/src/ob-buildopk.sh index 57b3688..cea74ab 100644 --- a/src/ob-buildopk.sh +++ b/src/ob-buildopk.sh @@ -49,14 +49,19 @@ build_opk() find "${binary}.control" "${binary}.data" | xargs chown -h 0:0 (cd -- "${binary}.control" && find '.' | LC_ALL=C sort | \ - ${TAR} -czf '../control.tar.gz' --no-recursion -T -) + ${TAR} -cf '../control.tar' --no-recursion -T -) (cd -- "${binary}.data" && find '.' | LC_ALL=C sort | \ - ${TAR} -czf '../data.tar.gz' --no-recursion -T -) - ${TOUCH} -d "${date}" 'control.tar.gz' 'data.tar.gz' + ${TAR} -cf '../data.tar' --no-recursion -T -) + ${TOUCH} -d "${date}" 'control.tar' 'data.tar' + ${GZIP} 'control.tar' 'data.tar' - ${TAR} -czf "../../${binary}_${version}_${arch}_${plat}.opk" \ + ${TAR} -cf "../../${binary}_${version}_${arch}_${plat}.tar" \ 'debian-binary' 'control.tar.gz' 'data.tar.gz' rm -Rf 'control.tar.gz' 'data.tar.gz' + ${TOUCH} -d "${date}" "../../${binary}_${version}_${arch}_${plat}.tar" + ${GZIP} "../../${binary}_${version}_${arch}_${plat}.tar" + mv "../../${binary}_${version}_${arch}_${plat}.tar.gz" \ + "../../${binary}_${version}_${arch}_${plat}.opk" return 0 } -- cgit v0.9.1