summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro del Castillo <alejandro.delcastillo@ni.com>2018-11-14 14:55:36 -0600
committerAlejandro del Castillo <alejandro.delcastillo@ni.com>2018-11-16 16:16:55 -0600
commite911b8248324a198c39b508ab9e1459017ab1f22 (patch)
treea7d0c0e9f3fcce9decb5d159c76010d9155189fa
parent49d32419abec4142995f3ed6f840137c8a72f3b3 (diff)
downloadopkg-utils-e911b8248324a198c39b508ab9e1459017ab1f22.tar.gz
opkg-utils-e911b8248324a198c39b508ab9e1459017ab1f22.tar.bz2
opkg-utils-e911b8248324a198c39b508ab9e1459017ab1f22.zip
opkg-build: simplify date calculation
Avoid an integer to string conversion (and back) by directly supplying the Unix time as an integer to -mtime. Fixes bugzilla# 12580 Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
-rwxr-xr-xopkg-build8
1 files changed, 4 insertions, 4 deletions
diff --git a/opkg-build b/opkg-build
index 0d3ca23..69e3f40 100755
--- a/opkg-build
+++ b/opkg-build
@@ -291,11 +291,11 @@ fi
tmp_dir=$dest_dir/IPKG_BUILD.$$
mkdir $tmp_dir
-build_date="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" "+%Y-%m-%d %H:%M:%S")"
+build_date="${SOURCE_DATE_EPOCH:-$(date +%s)}"
echo $CONTROL > $tmp_dir/tarX
-( cd $pkg_dir && tar $ogargs $tsortargs --mtime="$build_date" -X $tmp_dir/tarX -c $tarformat . | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
-( cd $pkg_dir/$CONTROL && tar $ogargs $tsortargs --mtime="$build_date" -c $tarformat . | gzip $zipargs > $tmp_dir/control.tar.gz )
+( cd $pkg_dir && tar $ogargs $tsortargs --mtime=@$build_date -X $tmp_dir/tarX -c $tarformat . | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
+( cd $pkg_dir/$CONTROL && tar $ogargs $tsortargs --mtime=@$build_date -c $tarformat . | gzip $zipargs > $tmp_dir/control.tar.gz )
rm $tmp_dir/tarX
echo "2.0" > $tmp_dir/debian-binary
@@ -310,7 +310,7 @@ rm -f $pkg_file
if [ "$outer" = "ar" ] ; then
( cd $tmp_dir && ar -crfD $pkg_file ./debian-binary ./control.tar.gz ./data.tar.$cext )
else
- ( cd $tmp_dir && tar -c $tsortargs --mtime="$build_date" $tarformat ./debian-binary ./control.tar.gz ./data.tar.$cext | gzip $zipargs > $pkg_file )
+ ( cd $tmp_dir && tar -c $tsortargs --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