aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-05-25 18:10:21 +0300
committerTimo Teräs <timo.teras@iki.fi>2017-05-25 18:10:21 +0300
commita4ec74c3e8c1734a64736d2fcab63d83ac51fd82 (patch)
treee751980818c64445487e732ede11f223d4fbf1a0 /main/apk-tools
parent5ac7cb533fb7a61e277c501c979923d4f605e717 (diff)
downloadaports-a4ec74c3e8c1734a64736d2fcab63d83ac51fd82.tar.bz2
aports-a4ec74c3e8c1734a64736d2fcab63d83ac51fd82.tar.xz
main/apk-tools: fix cache remounting r/w regression
Diffstat (limited to 'main/apk-tools')
-rw-r--r--main/apk-tools/0001-commit-include-limits.h-for-PATH_MAX.patch25
-rw-r--r--main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch35
-rw-r--r--main/apk-tools/0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch33
-rw-r--r--main/apk-tools/0001-print-print-warnings-and-errors-to-stderr.patch74
-rw-r--r--main/apk-tools/0001-solver-don-t-clobber-package-swaps-in-cases-where-an.patch65
-rw-r--r--main/apk-tools/0002-db-catch-asprintf-failure.patch26
-rw-r--r--main/apk-tools/APKBUILD6
7 files changed, 39 insertions, 225 deletions
diff --git a/main/apk-tools/0001-commit-include-limits.h-for-PATH_MAX.patch b/main/apk-tools/0001-commit-include-limits.h-for-PATH_MAX.patch
deleted file mode 100644
index a59f63a87a..0000000000
--- a/main/apk-tools/0001-commit-include-limits.h-for-PATH_MAX.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 4dd8d8103a652b451deaa778cd3d96d6e400e776 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Mon, 6 Mar 2017 17:38:32 +0100
-Subject: [PATCH] commit: include limits.h for PATH_MAX
-
-this fixes build on ppc64le
----
- src/commit.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/commit.c b/src/commit.c
-index 80b2c13..278af5e 100644
---- a/src/commit.c
-+++ b/src/commit.c
-@@ -9,6 +9,7 @@
- * by the Free Software Foundation. See http://www.gnu.org/ for details.
- */
-
-+#include <limits.h>
- #include <stdint.h>
- #include <unistd.h>
- #include "apk_defines.h"
---
-2.11.1
-
diff --git a/main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch b/main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch
new file mode 100644
index 0000000000..7d5e478b55
--- /dev/null
+++ b/main/apk-tools/0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch
@@ -0,0 +1,35 @@
+From ede5165833b94051ecbc35e9ac4a359f54cc0116 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Thu, 25 May 2017 18:04:41 +0300
+Subject: [PATCH] db: fix regression preventing remounting apk cache r/w
+
+Introduced in commit c0f2d88f342f4d185f3991f98b79ab61a03896e4.
+fstatfs is needed to inspect the mount flags.
+---
+ src/database.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/database.c b/src/database.c
+index 8230764..67cc4f5 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -1603,7 +1603,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
+
+ /* figure out where to have the cache */
+ fd = openat(db->root_fd, dbopts->cache_dir, O_RDONLY | O_CLOEXEC);
+- if (fd >= 0) {
++ if (fd >= 0 && fstatfs(fd, &stfs) == 0) {
+ db->cache_dir = dbopts->cache_dir;
+ db->cache_fd = fd;
+ db->cache_remount_flags = map_statfs_flags(stfs.f_flags);
+@@ -1622,6 +1622,7 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
+ }
+ }
+ } else {
++ if (fd >= 0) close(fd);
+ db->cache_dir = apk_static_cache_dir;
+ db->cache_fd = openat(db->root_fd, db->cache_dir, O_RDONLY | O_CLOEXEC);
+ }
+--
+2.13.0
+
diff --git a/main/apk-tools/0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch b/main/apk-tools/0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch
deleted file mode 100644
index cbb220e979..0000000000
--- a/main/apk-tools/0001-db-prevent-umount-proc-when-it-was-mounted-by-someon.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 4b9f6d430f04e4470cf5d49ee72a43ebaed0fb62 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Mon, 13 Mar 2017 12:54:39 +0000
-Subject: [PATCH 1/2] db: prevent umount /proc when it was mounted by someone
- else
-
-This fixes regression introduced by commit 72b878e655
----
- src/database.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/src/database.c b/src/database.c
-index e3ced7d..356907e 100644
---- a/src/database.c
-+++ b/src/database.c
-@@ -1581,8 +1581,13 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
- if (errno == ENOENT) mkdir(db->root_proc_dir, 0555);
- stfs.f_type = 0;
- }
-- if (stfs.f_type != PROC_SUPER_MAGIC)
-+ if (stfs.f_type != PROC_SUPER_MAGIC) {
- mount("proc", db->root_proc_dir, "proc", 0, 0);
-+ } else {
-+ /* was already mounted. prevent umount on close */
-+ free(db->root_proc_dir);
-+ db->root_proc_dir = NULL;
-+ }
- }
-
- blob = APK_BLOB_STR("+etc\n" "@etc/init.d\n" "!etc/apk\n");
---
-2.11.1
-
diff --git a/main/apk-tools/0001-print-print-warnings-and-errors-to-stderr.patch b/main/apk-tools/0001-print-print-warnings-and-errors-to-stderr.patch
deleted file mode 100644
index 10fa015948..0000000000
--- a/main/apk-tools/0001-print-print-warnings-and-errors-to-stderr.patch
+++ /dev/null
@@ -1,74 +0,0 @@
-From a0b5e33ad2cd3e106cf52b1c7100617ed5a784a7 Mon Sep 17 00:00:00 2001
-From: Shiz <hi@shiz.me>
-Date: Mon, 10 Apr 2017 08:47:22 +0200
-Subject: [PATCH] print: print warnings and errors to stderr
-
----
- src/apk_print.h | 5 +++--
- src/print.c | 25 ++++++++++++++++++-------
- 2 files changed, 21 insertions(+), 9 deletions(-)
-
-diff --git a/src/apk_print.h b/src/apk_print.h
-index 590b8f3..841107d 100644
---- a/src/apk_print.h
-+++ b/src/apk_print.h
-@@ -14,13 +14,14 @@
-
- #include "apk_blob.h"
-
--#define apk_error(args...) do { apk_log("ERROR: ", args); } while (0)
--#define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log("WARNING: ", args); } } while (0)
-+#define apk_error(args...) do { apk_log_err("ERROR: ", args); } while (0)
-+#define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log_err("WARNING: ", args); } } while (0)
- #define apk_message(args...) do { if (apk_verbosity > 0) { apk_log(NULL, args); } } while (0)
-
- extern int apk_progress_fd;
-
- void apk_log(const char *prefix, const char *format, ...);
-+void apk_log_err(const char *prefix, const char *format, ...);
- const char *apk_error_str(int error);
-
- void apk_reset_screen_width(void);
-diff --git a/src/print.c b/src/print.c
-index 5df51f3..6608152 100644
---- a/src/print.c
-+++ b/src/print.c
-@@ -157,17 +157,28 @@ const char *apk_error_str(int error)
- }
- }
-
-+static void log(FILE *dest, const char *prefix, const char *format, va_list va)
-+{
-+ if (prefix != NULL)
-+ fprintf(dest, "%s", prefix);
-+ vfprintf(dest, format, va);
-+ fprintf(dest, "\n");
-+ fflush(dest);
-+ apk_progress_force = 1;
-+}
-+
- void apk_log(const char *prefix, const char *format, ...)
- {
- va_list va;
--
-- if (prefix != NULL)
-- fprintf(stdout, "%s", prefix);
- va_start(va, format);
-- vfprintf(stdout, format, va);
-+ log(stdout, prefix, format, va);
- va_end(va);
-- fprintf(stdout, "\n");
-- fflush(stdout);
-- apk_progress_force = 1;
- }
-
-+void apk_log_err(const char *prefix, const char *format, ...)
-+{
-+ va_list va;
-+ va_start(va, format);
-+ log(stderr, prefix, format, va);
-+ va_end(va);
-+}
---
-2.10.0
-
diff --git a/main/apk-tools/0001-solver-don-t-clobber-package-swaps-in-cases-where-an.patch b/main/apk-tools/0001-solver-don-t-clobber-package-swaps-in-cases-where-an.patch
deleted file mode 100644
index b28bb381c7..0000000000
--- a/main/apk-tools/0001-solver-don-t-clobber-package-swaps-in-cases-where-an.patch
+++ /dev/null
@@ -1,65 +0,0 @@
-From ba7b50c0f8ac7c8a88b03856037d9ca6618cccd5 Mon Sep 17 00:00:00 2001
-From: William Pitcock <nenolod@dereferenced.org>
-Date: Thu, 27 Apr 2017 23:23:47 +0000
-Subject: [PATCH] solver: don't clobber package swaps in cases where an
- installed package is being replaced by a provider
-
----
- src/solver.c | 23 ++++++++++++++++++-----
- 1 file changed, 18 insertions(+), 5 deletions(-)
-
-diff --git a/src/solver.c b/src/solver.c
-index 248fa27..5c08887 100644
---- a/src/solver.c
-+++ b/src/solver.c
-@@ -727,7 +727,12 @@ static void cset_track_deps_removed(struct apk_solver_state *ss, struct apk_pack
-
- static void cset_check_removal_by_deps(struct apk_solver_state *ss, struct apk_package *pkg)
- {
-- if (pkg->name->ss.requirers == 0)
-+ /* NOTE: an orphaned package name may have 0 requirers because it is now being satisfied
-+ * through an alternate provider. In these cases, we will handle this later as an adjustment
-+ * operation using cset_gen_name_change(). As such, only insert a removal into the transaction
-+ * if there is no other resolved provider.
-+ */
-+ if (pkg->name->ss.requirers == 0 && pkg->name->ss.chosen.pkg == NULL)
- cset_gen_name_remove(ss, pkg);
- }
-
-@@ -775,12 +780,16 @@ static void cset_gen_name_change(struct apk_solver_state *ss, struct apk_name *n
- if (name->ss.in_changeset) return;
-
- pkg = name->ss.chosen.pkg;
-- if (pkg == NULL) {
-- /* Package removal */
-+ if (pkg == NULL || pkg->name != name) {
-+ /* Original package dependency name was orphaned, emit a removal.
-+ * See cset_gen_name_remove() for more details. */
- opkg = name->ss.installed_pkg;
- if (opkg) cset_gen_name_remove(ss, opkg);
- name->ss.in_changeset = 1;
-- return;
-+
-+ /* If a replacement is not provided, then we're done here. */
-+ if (pkg == NULL)
-+ return;
- }
- if (pkg->ss.in_changeset) return;
-
-@@ -881,8 +890,12 @@ static void generate_changeset(struct apk_solver_state *ss, struct apk_dependenc
- foreach_array_item(d, world)
- cset_gen_dep(ss, NULL, d);
-
-+ /* NOTE: We used to call cset_gen_name_remove() directly here. While slightly faster, this clobbered
-+ * dependency nodes where a new package was provided under a different name (using provides). As such,
-+ * treat everything as a change first and then call cset_gen_name_remove() from there if appropriate.
-+ */
- list_for_each_entry(ipkg, &ss->db->installed.packages, installed_pkgs_list)
-- cset_gen_name_remove(ss, ipkg->pkg);
-+ cset_gen_name_change(ss, ipkg->pkg->name);
-
- changeset->num_total_changes =
- changeset->num_install +
---
-2.12.2
-
diff --git a/main/apk-tools/0002-db-catch-asprintf-failure.patch b/main/apk-tools/0002-db-catch-asprintf-failure.patch
deleted file mode 100644
index ede2765a20..0000000000
--- a/main/apk-tools/0002-db-catch-asprintf-failure.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 5f6e963680b8f4ef9a036ea44483b8dcca3c6ce2 Mon Sep 17 00:00:00 2001
-From: Natanael Copa <ncopa@alpinelinux.org>
-Date: Mon, 13 Mar 2017 12:57:43 +0000
-Subject: [PATCH 2/2] db: catch asprintf failure
-
----
- src/database.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/database.c b/src/database.c
-index 356907e..80b80e9 100644
---- a/src/database.c
-+++ b/src/database.c
-@@ -1576,7 +1576,8 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
- apk_blob_to_file(db->root_fd, apk_arch_file, *db->arch, APK_BTF_ADD_EOL);
-
- /* mount /proc */
-- asprintf(&db->root_proc_dir, "%s/proc", dbopts->root);
-+ if (asprintf(&db->root_proc_dir, "%s/proc", dbopts->root) == -1)
-+ goto ret_errno;
- if (statfs(db->root_proc_dir, &stfs) != 0) {
- if (errno == ENOENT) mkdir(db->root_proc_dir, 0555);
- stfs.f_type = 0;
---
-2.11.1
-
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index d1d6cbf8e1..6d9b3b7ea7 100644
--- a/main/apk-tools/APKBUILD
+++ b/main/apk-tools/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apk-tools
pkgver=2.7.1
-pkgrel=0
+pkgrel=1
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static"
depends=
@@ -13,6 +13,7 @@ if [ "$CBUILD" = "$CHOST" ]; then
makedepends="$makedepends lua5.2-dev"
fi
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz
+ 0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch
"
url="http://git.alpinelinux.org/cgit/apk-tools/"
@@ -82,4 +83,5 @@ luaapk() {
mv "$pkgdir"/usr/lib "$subpkgdir"/usr/lib/
}
-sha512sums="1247be2302cff5fcc1c5c3d4ebf812a800f47f969cee4c45e08418213f788ead601090b3ec630244f87c7026632a086296ac06c9d7c3cde74745fa6d13afbb2f apk-tools-2.7.1.tar.xz"
+sha512sums="1247be2302cff5fcc1c5c3d4ebf812a800f47f969cee4c45e08418213f788ead601090b3ec630244f87c7026632a086296ac06c9d7c3cde74745fa6d13afbb2f apk-tools-2.7.1.tar.xz
+a4f8168afd71e99e1107f45074ef0d64ae1dcf0c95838ab67b194222d954b78e33f1641533ad3907031979fd24390ec7e4a0cac4714fbc3209fdc5e70217d3a0 0001-db-fix-regression-preventing-remounting-apk-cache-r-.patch"