dpkg: Do not even try creating hardlinks
authorFredrik Fornwall <fredrik@fornwall.net>
Wed, 16 Mar 2016 14:53:16 +0000 (10:53 -0400)
committerFredrik Fornwall <fredrik@fornwall.net>
Wed, 16 Mar 2016 14:53:16 +0000 (10:53 -0400)
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.

packages/dpkg/build.sh
packages/dpkg/lib-dpkg-atomic-file.c.patch

index af5b7a5..a03d245 100755 (executable)
@@ -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"
index 79f0156..a4cf91a 100644 (file)
@@ -1,16 +1,19 @@
 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))
-+                      ohshite(_("error creating new backup file '%s'"), name_old);
++#endif
++              ohshite(_("error creating new backup file '%s'"), name_old);
 +      }
  
        free(name_old);