summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS9
-rw-r--r--src/ob-buildopk.sh18
2 files changed, 25 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 27d0f14..364d868 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,15 @@ opkbuild version 4.1.2+dev
Released: ????-??-??
+Utilities:
+
+ * ob-buildopk now checks for a bug in BusyBox versions before 1.22.0
+ that causes tar to add in reverse order entries listed on standard
+ input with the -T option. This bug causes packages to fail to
+ install and uninstall cleanly due to data files being stored after
+ the directories that contain them. This bug was exposed by changes
+ in opkbuild version 4.1.0.
+
opkbuild version 4.1.2
----------------------
diff --git a/src/ob-buildopk.sh b/src/ob-buildopk.sh
index dc630d1..1e661cc 100644
--- a/src/ob-buildopk.sh
+++ b/src/ob-buildopk.sh
@@ -29,6 +29,7 @@ build_opk()
shift 5
local find_not_link=
local touch_noderef=
+ local sort_r=
ob_info "$(ob_get_msg 'build_opk')" \
"${binary}_${version}_${arch}_${plat}.opk"
@@ -41,6 +42,19 @@ build_opk()
else
find_not_link='! -type l' touch_noderef=''
fi
+
+ # Detect whether BusyBox tar inserts files listed with -T in reverse
+ # order.
+ mkdir -p '.opkbuild'
+ touch '.opkbuild/a' '.opkbuild/b'
+ if [ x"$(printf '.opkbuild/a\n.opkbuild/b\n' | ${TAR} -c -T - | \
+ ${TAR} -t | head -n 1)" = x'b' ]; then
+ sort_r='-r'
+ else
+ sort_r=''
+ fi
+ rm -f '.opkbuild/a' '.opkbuild/b'
+
find "${binary}.control" "${binary}.data" ${find_not_link} | xargs \
${TOUCH} ${touch_noderef} -t "${date}"
@@ -48,9 +62,9 @@ build_opk()
# about to tar.
find "${binary}.control" "${binary}.data" | xargs chown -h 0:0
- (cd -- "${binary}.control" && find '.' | LC_ALL=C sort | \
+ (cd -- "${binary}.control" && find '.' | LC_ALL=C sort ${sort_r} | \
${TAR} -cf '../control.tar' --no-recursion -T -)
- (cd -- "${binary}.data" && find '.' | LC_ALL=C sort | \
+ (cd -- "${binary}.data" && find '.' | LC_ALL=C sort ${sort_r} | \
${TAR} -cf '../data.tar' --no-recursion -T -)
${TOUCH} -t "${date}" 'control.tar' 'data.tar'
${GZIP} 'control.tar' 'data.tar'