summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuro Bystricky <juro.bystricky@intel.com>2018-02-05 09:40:54 -0800
committerAlejandro del Castillo <alejandro.delcastillo@ni.com>2018-02-07 15:14:29 -0600
commit20278a7f905cba4b1410ad58e59e3c48cca2df7d (patch)
treeab8fae139acc7004c68133567510efca29e33c48
parent682f8c5e35b8854a9bb858b8ee1714d27e0c00db (diff)
downloadopkg-utils-20278a7f905cba4b1410ad58e59e3c48cca2df7d.tar.gz
opkg-utils-20278a7f905cba4b1410ad58e59e3c48cca2df7d.tar.bz2
opkg-utils-20278a7f905cba4b1410ad58e59e3c48cca2df7d.zip
opkg-build: differentiate between compressorargs and zipargs0.3.6
control.tar.gz is always compressed with gzip. If data.tar is compressed by a compressor other than gzip, control.tar.gz may end up compressed with timestamp in the compressed image header. This would result in packages that are not binary reproducible. [YOCTO #11242] Signed-off-by: Juro Bystricky <juro.bystricky@intel.com> Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
-rwxr-xr-xopkg-build18
1 files changed, 9 insertions, 9 deletions
diff --git a/opkg-build b/opkg-build
index 7bfdd99..318f308 100755
--- a/opkg-build
+++ b/opkg-build
@@ -149,7 +149,8 @@ outer=ar
noclean=0
opkext=0
compressor=gzip
-compressorargs="-9n"
+zipargs="-9n"
+compressorargs=""
# Determine if tar supports the --format argument by checking the help output.
#
@@ -223,13 +224,12 @@ done
cext=$(compressor_ext $compressor)
+# pgzip requires -T to avoid timestamps on the gzip archive
+if gzip --help 2>&1 | grep -- "-T" > /dev/null; then
+ zipargs="-9nT"
+fi
if [ $compressor = "gzip" ] ; then
- # pgzip requires -T to avoid timestamps on the gzip archive
- if gzip --help 2>&1 | grep -- "-T" > /dev/null; then
- compressorargs="-9nT"
- fi
-else
- compressorargs=""
+ compressorargs=$zipargs
fi
shift $(($OPTIND - 1))
@@ -281,7 +281,7 @@ build_date="$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y-%m-%d)"
echo $CONTROL > $tmp_dir/tarX
( cd $pkg_dir && tar $ogargs --sort=name --mtime=$build_date -X $tmp_dir/tarX -c $tarformat . | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
-( cd $pkg_dir/$CONTROL && tar $ogargs --sort=name --mtime=$build_date -c $tarformat . | gzip $compressorargs > $tmp_dir/control.tar.gz )
+( cd $pkg_dir/$CONTROL && tar $ogargs --sort=name --mtime=$build_date -c $tarformat . | gzip $zipargs > $tmp_dir/control.tar.gz )
rm $tmp_dir/tarX
echo "2.0" > $tmp_dir/debian-binary
@@ -296,7 +296,7 @@ rm -f $pkg_file
if [ "$outer" = "ar" ] ; then
( cd $tmp_dir && ar -crf $pkg_file ./debian-binary ./control.tar.gz ./data.tar.$cext )
else
- ( cd $tmp_dir && tar -c --sort=name --mtime=$build_date $tarformat ./debian-binary ./control.tar.gz ./data.tar.$cext | gzip $compressorargs > $pkg_file )
+ ( cd $tmp_dir && tar -c --sort=name --mtime=$build_date $tarformat ./debian-binary ./control.tar.gz ./data.tar.$cext | gzip $zipargs > $pkg_file )
fi
rm $tmp_dir/debian-binary $tmp_dir/data.tar.$cext $tmp_dir/control.tar.gz