blob: d8931b281f0593844bb50b766853731505188f41 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001If a the number of hard links decreases or increases while creating
2the tar files used for an ipk package, tar fails with error code 1:
3
4| DEBUG: Executing python function do_package_ipk
5| tar: ./usr/src/debug/gperf/3.0.4-r0/gperf-3.0.4/src/main.cc: file changed as we read it
6NOTE: recipe gperf-3.0.4-r0: task do_package_write_ipk: Failed
7ERROR: Task 6539 (recipes-extended/gperf/gperf_3.0.4.bb, do_package_write_ipk) failed with exit code '1'
8
9
10We detect if the error code produced by tar is 1 and in this case ignore it.
11
12This a similar behavior to the one on dpkg:
13http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=40731942515ec8d80c727ad561174986d4f05818
14
15Upstream-Status: Inappropriate
16
17Signed-off-by: Alejandro Hernandez <alejandro.hernandez@linux.intel.com>
18
19
20Index: git/opkg-build
Brad Bishop316dfdd2018-06-25 12:45:53 -040021
Patrick Williamsc124f4f2015-09-15 14:41:29 -050022===================================================================
23--- git.orig/opkg-build
24+++ git/opkg-build
Brad Bishop316dfdd2018-06-25 12:45:53 -040025@@ -285,8 +285,21 @@ mkdir $tmp_dir
26 build_date="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" "+%Y-%m-%d %H:%M:%S")"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050027
28 echo $CONTROL > $tmp_dir/tarX
Brad Bishop316dfdd2018-06-25 12:45:53 -040029-( cd $pkg_dir && tar $ogargs $tsortargs --mtime="$build_date" -X $tmp_dir/tarX -c $tarformat . | $compressor $compressorargs > $tmp_dir/data.tar.$cext )
30-( cd $pkg_dir/$CONTROL && tar $ogargs $tsortargs --mtime="$build_date" -c $tarformat . | gzip $zipargs > $tmp_dir/control.tar.gz )
Patrick Williamsc124f4f2015-09-15 14:41:29 -050031+
32+
33+# Ignore error code 1, caused by modifying the number of hard links while creating the tar file
34+rc=0
Brad Bishop316dfdd2018-06-25 12:45:53 -040035+( cd $pkg_dir && tar $ogargs $tsortargs --mtime="$build_date" -X $tmp_dir/tarX -c $tarformat . | $compressor $compressorargs > $tmp_dir/data.tar.$cext ) || rc=$?
Patrick Williamsc124f4f2015-09-15 14:41:29 -050036+if [ $rc -ne 1 ] && [ $rc -ne 0 ]; then
37+ exit $rc
38+fi
39+
40+rc=0
Brad Bishop316dfdd2018-06-25 12:45:53 -040041+( cd $pkg_dir/$CONTROL && tar $ogargs $tsortargs --mtime="$build_date" -c $tarformat . | gzip $zipargs > $tmp_dir/control.tar.gz ) || rc=$?
Patrick Williamsc124f4f2015-09-15 14:41:29 -050042+if [ $rc -ne 1 ] && [ $rc -ne 0 ]; then
43+ exit $rc
44+fi
45+
46 rm $tmp_dir/tarX
47
48 echo "2.0" > $tmp_dir/debian-binary