summaryrefslogtreecommitdiff
path: root/system/apk-tools
diff options
context:
space:
mode:
Diffstat (limited to 'system/apk-tools')
-rw-r--r--system/apk-tools/APKBUILD42
-rw-r--r--system/apk-tools/apk.zsh-completion240
-rw-r--r--system/apk-tools/dash.patch14
-rw-r--r--system/apk-tools/pmmx.patch11
-rw-r--r--system/apk-tools/s6-linux-init.patch11
-rw-r--r--system/apk-tools/search.patch29
-rw-r--r--system/apk-tools/virtual.patch109
7 files changed, 274 insertions, 182 deletions
diff --git a/system/apk-tools/APKBUILD b/system/apk-tools/APKBUILD
index aa4f95f5d..d664340e0 100644
--- a/system/apk-tools/APKBUILD
+++ b/system/apk-tools/APKBUILD
@@ -1,30 +1,32 @@
# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Adelie Platform Group <adelie-devel@lists.adelielinux.org>
pkgname=apk-tools
-pkgver=2.10.4
+pkgver=2.12.0
pkgrel=0
pkgdesc="Alpine Package Keeper - package manager"
-url="https://git.alpinelinux.org/cgit/apk-tools/"
+url="https://git.adelielinux.org/adelie/apk-tools"
arch="all"
license="GPL-2.0-only"
depends="ca-certificates"
makedepends_build=""
makedepends_host="zlib-dev openssl openssl-dev linux-headers"
makedepends="$makedepends_build $makedepends_host"
-subpackages="$pkgname-static"
-source="https://dev.alpinelinux.org/archive/$pkgname/$pkgname-$pkgver.tar.xz
- dash.patch
- pmmx.patch
- search.patch
- virtual.patch
+subpackages="$pkgname-dev $pkgname-static $pkgname-doc"
+source="https://dev.sick.bike/dist/$pkgname-v$pkgver+adelie.tar.gz
+ https://dev.sick.bike/dist/$pkgname-help-v$pkgver.tar.gz
+ apk.zsh-completion
+ s6-linux-init.patch
"
+builddir="$srcdir/$pkgname-v$pkgver"
prepare() {
default_prepare
sed -i -e 's:-Werror::' Make.rules
- echo "FULL_VERSION=$pkgver-r$pkgrel" > config.mk
- echo "LUAAPK=" >> config.mk
- echo "export LUAAPK" >> config.mk
+ cat >config.mk <<-EOF
+ FULL_VERSION=$pkgver-r$pkgrel
+ LUA=no
+ export LUA
+ EOF
}
build() {
@@ -42,13 +44,16 @@ package() {
"$pkgdir"/var/cache/misc \
"$pkgdir"/etc/apk/keys \
"$pkgdir"/etc/apk/protected_paths.d
- # the shipped README is empty
- rm -r "$pkgdir"/usr/share/
+ # the shipped README is not useful
+ rm -r "$pkgdir"/usr/share/doc
+
+ install -Dm644 "$srcdir"/apk.zsh-completion \
+ "$pkgdir"/usr/share/zsh/site-functions/_apk
}
static() {
pkgdesc="Alpine Package Keeper - static binary"
- install -Dm755 "$srcdir"/$pkgname-$pkgver/src/apk.static \
+ install -Dm755 "$builddir"/src/apk.static \
"$subpkgdir"/sbin/apk.static
# Sign the static binary so it can be vefified from distros
@@ -66,8 +71,7 @@ static() {
"$subpkgdir"/sbin/apk.static
}
-sha512sums="d2d9fde0aae9059236f68a3fc2f2186104bb9a099b15d296a6202a20ab2912638f10bb3b9edb70f359d060c5839573c3d50ef37d13095fa01c66dc3219ab6e39 apk-tools-2.10.4.tar.xz
-7f2559e72cb3a6fc7752971e65c1888fb867da07d0aa7d53af56f41ee8716f6cfe0b8c3589840032233094a31d63ac4a0a2f7681c9a5ecf72eff90b2ff826e88 dash.patch
-78f863c83af8b245aa38416c47016bcbe95ea8e33802123f6ea54b3752eb3c1ee79e5d6fc76ddedd2fba522b82a7367837f4596321085d54397b27fd5edf3b2f pmmx.patch
-5ac09eadabe44fe05c952c25df8f6daca292c63e6e5e3481d57603b8b3f1980385ccd87ad4a87b617353d1f936591afb9ee8815e4d8ec3e33913be2b3e3a3f84 search.patch
-4e2a8db82e6e40ae4863d12ee55151468d6e8c383e2e2001015f469e07f47057bc9055ab52a4a04f2bffa41ec225f77a9bd6042d5e1fcbd2908d7393e3aed2a1 virtual.patch"
+sha512sums="739cbf487a9184aba56c87448d18acebf357b6eddb4852033cc0cd331fc910d425a5d01f7b0bf109f5cd62f78f10cca96ebcbdb4fa00d197edb90726998e1523 apk-tools-v2.12.0+adelie.tar.gz
+b8e6e6e9efe2fc3a900e5fea54ed2f047bbf8917c8c3e470e001865c2169167ce6a273869ba577aceb1a1580b7dd684de115a4d92250786958fa13b9e8abf28b apk-tools-help-v2.12.0.tar.gz
+cedda9bf11e0a516c9bf0fd1a239ffa345cdd236419cbd8b10273410610ae7d0f0f61fd36e1e9ccc3bbf32f895508cdca4fb57a0e04f78dd88469b33bf64a32a apk.zsh-completion
+f92e2e0c062b71e1e5cf95f0d4997166ccc7f7a5e45af8d1650f5951a1d552d89217c8c60d24f31fa626e8e0675c5e882e6b36ef1af8f7624e54627b22801381 s6-linux-init.patch"
diff --git a/system/apk-tools/apk.zsh-completion b/system/apk-tools/apk.zsh-completion
new file mode 100644
index 000000000..955d504be
--- /dev/null
+++ b/system/apk-tools/apk.zsh-completion
@@ -0,0 +1,240 @@
+#compdef apk
+
+function _apk {
+
+ local -a global_opts=(
+ "(-h --help)"{-h,--help}"[Print help information]"
+ "(-i --interactive)"{-i,--interactive}"[Ask confirmation before performing certain operations]"
+ "(-p --root)"{-p,--root}"[Manage file system at ROOT]"
+ "(-q --quiet)"{-q,--quiet}"[Print less information]"
+ "(-U --update-cache)"{-U,--update-cache}"[Alias for '--cache-max-age 1']"
+ "(-v --verbose)"{-v,--verbose}"[Print more information]"
+ "(-V --version)"{-V,--version}"[Print program version and exit]"
+ "(-X --repository)"{-X,--repository}"[Specify additional package repository]:repository:_host"
+ "--allow-untrusted[Install packages with untrusted signature or no signature]"
+ "--arch[Temporarily override architecture]:arch:(armhf mips64 s390x x86_64 x86 aarch64 ppc64le armv7)"
+ "--cache-dir[Temporarily override the cache directory]:directory:_dir_list"
+ "--cache-max-age[Maximum age for index in cache before it's refreshed]:minutes"
+ "--force-binary-stdout[Continue even if binary data will be printed to the terminal]"
+ "--force-broken-world[Continue even if world cannot be satisfied]"
+ "--force-non-repository[Continue even if packages may be lost on reboot]"
+ "--force-old-apk[Continue even if packages use unsupported features]"
+ "--force-overwrite[Overwrite files in other packages]"
+ "--force-refresh[Do not use cached files]"
+ "--keys-dir[Override directory of trusted keys]:directory:_dir_list"
+ "--no-cache[Do not use any local cache path]"
+ "--no-network[Do not use the network]"
+ "--no-progress[Disable progress bar even for TTYs]"
+ "--print-arch[Print default arch and exit]"
+ "--progress[Show progress]"
+ "--progress-fd[Write progress to the specified file descriptor]:file descriptor"
+ "--purge[Delete modified configuration files or uninstalled packages from cache]"
+ "--repositories-file[Override system repositories]:repository file:_files"
+ "--wait[Wait to get an exclusive repository lock before failing]:seconds"
+ )
+
+ local -a commit_opts=(
+ "(-s --simulate)"{-s,--simulate}"[Simulate the requested operation without making any changes]"
+ "--clean-protected[Do not create .apk-new files in configuration directories]"
+ "--overlay-from-stdin[Read list of overlay files from stdin]"
+ "--no-scripts[Do not execute any scripts]"
+ "--no-commit-hooks[Skip pre/post hook scripts]"
+ "--initramfs-diskless-boot[Enables selected force options, disables commit hooks and more]"
+ )
+
+ local -a latest_opt=("(-l --latest)"{-l,--latest}"[Always choose the latest package by version]")
+ local -a upgrade_opt=("(-u --upgrade)"{-u,--upgrade}"[Upgrade packages and it's dependencies]")
+
+ local context state state_descr line
+ typeset -A opt_args
+ local curcontext="$curcontext"
+ local ret=1
+
+ function _ccache_apk_world { [[ "$1" -ot /etc/apk/world ]] }
+ function _ccache_apk_avail {
+ for i in /etc/apk/cache/APKINDEX.*; do
+ [[ "$1" -ot "$i" ]] && return
+ done
+ }
+
+ function _apk_available_pkgs {
+ local -a _apk_available_packs
+ zstyle ":completion:${curcontext}:" cache-policy _ccache_apk_avail
+ local IFS=$'\n'
+ if _cache_invalid apk_index_packages_available || ! _retrieve_cache apk_index_packages_available; then
+ _apk_available_packs=(${$(/sbin/apk list -a 2>/dev/null)%-[[:digit:][:lower:]._]##-r[[:digit:]]## * \{*\} (*)})
+ _store_cache apk_index_packages_available _apk_available_packs
+ fi
+ _describe 'available packages' _apk_available_packs
+ }
+
+ function _apk_installed_pkgs {
+ local -a _apk_installed_packs
+ zstyle ":completion:${curcontext}:" cache-policy _ccache_apk_world
+ local IFS=$'\n'
+ if _cache_invalid apk_index_packages_installed || ! _retrieve_cache apk_index_packages_installed; then
+ _apk_installed_packs=(${$(/sbin/apk list -I 2>/dev/null)%-[[:digit:][:lower:]._]##-r[[:digit:]]## * \{*\} (*)})
+ _store_cache apk_index_packages_installed _apk_installed_packs
+ fi
+ _describe 'installed packages' _apk_installed_packs
+ }
+
+ function _apk_packages {
+ _alternative 'repo:available packages:_apk_available_pkgs' 'localpkgs:local packages:_files -g "*.apk"'
+ }
+
+ function _apk_cache {
+ local -a cache_subcmds=(
+ "clean:Remove package files which are no longer necessary"
+ "download:Fetch package files from the repositories and store them in the cache"
+ "sync:Clean and Download"
+ )
+ _describe 'subcommand' cache_subcmds
+ }
+
+ function _apk_subcmds {
+ local -a cmds=(
+ "add:Add packages to world and commit changes"
+ "del:Remove packages from world and commit changes"
+ "fix:Fix, reinstall or upgrade packages without modifying world"
+ "update:Update repository indexes"
+ "upgrade:Install upgrades available from repositories"
+ "cache:Manage the local package cache"
+ "info:Give detailed information about packages or repositories"
+ "list:List packages matching a pattern or other criteria"
+ "dot:Render dependencies as graphviz graphs"
+ "policy:Show repository policy for packages"
+ "index:Create repository index file from packages"
+ "fetch:Download packages from global repositories to a local directory"
+ "manifest:Show checksums of package contents"
+ "verify:Verify package integrity and signature"
+ "audit:Audit system for changes"
+ "stats:Show statistics about repositories and installations"
+ "version:Compare package versions or perform tests on version strings"
+ )
+ _describe 'subcommand' cmds
+ }
+
+ local -a completion_spec=($global_opts ':subcommand:_apk_subcmds')
+
+ case ${${words:#-*}[2]} in
+ (add)
+ completion_spec+=(
+ $commit_opts \
+ $latest_opt \
+ $upgrade_opt \
+ "--initdb[Initialize a new package database]" \
+ "(-t --virtual)"{-t,--virtual}"[Create virtual package with given dependencies]" \
+ "*:package:_apk_packages"
+ )
+ ;;
+ (del)
+ completion_spec+=(
+ $commit_opts \
+ "--rdepeds[Recursively delete all top-level reverse dependencies]" \
+ "*:installed package:_apk_installed_pkgs"
+ )
+ ;;
+ (fix)
+ completion_spec+=(
+ $commit_opts \
+ "(-d --depends)"{-d,--depends}"[Fix dependencies of specified packages]" \
+ "(-r --reinstall)"{-r,--reinstall}"[Reinstall packages]" \
+ "(-u --upgrade)"{-u,--upgrade}"[Upgrade if an upgrade is available and does not break dependencies]" \
+ "(-x --xattr)"{-x,--xattr}"[Fix packages with broken xattrs]" \
+ "--directory-permissions[Reset all directory permissions]" \
+ "*:package:_apk_packages"
+ )
+ ;;
+ (update) completion_spec+=($commit_opts);;
+ (upgrade)
+ completion_spec+=(
+ $commit_opts \
+ $latest_opt \
+ "(-a --available)"{-a,--available}"[Reset all packages to versions available from current repositories]" \
+ "--ignore[Upgrade all other packages than the ones listed]" \
+ "--no-self-upgrade[Do not do an early upgrade of the 'apk-tools' package]" \
+ "--prune[Remove packages which are no longer available from any configured repository]" \
+ "--self-upgrade-only[Only perform a self-upgrade of the 'apk-tools' package]" \
+ "*:package:_apk_packages"
+ )
+ ;;
+ (cache)
+ completion_spec+=(
+ $latest_opt \
+ $upgrade_opt \
+ '2:subcommand:_apk_cache'
+ )
+ ;;
+ (info)
+ completion_spec+=(
+ "(-a --all)"{-a,--all}"[List all information known about the package]" \
+ "(-d --description)"{-d,--descripton}"[Print the package description]" \
+ "(-e --installed)"{-e,--installed}"[Check package installed status]" \
+ "(-L --contents)"{-L,--contents}"[List files included in the package]" \
+ "(-i --install-if)"{-i,--install-if}"[List the package's install_if rule]" \
+ "(-I --rinstall-if)"{-I,--rinstall-if}"[List other packages whose install_if rules refer to this package]" \
+ "(-r --rdepends)"{-r,--rdepends}"[List reverse dependencies of the package]" \
+ "(-R --depends)"{-R,--depends}"[List the dependencies of the package]" \
+ "(-s --size)"{-s,--size}"[Print the package's installed size]" \
+ "(-w --webpage)"{-w,--webpage}"[Print the URL for the package's upstream webpage]" \
+ "(-W --who-owns)"{-W,--who-owns}"[Print the package which owns the specified file]:file:_files" \
+ "--license[Print the package SPDX license identifier]" \
+ "--replaces[List the other packages for which this package is marked as a replacement]" \
+ "--triggers[Print active triggers for the package]" \
+ "*:package:_apk_packages"
+ )
+ ;;
+ (list)
+ completion_spec+=(
+ "(-I --installed)"{-I,--installed}"[Consider only installed packages]" \
+ "(-O --orphaned)"{-O,--orphaned}"[Consider only orphaned packages]" \
+ "(-a --available)"{-a,--available}"[Consider only available packages]" \
+ "(-u --upgradeable)"{-u,--upgradeable}"[Consider only upgradable packages]" \
+ "(-o --origin)"{-o,--origin}"[List packages by origin]" \
+ "(-d --depends)"{-d,--depends}"[List packages by dependency]" \
+ "(-P --providers)"{-P,--providers}"[List packages by provider]" \
+ "*:pattern"
+ )
+ ;;
+ (dot)
+ completion_spec+=(
+ "--errors[Consider only packages with errors]" \
+ "--installed[Consider only installed packages]"
+ )
+ ;;
+ (index)
+ completion_spec+=(
+ "(-d --description)"{-d,--description}"[Add a description to the index]:description" \
+ "(-o --output)"{-o,--output}"[Output generated index to file]:output:_files" \
+ "(-x --index)"{-x,--index}"[Read an existing index to speed up the creation of the new index]" \
+ "--no-warnings[Disable warnings about missing dependencies]" \
+ "*:package:_apk_packages"
+ )
+ ;;
+ (fetch)
+ completion_spec+=(
+ "(-l --link)"{-l,--link}"[Create hard links if possible]" \
+ "(-o --output)"{-o,--output}"[Where to write the downloaded files]:directory:_dir_list" \
+ "(-r --recursive)"{-r,--recursive}"[Fetch packages and all of their dependencies]" \
+ "(-s --stdout)"{-s,--stdout}"[Dump the .apk file(s) to stdout]" \
+ "--simulate[Simulate the requested operation without making any changes]" \
+ "*:package:_apk_packages"
+ )
+ ;;
+ (manifest) completion_spec+=("*:package:_apk_packages");;
+ (verify) completion_spec+=("*:package:_apk_packages");;
+ (audit) completion_spec+=("*:files:_files");;
+ (version)
+ completion_spec+=(
+ "-a[Consider packages from all repository tags]" \
+ "-l[Limit to packages with output matching given operand]:operand" \
+ "*:package:_apk_packages"
+ )
+ ;;
+ (policy) completion_spec+=("*:package:_apk_packages");;
+ esac
+
+ _arguments -C -s $completion_spec && ret=0
+ return ret
+}
diff --git a/system/apk-tools/dash.patch b/system/apk-tools/dash.patch
deleted file mode 100644
index 811427d3c..000000000
--- a/system/apk-tools/dash.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- apk-tools-2.10.4/test/solver.sh
-+++ apk-tools-2.10.4/test/solver.sh
-@@ -11,9 +11,9 @@ TEST_TO_RUN="$@"
- fail=0
- pass=0
- for test in ${TEST_TO_RUN:-*.test}; do
-- get_block ARGS < $test | xargs $APK_TEST &> .$test.got
-+ get_block ARGS < $test | xargs $APK_TEST > .$test.got 2>&1
-
-- if ! get_block EXPECT < $test | cmp .$test.got &> /dev/null; then
-+ if ! get_block EXPECT < $test | cmp .$test.got > /dev/null 2>&1; then
- fail=$((fail+1))
- echo "FAIL: $test"
- get_block EXPECT < $test | diff -ru - .$test.got
diff --git a/system/apk-tools/pmmx.patch b/system/apk-tools/pmmx.patch
deleted file mode 100644
index e64ad6c0d..000000000
--- a/system/apk-tools/pmmx.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- apk-tools-2.10.1/src/apk_defines.h.old 2018-09-10 08:04:03.000000000 +0000
-+++ apk-tools-2.10.1/src/apk_defines.h 2019-01-04 03:31:41.900000000 +0000
-@@ -89,7 +89,7 @@
- #if defined(__x86_64__)
- #define APK_DEFAULT_ARCH "x86_64"
- #elif defined(__i386__)
--#define APK_DEFAULT_ARCH "x86"
-+#define APK_DEFAULT_ARCH "pmmx"
- #elif defined(__powerpc__) && !defined(__powerpc64__)
- #define APK_DEFAULT_ARCH "ppc"
- #elif defined(__powerpc64__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
diff --git a/system/apk-tools/s6-linux-init.patch b/system/apk-tools/s6-linux-init.patch
new file mode 100644
index 000000000..2dc3db924
--- /dev/null
+++ b/system/apk-tools/s6-linux-init.patch
@@ -0,0 +1,11 @@
+The s6-linux-init-common package has a FIFO which breaks with this.
+--- apk-tools-v2.12.0/src/database.c.old 2020-12-30 02:39:04.000000000 +0000
++++ apk-tools-v2.12.0/src/database.c 2021-01-27 01:47:04.680712750 +0000
+@@ -2592,7 +2592,6 @@
+ apk_warning(PKG_VER_FMT": support for packages without embedded "
+ "checksums will be dropped in apk-tools 3.",
+ PKG_VER_PRINTF(pkg));
+- ipkg->broken_files = 1;
+ ctx->missing_checksum = 1;
+ }
+ break;
diff --git a/system/apk-tools/search.patch b/system/apk-tools/search.patch
deleted file mode 100644
index 1c652356f..000000000
--- a/system/apk-tools/search.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 530a6e6847657aa9187acd187269ac25f7cdd932 Mon Sep 17 00:00:00 2001
-From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
-Date: Tue, 9 Jul 2019 00:40:15 -0500
-Subject: [PATCH] search: Show in "simple" help output
-
-Most users probably want to know about the 'search' applet.
-
-Omission from 'apk --help' output reported by fungalnet[1].
-
-[1]: https://www.reddit.com/r/AdelieLinux/comments/c8mtk9/apk_search/
----
- src/search.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/search.c b/src/search.c
-index 9a71747..0b00a3b 100644
---- a/src/search.c
-+++ b/src/search.c
-@@ -209,6 +209,7 @@ static struct apk_applet apk_search = {
- .help = "Search package by PATTERNs or by indexed dependencies",
- .arguments = "PATTERN",
- .open_flags = APK_OPENF_READ | APK_OPENF_NO_STATE,
-+ .command_groups = APK_COMMAND_GROUP_QUERY,
- .context_size = sizeof(struct search_ctx),
- .optgroups = { &optgroup_global, &optgroup_applet },
- .main = search_main,
---
-2.22.0
-
diff --git a/system/apk-tools/virtual.patch b/system/apk-tools/virtual.patch
deleted file mode 100644
index 31e6d6807..000000000
--- a/system/apk-tools/virtual.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 1/2] 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
-