summaryrefslogtreecommitdiffstats
path: root/main/apk-tools
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-09-22 14:40:38 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-09-22 14:40:38 +0000
commit55c90bc6ffa3ebe113b9f6e4b6f2172381f02a60 (patch)
tree4ea57c464dfaf8297869bf97972343af7cd6c714 /main/apk-tools
parentafe4cc9c3392be61f175e65612140835c53cc88d (diff)
downloadaports-55c90bc6ffa3ebe113b9f6e4b6f2172381f02a60.tar.bz2
aports-55c90bc6ffa3ebe113b9f6e4b6f2172381f02a60.tar.xz
main/apk-tools: remove all dirs on apk del
fixes #406
Diffstat (limited to 'main/apk-tools')
-rw-r--r--main/apk-tools/0001-Fix-building-on-eglibc.patch64
-rw-r--r--main/apk-tools/0001-db-optionally-remove-dirs-when-unref.patch97
-rw-r--r--main/apk-tools/APKBUILD4
3 files changed, 164 insertions, 1 deletions
diff --git a/main/apk-tools/0001-Fix-building-on-eglibc.patch b/main/apk-tools/0001-Fix-building-on-eglibc.patch
new file mode 100644
index 000000000..12bb99a62
--- /dev/null
+++ b/main/apk-tools/0001-Fix-building-on-eglibc.patch
@@ -0,0 +1,64 @@
+From b4adf7645ff6c14e19682b9ef17e15756c5b0b14 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Mon, 30 Aug 2010 13:04:25 +0000
+Subject: [PATCH] Fix building on eglibc
+
+Seems like recent eglibc requires that you include sys/stat.h
+---
+ src/archive.c | 1 +
+ src/database.c | 1 +
+ src/io.c | 1 +
+ src/package.c | 1 +
+ 4 files changed, 4 insertions(+), 0 deletions(-)
+
+diff --git a/src/archive.c b/src/archive.c
+index f60cb1b..3ac8a64 100644
+--- a/src/archive.c
++++ b/src/archive.c
+@@ -20,6 +20,7 @@
+ #include <unistd.h>
+ #include <sysexits.h>
+ #include <sys/wait.h>
++#include <sys/stat.h>
+ #include <limits.h>
+ #include <stdint.h>
+
+diff --git a/src/database.c b/src/database.c
+index 5dcd9e0..925aa4a 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -20,6 +20,7 @@
+ #include <signal.h>
+ #include <fnmatch.h>
+ #include <sys/file.h>
++#include <sys/stat.h>
+
+ #include "apk_defines.h"
+ #include "apk_package.h"
+diff --git a/src/io.c b/src/io.c
+index 2b0c892..5100d41 100644
+--- a/src/io.c
++++ b/src/io.c
+@@ -15,6 +15,7 @@
+ #include <unistd.h>
+ #include <malloc.h>
+ #include <sys/mman.h>
++#include <sys/stat.h>
+ #include <pwd.h>
+ #include <grp.h>
+
+diff --git a/src/package.c b/src/package.c
+index e73814a..8f15e7a 100644
+--- a/src/package.c
++++ b/src/package.c
+@@ -19,6 +19,7 @@
+ #include <stdlib.h>
+ #include <unistd.h>
+ #include <sys/wait.h>
++#include <sys/stat.h>
+
+ #include <openssl/pem.h>
+
+--
+1.7.2.2
+
diff --git a/main/apk-tools/0001-db-optionally-remove-dirs-when-unref.patch b/main/apk-tools/0001-db-optionally-remove-dirs-when-unref.patch
new file mode 100644
index 000000000..e6497dda4
--- /dev/null
+++ b/main/apk-tools/0001-db-optionally-remove-dirs-when-unref.patch
@@ -0,0 +1,97 @@
+From 5c4583a9027de2a26d3bff8b443f7db7f0c37074 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 22 Sep 2010 14:16:18 +0000
+Subject: [PATCH] db: optionally remove dirs when unref
+
+We want remove dirs when they are unreferenced so we remove all dirs on
+apk del, but we don't want remove dirs when closing database. So we make
+removing dir optional when unreferencing it.
+
+This partially reverts commit c7ffc96a16c6963fe0a07be7ee75e8f1f7426882.
+
+fixes #406
+---
+ src/database.c | 28 +++++++++++++++-------------
+ 1 files changed, 15 insertions(+), 13 deletions(-)
+
+diff --git a/src/database.c b/src/database.c
+index 925aa4a..0054837 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -30,6 +30,11 @@
+ #include "apk_archive.h"
+ #include "apk_print.h"
+
++enum {
++ APK_DISALLOW_RMDIR = 0,
++ APK_ALLOW_RMDIR = 1
++};
++
+ int apk_verbosity = 1;
+ unsigned int apk_flags = 0;
+
+@@ -188,16 +193,19 @@ struct apk_name *apk_db_get_name(struct apk_database *db, apk_blob_t name)
+ return pn;
+ }
+
+-static void apk_db_dir_unref(struct apk_database *db, struct apk_db_dir *dir)
++static void apk_db_dir_unref(struct apk_database *db, struct apk_db_dir *dir,
++ int allow_rmdir)
+ {
+ dir->refs--;
+ if (dir->refs > 0)
+ return;
+
+ db->installed.stats.dirs--;
++ if (allow_rmdir)
++ unlinkat(db->root_fd, dir->name, AT_REMOVEDIR);
+
+ if (dir->parent != NULL)
+- apk_db_dir_unref(db, dir->parent);
++ apk_db_dir_unref(db, dir->parent, allow_rmdir);
+ }
+
+ static struct apk_db_dir *apk_db_dir_ref(struct apk_db_dir *dir)
+@@ -307,16 +315,11 @@ static void apk_db_diri_mkdir(struct apk_database *db, struct apk_db_dir_instanc
+ }
+ }
+
+-static void apk_db_diri_rmdir(struct apk_database *db, struct apk_db_dir_instance *diri)
+-{
+- if (diri->dir->refs == 1)
+- unlinkat(db->root_fd, diri->dir->name, 1);
+-}
+-
+ static void apk_db_diri_free(struct apk_database *db,
+- struct apk_db_dir_instance *diri)
++ struct apk_db_dir_instance *diri,
++ int allow_rmdir)
+ {
+- apk_db_dir_unref(db, diri->dir);
++ apk_db_dir_unref(db, diri->dir, allow_rmdir);
+ free(diri);
+ }
+
+@@ -1265,7 +1268,7 @@ void apk_db_close(struct apk_database *db)
+
+ list_for_each_entry(ipkg, &db->installed.packages, installed_pkgs_list) {
+ hlist_for_each_entry_safe(diri, dc, dn, &ipkg->owned_dirs, pkg_dirs_list) {
+- apk_db_diri_free(db, diri);
++ apk_db_diri_free(db, diri, APK_DISALLOW_RMDIR);
+ }
+ }
+
+@@ -1884,9 +1887,8 @@ static void apk_db_purge_pkg(struct apk_database *db,
+ db->installed.stats.files--;
+ }
+ }
+- apk_db_diri_rmdir(db, diri);
+ __hlist_del(dc, &ipkg->owned_dirs.first);
+- apk_db_diri_free(db, diri);
++ apk_db_diri_free(db, diri, APK_ALLOW_RMDIR);
+ }
+ }
+
+--
+1.7.2.3
+
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index 3c9f6243c..e698b02e2 100644
--- a/main/apk-tools/APKBUILD
+++ b/main/apk-tools/APKBUILD
@@ -1,13 +1,14 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=apk-tools
pkgver=2.0.5
-pkgrel=2
+pkgrel=3
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static"
depends=
makedepends="zlib-dev openssl-dev pkgconfig"
source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2
0001-Makefile-do-not-require-lua-pkgconfig-unless-you-int.patch
+ 0001-db-optionally-remove-dirs-when-unref.patch
apk-tools-static.patch
eglibc.patch
"
@@ -55,5 +56,6 @@ static() {
md5sums="7f9234ab210557b064d7bd9b42833f0a apk-tools-2.0.5.tar.bz2
f63d483b724e8e9344ce8cb965d5ed22 0001-Makefile-do-not-require-lua-pkgconfig-unless-you-int.patch
+c2ea3684c22740ef210a9b1a64ba4058 0001-db-optionally-remove-dirs-when-unref.patch
3c1f21719a6c4aba51333cf0d88c5600 apk-tools-static.patch
a4de86c6c4df6d4d125ff82e607797d6 eglibc.patch"