diff options
author | Timo Teräs <timo.teras@iki.fi> | 2020-02-18 16:23:24 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2020-02-18 16:23:54 +0200 |
commit | b0c8d5a73f31e35e716113acbb15b6bb3850fa05 (patch) | |
tree | d8602c4ed26f3e76e8a72be9de147c4932e297e4 /main/apk-tools | |
parent | 13a97e02324cad57ab7c44ff9b83a3e51643c6f5 (diff) | |
download | aports-b0c8d5a73f31e35e716113acbb15b6bb3850fa05.tar.bz2 aports-b0c8d5a73f31e35e716113acbb15b6bb3850fa05.tar.xz |
main/apk-tools: upgrade to 2.10.5
Diffstat (limited to 'main/apk-tools')
-rw-r--r-- | main/apk-tools/0001-add-fix-virtual-package-id-generation.patch | 109 | ||||
-rw-r--r-- | main/apk-tools/APKBUILD | 14 | ||||
-rw-r--r-- | main/apk-tools/lua-apk_time.patch | 20 |
3 files changed, 5 insertions, 138 deletions
diff --git a/main/apk-tools/0001-add-fix-virtual-package-id-generation.patch b/main/apk-tools/0001-add-fix-virtual-package-id-generation.patch deleted file mode 100644 index fdc780dcd2..0000000000 --- a/main/apk-tools/0001-add-fix-virtual-package-id-generation.patch +++ /dev/null @@ -1,109 +0,0 @@ -From b45415b1096e76f40b32326d2798123f81fe5976 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Tue, 2 Jul 2019 15:27:57 +0300 -Subject: [PATCH] add: fix virtual package id generation - -Fixes 37fbafcd by adding more input to the hash than just second -grained time stamp - collisions would happen when running apk -scripted. - -For virtual package the hash works only as unique identifier, so -try to add elements that should make it unique in most cases. - -Fixes #10648 ---- - src/add.c | 51 +++++++++++++++++++++++++++++++++++---------------- - 1 file changed, 35 insertions(+), 16 deletions(-) - -diff --git a/src/add.c b/src/add.c -index 2d342ab..e028736 100644 ---- a/src/add.c -+++ b/src/add.c -@@ -11,6 +11,7 @@ - - #include <errno.h> - #include <stdio.h> -+#include <unistd.h> - #include "apk_applet.h" - #include "apk_database.h" - #include "apk_print.h" -@@ -80,6 +81,38 @@ static int non_repository_check(struct apk_database *db) - return 1; - } - -+static struct apk_package *create_virtual_package(struct apk_database *db, struct apk_name *name) -+{ -+ char ver[32]; -+ struct apk_package *virtpkg; -+ struct tm tm; -+ EVP_MD_CTX *mdctx; -+ time_t now = apk_time(); -+ pid_t pid = getpid(); -+ -+ localtime_r(&now, &tm); -+ strftime(ver, sizeof ver, "%Y%m%d.%H%M%S", &tm); -+ -+ virtpkg = apk_pkg_new(); -+ if (virtpkg == NULL) return 0; -+ -+ virtpkg->name = name; -+ virtpkg->version = apk_blob_atomize(APK_BLOB_STR(ver)); -+ virtpkg->description = strdup("virtual meta package"); -+ virtpkg->arch = apk_blob_atomize(APK_BLOB_STR("noarch")); -+ -+ mdctx = EVP_MD_CTX_new(); -+ EVP_DigestInit_ex(mdctx, apk_checksum_default(), NULL); -+ EVP_DigestUpdate(mdctx, &tm, sizeof tm); -+ EVP_DigestUpdate(mdctx, &pid, sizeof pid); -+ EVP_DigestUpdate(mdctx, virtpkg->name->name, strlen(virtpkg->name->name) + 1); -+ virtpkg->csum.type = EVP_MD_CTX_size(mdctx); -+ EVP_DigestFinal_ex(mdctx, virtpkg->csum.data, NULL); -+ EVP_MD_CTX_free(mdctx); -+ -+ return virtpkg; -+} -+ - static int add_main(void *ctx, struct apk_database *db, struct apk_string_array *args) - { - struct add_ctx *actx = (struct add_ctx *) ctx; -@@ -93,10 +126,6 @@ static int add_main(void *ctx, struct apk_database *db, struct apk_string_array - - if (actx->virtpkg) { - apk_blob_t b = APK_BLOB_STR(actx->virtpkg); -- struct tm tm; -- time_t now; -- char ver[32]; -- - apk_blob_pull_dep(&b, db, &virtdep); - if (APK_BLOB_IS_NULL(b) || virtdep.conflict || - virtdep.result_mask != APK_DEPMASK_ANY || -@@ -104,24 +133,14 @@ static int add_main(void *ctx, struct apk_database *db, struct apk_string_array - apk_error("%s: bad package specifier"); - return -1; - } -- - if (virtdep.name->name[0] != '.' && non_repository_check(db)) - return -1; - -- now = apk_time(); -- localtime_r(&now, &tm); -- strftime(ver, sizeof ver, "%Y%m%d.%H%M%S", &tm); -- -- virtpkg = apk_pkg_new(); -- if (virtpkg == NULL) { -+ virtpkg = create_virtual_package(db, virtdep.name); -+ if (!virtpkg) { - apk_error("Failed to allocate virtual meta package"); - return -1; - } -- virtpkg->name = virtdep.name; -- apk_blob_checksum(APK_BLOB_STR(ver), apk_checksum_default(), &virtpkg->csum); -- virtpkg->version = apk_blob_atomize(APK_BLOB_STR(ver)); -- virtpkg->description = strdup("virtual meta package"); -- virtpkg->arch = apk_blob_atomize(APK_BLOB_STR("noarch")); - - virtdep.result_mask = APK_VERSION_EQUAL; - virtdep.version = virtpkg->version; --- -2.22.0 - diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD index affdcf975d..db37f4721a 100644 --- a/main/apk-tools/APKBUILD +++ b/main/apk-tools/APKBUILD @@ -1,19 +1,17 @@ # Maintainer: Natanael Copa <ncopa@alpinelinux.org> pkgname=apk-tools -pkgver=2.10.4 -pkgrel=3 +pkgver=2.10.5 +pkgrel=0 pkgdesc="Alpine Package Keeper - package manager for alpine" subpackages="$pkgname-static" makedepends_build="openssl" makedepends_host="zlib-dev openssl-dev zlib-static openssl-libs-static linux-headers" makedepends="$makedepends_build $makedepends_host" if [ "$CBUILD" = "$CHOST" ]; then - subpackages="$subpackages lua5.2-apk:luaapk" - makedepends="$makedepends lua5.2-dev" + subpackages="$subpackages lua5.3-apk:luaapk" + makedepends="$makedepends lua5.3-dev" fi source="https://dev.alpinelinux.org/archive/apk-tools/apk-tools-$pkgver.tar.xz - 0001-add-fix-virtual-package-id-generation.patch - lua-apk_time.patch " url="https://git.alpinelinux.org/cgit/apk-tools/" @@ -81,6 +79,4 @@ luaapk() { mv "$pkgdir"/usr/lib "$subpkgdir"/usr/lib/ } -sha512sums="d2d9fde0aae9059236f68a3fc2f2186104bb9a099b15d296a6202a20ab2912638f10bb3b9edb70f359d060c5839573c3d50ef37d13095fa01c66dc3219ab6e39 apk-tools-2.10.4.tar.xz -3cf1ae421e136ebe8c037a468fbeb3bca11668eb04dd4b8b9346c4089306002c891d6c2544d22522550f37a4fad0dfcecabceb4c8872165ea6827dcce46d9f2b 0001-add-fix-virtual-package-id-generation.patch -7751f4ddbf3f1b14f5d70ea0f8c2f78168d6138272f883fe1c0137ed135c3f3639f4bf2860dbf6b6de0d4321c93ec9c150edaf5f496c4dc0fedd0a201f399599 lua-apk_time.patch" +sha512sums="0f85ec7c734f2ffc671007fa029f3c96eacfb196c45e465e33aa65c32a6fbcd7523153b6441fdf826a5b4d2e66de02d338620474d333c28cb1ce0233f1120495 apk-tools-2.10.5.tar.xz" diff --git a/main/apk-tools/lua-apk_time.patch b/main/apk-tools/lua-apk_time.patch deleted file mode 100644 index 01b68f369e..0000000000 --- a/main/apk-tools/lua-apk_time.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/src/lua-apk.c b/src/lua-apk.c -index 532577a..26129fb 100644 ---- a/src/lua-apk.c -+++ b/src/lua-apk.c -@@ -37,6 +37,15 @@ struct flagmap opendb_flagmap[] = { - {NULL, 0} - }; - -+time_t apk_time(void) -+{ -+#ifdef TEST_MODE -+ return 1559567666; -+#else -+ return time(NULL); -+#endif -+} -+ - /* implemented as luaL_typerror until lua 5.1, dropped in 5.2 - * (C) 1994-2012 Lua.org, PUC-Rio. MIT license - */ |