aboutsummaryrefslogtreecommitdiffstats
path: root/main/apk-tools
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-02-16 15:22:02 +0200
committerTimo Teräs <timo.teras@iki.fi>2016-02-16 17:23:43 +0200
commit67af09f20d30c6fb142cf986ebd2bf9d28ed4397 (patch)
treeececae4d6898c2a793a76b701e54079d8b0c1328 /main/apk-tools
parent0c90703a2f5cbfa7762c7acd027a9bd41ce41fbc (diff)
downloadaports-67af09f20d30c6fb142cf986ebd2bf9d28ed4397.tar.bz2
aports-67af09f20d30c6fb142cf986ebd2bf9d28ed4397.tar.xz
main/apk-tools: fetch improvements
Diffstat (limited to 'main/apk-tools')
-rw-r--r--main/apk-tools/0001-implement-fetch-purge.patch71
-rw-r--r--main/apk-tools/APKBUILD16
2 files changed, 83 insertions, 4 deletions
diff --git a/main/apk-tools/0001-implement-fetch-purge.patch b/main/apk-tools/0001-implement-fetch-purge.patch
new file mode 100644
index 0000000000..566dd736c8
--- /dev/null
+++ b/main/apk-tools/0001-implement-fetch-purge.patch
@@ -0,0 +1,71 @@
+From 445ea072205cfb2d9ecd9ffb28d88023d5d24ea5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Tue, 16 Feb 2016 15:19:15 +0200
+Subject: [PATCH] implement fetch --purge
+
+which will delete any .apk package on output directory that were
+not downloaded by fetch
+
+this allows apk fetch to incrementally build repositories for
+binary images
+---
+ src/fetch.c | 36 ++++++++++++++++++++++++++++++++++++
+ 1 file changed, 36 insertions(+)
+
+diff --git a/src/fetch.c b/src/fetch.c
+index 3bb7934..14e0790 100644
+--- a/src/fetch.c
++++ b/src/fetch.c
+@@ -264,6 +264,37 @@ err:
+ mark_error(ctx, match, name);
+ }
+
++static int purge_package(void *pctx, int dirfd, const char *filename)
++{
++ char tmp[PATH_MAX];
++ struct fetch_ctx *ctx = (struct fetch_ctx *) pctx;
++ struct apk_database *db = ctx->db;
++ struct apk_provider *p0;
++ struct apk_name *name;
++ apk_blob_t b = APK_BLOB_STR(filename), bname, bver;
++ size_t l;
++
++ if (apk_pkg_parse_name(b, &bname, &bver)) return 0;
++ name = apk_db_get_name(db, bname);
++ if (!name) return 0;
++
++ foreach_array_item(p0, name->providers) {
++ if (p0->pkg->name != name) continue;
++ l = snprintf(tmp, sizeof tmp, PKG_FILE_FMT, PKG_FILE_PRINTF(p0->pkg));
++ if (l > sizeof tmp) continue;
++ if (apk_blob_compare(b, APK_BLOB_PTR_LEN(tmp, l)) != 0) continue;
++ if (p0->pkg->marked) return 0;
++ break;
++ }
++
++ apk_message("Purging %s", filename);
++ if (apk_flags & APK_SIMULATE)
++ return 0;
++
++ unlinkat(dirfd, filename, 0);
++ return 0;
++}
++
+ static int fetch_main(void *pctx, struct apk_database *db, struct apk_string_array *args)
+ {
+ struct fetch_ctx *ctx = (struct fetch_ctx *) pctx;
+@@ -290,6 +321,11 @@ static int fetch_main(void *pctx, struct apk_database *db, struct apk_string_arr
+ if (!ctx->errors)
+ apk_hash_foreach(&db->available.packages, fetch_package, ctx);
+
++ /* Remove packages not matching download spec from the output directory */
++ if (!ctx->errors && (apk_flags & APK_PURGE) &&
++ !(ctx->flags & FETCH_STDOUT) && ctx->outdir_fd > 0)
++ apk_dir_foreach_file(ctx->outdir_fd, purge_package, ctx);
++
+ return ctx->errors;
+ }
+
+--
+2.7.1
+
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD
index b16ba9ae63..5d5da2400c 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.6.6
-pkgrel=0
+pkgrel=1
pkgdesc="Alpine Package Keeper - package manager for alpine"
subpackages="$pkgname-static"
depends=
@@ -13,6 +13,8 @@ if [ "$CBUILD" = "$CHOST" ]; then
makedepends="$makedepends lua5.2-dev"
fi
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz
+ 0001-implement-fetch-purge.patch
+ 0002-fetch-allow-enabling-simulate.patch
"
url="http://git.alpinelinux.org/cgit/apk-tools/"
@@ -82,6 +84,12 @@ luaapk() {
mv "$pkgdir"/usr/lib "$subpkgdir"/usr/lib/
}
-md5sums="5557e3da166c7a4323df25d9849f5235 apk-tools-2.6.6.tar.xz"
-sha256sums="b953d11db39049a569b6c8a03ea576b06ba311f38ca01f90ec9772eecfca092b apk-tools-2.6.6.tar.xz"
-sha512sums="a0d3158cf5b17b4050d411e26c341f2c783fefab26418ab68115470c299b72d50278b9d6ebd8c4c0daa121a0df93aae19358cf979acf9b2245e92853b93387a4 apk-tools-2.6.6.tar.xz"
+md5sums="5557e3da166c7a4323df25d9849f5235 apk-tools-2.6.6.tar.xz
+e19cd836d0c9337cba7554ab6ca58e6f 0001-implement-fetch-purge.patch
+8f58318fb02d7c58eecd2cfe183d2c55 0002-fetch-allow-enabling-simulate.patch"
+sha256sums="b953d11db39049a569b6c8a03ea576b06ba311f38ca01f90ec9772eecfca092b apk-tools-2.6.6.tar.xz
+b965905cba4f3251ba22335b0627a9332f611610438a30e1966b7e24728f434c 0001-implement-fetch-purge.patch
+93545cc192c47b993212f7f1a98f05faa9a13a71a7e3901bad3969b96caf4e8d 0002-fetch-allow-enabling-simulate.patch"
+sha512sums="a0d3158cf5b17b4050d411e26c341f2c783fefab26418ab68115470c299b72d50278b9d6ebd8c4c0daa121a0df93aae19358cf979acf9b2245e92853b93387a4 apk-tools-2.6.6.tar.xz
+817749b75bcd0d7f943326b536ee5b9086f08bc54053c7b3eca6f08eb3e94ddbf3b73b1865d927eec076394378de8b00337bff46351f4457f71fb83be020bbcc 0001-implement-fetch-purge.patch
+569e7784d6444f0a8ae72e98806f33fa3ddbb302f3d6699ef12caf03e6ecb7d1e966a948db2717c2442e5fc0eb66a1246eabf8143f134205f3894d96d6fccf1d 0002-fetch-allow-enabling-simulate.patch"