Browse Source

dpkg: Do not even try creating hardlinks

We now that it will fail on Android (from 6.0 on), and this only
causes a lot of warning output about denied system call in logcat.
android-5
Fredrik Fornwall 9 years ago
parent
commit
257b3744d1
  1. 2
      packages/dpkg/build.sh
  2. 9
      packages/dpkg/lib-dpkg-atomic-file.c.patch

2
packages/dpkg/build.sh

@ -1,7 +1,7 @@
TERMUX_PKG_HOMEPAGE=https://packages.debian.org/dpkg
TERMUX_PKG_DESCRIPTION="Debian package management system"
TERMUX_PKG_VERSION=1.18.4
TERMUX_PKG_BUILD_REVISION=1
TERMUX_PKG_BUILD_REVISION=2
TERMUX_PKG_SRCURL=http://ftp.debian.org/debian/pool/main/d/dpkg/dpkg_${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-dselect --disable-shared --disable-start-stop-daemon --disable-largefile --disable-update-alternatives --host=${TERMUX_ARCH}-linux --without-selinux dpkg_cv_c99_snprintf=yes ac_cv_lib_selinux_setexecfilecon=no HAVE_SETEXECFILECON_FALSE=#"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" --without-bz2"

9
packages/dpkg/lib-dpkg-atomic-file.c.patch

@ -1,15 +1,18 @@
diff -u -r ../dpkg-1.18.2/lib/dpkg/atomic-file.c ./lib/dpkg/atomic-file.c
--- ../dpkg-1.18.2/lib/dpkg/atomic-file.c 2015-07-12 22:38:47.000000000 -0400
+++ ./lib/dpkg/atomic-file.c 2015-08-25 18:06:51.689715379 -0400
@@ -90,8 +90,11 @@
@@ -90,8 +90,14 @@
if (unlink(name_old) && errno != ENOENT)
ohshite(_("error removing old backup file '%s'"), name_old);
- if (link(file->name, name_old) && errno != ENOENT)
- ohshite(_("error creating new backup file '%s'"), name_old);
+#ifdef __ANDROID__
+ /* Termux: Use rename(2) since Android does not support hardlinks. */
+ if (rename(file->name, name_old) && errno != ENOENT) {
+#else
+ if (link(file->name, name_old) && errno != ENOENT) {
+ /* Termux modification: Try with rename(2) for systems not supporting hardlinks. */
+ if (rename(file->name, name_old))
+#endif
+ ohshite(_("error creating new backup file '%s'"), name_old);
+ }

Loading…
Cancel
Save