xbps: update to 0.51.
This commit is contained in:
parent
501b1880a6
commit
334e93875c
3 changed files with 4 additions and 408 deletions
|
@ -1,227 +0,0 @@
|
|||
diff --git a/lib/package_alternatives.c b/lib/package_alternatives.c
|
||||
index e4d94e3..08a8e5b 100644
|
||||
--- lib/package_alternatives.c
|
||||
+++ lib/package_alternatives.c
|
||||
@@ -150,7 +150,7 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
||||
cnt = xbps_array_count(a);
|
||||
for (i = 0; i < cnt; i++) {
|
||||
xbps_string_t str;
|
||||
- char *tgt_dup, *tgt_dir;
|
||||
+ char *tgt_dup, *tgt_dir, *lnk_dup, *lnk_dir;
|
||||
char *l, *lnk, *tgt = NULL;
|
||||
const char *tgt0;
|
||||
int rv;
|
||||
@@ -164,19 +164,44 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
||||
tgt_dup = strdup(tgt0);
|
||||
assert(tgt_dup);
|
||||
tgt_dir = dirname(tgt_dup);
|
||||
- tgt = xbps_xasprintf("%s%s", xhp->rootdir, tgt_dir);
|
||||
- if (xbps_mkpath(tgt, 0755) != 0) {
|
||||
- if (errno != EEXIST) {
|
||||
- rv = errno;
|
||||
- xbps_dbg_printf(xhp, "failed to create symlink"
|
||||
- "target dir '%s' for group '%s': %s\n",
|
||||
- tgt, grname, strerror(errno));
|
||||
- free(tgt);
|
||||
- free(l);
|
||||
- return rv;
|
||||
+ if (strcmp(tgt_dir, ".")) {
|
||||
+ tgt = xbps_xasprintf("%s%s", xhp->rootdir, tgt_dir);
|
||||
+ if (xbps_mkpath(tgt, 0755) != 0) {
|
||||
+ if (errno != EEXIST) {
|
||||
+ rv = errno;
|
||||
+ xbps_dbg_printf(xhp, "failed to create "
|
||||
+ "target dir '%s' for group '%s': %s\n",
|
||||
+ tgt, grname, strerror(errno));
|
||||
+ free(tgt_dup);
|
||||
+ free(tgt);
|
||||
+ free(l);
|
||||
+ return rv;
|
||||
+ }
|
||||
}
|
||||
+ free(tgt);
|
||||
}
|
||||
- free(tgt);
|
||||
+ /* always create link dir, for dangling symlinks */
|
||||
+ lnk_dup = strdup(l);
|
||||
+ assert(lnk_dup);
|
||||
+ lnk_dir = dirname(lnk_dup);
|
||||
+ if (strcmp(lnk_dir, ".")) {
|
||||
+ lnk = xbps_xasprintf("%s%s", xhp->rootdir, lnk_dir);
|
||||
+ if (xbps_mkpath(lnk, 0755) != 0) {
|
||||
+ if (errno != EEXIST) {
|
||||
+ rv = errno;
|
||||
+ xbps_dbg_printf(xhp, "failed to create symlink"
|
||||
+ "dir '%s' for group '%s': %s\n",
|
||||
+ lnk, grname, strerror(errno));
|
||||
+ free(tgt_dup);
|
||||
+ free(lnk_dup);
|
||||
+ free(lnk);
|
||||
+ free(l);
|
||||
+ return rv;
|
||||
+ }
|
||||
+ }
|
||||
+ free(lnk);
|
||||
+ }
|
||||
+ free(lnk_dup);
|
||||
|
||||
if (l[0] != '/') {
|
||||
lnk = xbps_xasprintf("%s%s/%s", xhp->rootdir, tgt_dir, l);
|
||||
diff --git a/tests/xbps/xbps-alternatives/main.sh b/tests/xbps/xbps-alternatives/main.sh
|
||||
index e636894..facd290 100644
|
||||
--- tests/xbps/xbps-alternatives/main.sh
|
||||
+++ tests/xbps/xbps-alternatives/main.sh
|
||||
@@ -36,7 +36,7 @@ register_one_dangling_head() {
|
||||
register_one_dangling_body() {
|
||||
mkdir -p repo pkg_A/usr/bin
|
||||
cd repo
|
||||
- xbps-create -A noarch -n A-1.1_1 -s "A pkg" --alternatives "file:/usr/bin/file:/usr/bin/fileA file2:file2:/usr/include/fileB" ../pkg_A
|
||||
+ xbps-create -A noarch -n A-1.1_1 -s "A pkg" --alternatives "file:/usr/bin/file:/usr/bin/fileA file2:/usr/lib/fileB:/usr/include/fileB" ../pkg_A
|
||||
atf_check_equal $? 0
|
||||
xbps-rindex -d -a $PWD/*.xbps
|
||||
atf_check_equal $? 0
|
||||
@@ -54,9 +54,9 @@ register_one_dangling_body() {
|
||||
fi
|
||||
atf_check_equal $rv 0
|
||||
rv=1
|
||||
- if [ -h root/usr/include/file2 ]; then
|
||||
- lnk=$(readlink root/usr/include/file2)
|
||||
- if [ "$lnk" = "fileB" ]; then
|
||||
+ if [ -h root/usr/lib/fileB ]; then
|
||||
+ lnk=$(readlink -f root/usr/lib/fileB)
|
||||
+ if [ "$lnk" = "$PWD/root/usr/include/fileB" ]; then
|
||||
rv=0
|
||||
fi
|
||||
echo "A lnk: $lnk"
|
||||
From 93b50bc4dca1bb53d26cb0689d27e3c57f656e46 Mon Sep 17 00:00:00 2001
|
||||
From: Juan RP <xtraeme@voidlinux.eu>
|
||||
Date: Tue, 17 Nov 2015 16:32:12 +0100
|
||||
Subject: [PATCH] alternatives: preserve order while updating pkgs (thanks
|
||||
chris2/duncaen).
|
||||
|
||||
---
|
||||
NEWS | 2 ++
|
||||
lib/package_alternatives.c | 8 ++++-
|
||||
lib/package_remove.c | 3 ++
|
||||
tests/xbps/xbps-alternatives/main.sh | 57 ++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 69 insertions(+), 1 deletion(-)
|
||||
|
||||
--- lib/package_alternatives.c
|
||||
+++ lib/package_alternatives.c
|
||||
@@ -309,6 +309,7 @@ xbps_alternatives_unregister(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
|
||||
xbps_dictionary_t alternatives, pkg_alternatives;
|
||||
const char *pkgver;
|
||||
char *pkgname;
|
||||
+ bool update = false;
|
||||
int rv = 0;
|
||||
|
||||
assert(xhp);
|
||||
@@ -325,6 +326,8 @@ xbps_alternatives_unregister(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
|
||||
if ((pkgname = xbps_pkg_name(pkgver)) == NULL)
|
||||
return EINVAL;
|
||||
|
||||
+ xbps_dictionary_get_bool(pkgd, "alternatives-update", &update);
|
||||
+
|
||||
allkeys = xbps_dictionary_all_keys(pkg_alternatives);
|
||||
for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) {
|
||||
xbps_array_t array;
|
||||
@@ -347,9 +350,12 @@ xbps_alternatives_unregister(struct xbps_handle *xhp, xbps_dictionary_t pkgd)
|
||||
if (rv != 0)
|
||||
break;
|
||||
}
|
||||
+
|
||||
xbps_set_cb_state(xhp, XBPS_STATE_ALTGROUP_REMOVED, 0, NULL,
|
||||
"%s: unregistered '%s' alternatives group", pkgver, keyname);
|
||||
- xbps_remove_string_from_array(array, pkgname);
|
||||
+ if (!update)
|
||||
+ xbps_remove_string_from_array(array, pkgname);
|
||||
+
|
||||
if (xbps_array_count(array) == 0) {
|
||||
xbps_dictionary_remove(alternatives, keyname);
|
||||
} else {
|
||||
--- lib/package_remove.c
|
||||
+++ lib/package_remove.c
|
||||
@@ -319,6 +319,9 @@ xbps_remove_pkg(struct xbps_handle *xhp, const char *pkgver, bool update)
|
||||
goto out;
|
||||
|
||||
/* unregister alternatives */
|
||||
+ if (update)
|
||||
+ xbps_dictionary_set_bool(pkgd, "alternatives-update", true);
|
||||
+
|
||||
if ((rv = xbps_alternatives_unregister(xhp, pkgd)) != 0)
|
||||
goto out;
|
||||
|
||||
--- tests/xbps/xbps-alternatives/main.sh
|
||||
+++ tests/xbps/xbps-alternatives/main.sh
|
||||
@@ -373,6 +373,62 @@ set_pkg_group_body() {
|
||||
|
||||
}
|
||||
|
||||
+atf_test_case update_pkgs
|
||||
+
|
||||
+update_pkgs_head() {
|
||||
+ atf_set "descr" "xbps-alternatives: preserve order in updates"
|
||||
+}
|
||||
+update_pkgs_body() {
|
||||
+ mkdir -p repo pkg_A/usr/bin pkg_B/usr/bin
|
||||
+ touch pkg_A/usr/bin/A1 pkg_B/usr/bin/B1
|
||||
+ cd repo
|
||||
+ xbps-create -A noarch -n A-1.1_1 -s "A pkg" --alternatives "1:1:/usr/bin/A1" ../pkg_A
|
||||
+ atf_check_equal $? 0
|
||||
+ xbps-create -A noarch -n B-1.1_1 -s "B pkg" --alternatives "1:1:/usr/bin/B1" ../pkg_B
|
||||
+ atf_check_equal $? 0
|
||||
+ xbps-rindex -d -a $PWD/*.xbps
|
||||
+ atf_check_equal $? 0
|
||||
+ cd ..
|
||||
+
|
||||
+ xbps-install -r root --repository=repo -ydv A B
|
||||
+ atf_check_equal $? 0
|
||||
+
|
||||
+ rv=1
|
||||
+ if [ -e root/usr/bin/A1 ]; then
|
||||
+ lnk=$(readlink -f root/usr/bin/1)
|
||||
+ if [ "$lnk" = "$PWD/root/usr/bin/A1" ]; then
|
||||
+ rv=0
|
||||
+ fi
|
||||
+ echo "lnk: $lnk"
|
||||
+ fi
|
||||
+ atf_check_equal $rv 0
|
||||
+
|
||||
+ cd repo
|
||||
+ xbps-create -A noarch -n A-1.2_1 -s "A pkg" --alternatives "1:1:/usr/bin/A1" ../pkg_A
|
||||
+ atf_check_equal $? 0
|
||||
+ xbps-create -A noarch -n B-1.2_1 -s "B pkg" --alternatives "1:1:/usr/bin/B1" ../pkg_B
|
||||
+ atf_check_equal $? 0
|
||||
+ xbps-rindex -d -a $PWD/*.xbps
|
||||
+ atf_check_equal $? 0
|
||||
+ cd ..
|
||||
+
|
||||
+ xbps-alternatives -r root -s B
|
||||
+ atf_check_equal $? 0
|
||||
+
|
||||
+ xbps-install -r root --repository=repo -yuvd
|
||||
+ atf_check_equal $? 0
|
||||
+
|
||||
+ rv=1
|
||||
+ if [ -e root/usr/bin/B1 ]; then
|
||||
+ lnk=$(readlink -f root/usr/bin/1)
|
||||
+ if [ "$lnk" = "$PWD/root/usr/bin/B1" ]; then
|
||||
+ rv=0
|
||||
+ fi
|
||||
+ echo "lnk: $lnk"
|
||||
+ fi
|
||||
+ atf_check_equal $rv 0
|
||||
+}
|
||||
+
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case register_one
|
||||
atf_add_test_case register_one_dangling
|
||||
@@ -384,4 +440,5 @@ atf_init_test_cases() {
|
||||
atf_add_test_case unregister_multi
|
||||
atf_add_test_case set_pkg
|
||||
atf_add_test_case set_pkg_group
|
||||
+ atf_add_test_case update_pkgs
|
||||
}
|
||||
--
|
||||
2.6.3
|
||||
|
|
@ -1,178 +0,0 @@
|
|||
--- lib/transaction_conflicts.c
|
||||
+++ lib/transaction_conflicts.c
|
||||
@@ -39,16 +39,16 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
||||
xbps_dictionary_t pkgd, tpkgd;
|
||||
xbps_object_t obj;
|
||||
xbps_object_iterator_t iter;
|
||||
- const char *cfpkg, *repopkgver, *pkgver, *atract;
|
||||
+ const char *cfpkg, *repopkgver, *pkgver, *tract;
|
||||
char *pkgname, *repopkgname, *buf;
|
||||
|
||||
pkg_cflicts = xbps_dictionary_get(pkg_repod, "conflicts");
|
||||
if (xbps_array_count(pkg_cflicts) == 0)
|
||||
return;
|
||||
|
||||
- if (xbps_dictionary_get_cstring_nocopy(pkg_repod, "transaction", &atract)) {
|
||||
- /* ignore pkgs to be removed */
|
||||
- if (strcmp(atract, "remove") == 0)
|
||||
+ if (xbps_dictionary_get_cstring_nocopy(pkg_repod, "transaction", &tract)) {
|
||||
+ /* ignore pkgs to be removed or on hold */
|
||||
+ if (!strcmp(tract, "remove") || !strcmp(tract, "hold"))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,6 +68,11 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
||||
*/
|
||||
if ((pkgd = xbps_pkgdb_get_pkg(xhp, cfpkg)) ||
|
||||
(pkgd = xbps_pkgdb_get_virtualpkg(xhp, cfpkg))) {
|
||||
+ /* If the conflicting pkg is on hold, ignore it */
|
||||
+ if (xbps_dictionary_get(pkgd, "hold"))
|
||||
+ continue;
|
||||
+
|
||||
+ /* Ignore itself */
|
||||
xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||
"pkgver", &pkgver);
|
||||
pkgname = xbps_pkg_name(pkgver);
|
||||
@@ -81,11 +86,11 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
||||
* ignore it.
|
||||
*/
|
||||
if ((tpkgd = xbps_find_pkg_in_array(array, pkgname, NULL))) {
|
||||
- const char *tract;
|
||||
-
|
||||
xbps_dictionary_get_cstring_nocopy(tpkgd,
|
||||
"transaction", &tract);
|
||||
- if (strcmp(tract, "remove")) {
|
||||
+ if (!strcmp(tract, "install") ||
|
||||
+ !strcmp(tract, "update") ||
|
||||
+ !strcmp(tract, "hold")) {
|
||||
free(pkgname);
|
||||
continue;
|
||||
}
|
||||
@@ -93,7 +98,7 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
||||
free(pkgname);
|
||||
xbps_dbg_printf(xhp, "found conflicting installed "
|
||||
"pkg %s with pkg in transaction %s "
|
||||
- "(matched by %s)\n", pkgver, repopkgver, cfpkg);
|
||||
+ "(matched by %s [trans])\n", pkgver, repopkgver, cfpkg);
|
||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||
"installed pkg %s (matched by %s)",
|
||||
repopkgver, pkgver, cfpkg);
|
||||
@@ -108,6 +113,13 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
||||
*/
|
||||
if ((pkgd = xbps_find_pkg_in_array(array, cfpkg, NULL)) ||
|
||||
(pkgd = xbps_find_virtualpkg_in_array(xhp, array, cfpkg, NULL))) {
|
||||
+ /* ignore pkgs to be removed or on hold */
|
||||
+ if (xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||
+ "transaction", &tract)) {
|
||||
+ if (!strcmp(tract, "remove") || !strcmp(tract, "hold"))
|
||||
+ continue;
|
||||
+ }
|
||||
+ /* ignore itself */
|
||||
xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||
"pkgver", &pkgver);
|
||||
pkgname = xbps_pkg_name(pkgver);
|
||||
@@ -118,11 +130,11 @@ pkg_conflicts_trans(struct xbps_handle *xhp, xbps_array_t array,
|
||||
}
|
||||
free(pkgname);
|
||||
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
||||
- "transaction %s <-> %s (matched by %s)\n",
|
||||
+ "transaction %s <-> %s (matched by %s [trans])\n",
|
||||
pkgver, repopkgver, cfpkg);
|
||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||
- "%s in transaction (mached by %s)",
|
||||
- repopkgver, pkgver);
|
||||
+ "%s in transaction (matched by %s)",
|
||||
+ repopkgver, pkgver, cfpkg);
|
||||
if (!xbps_match_string_in_array(trans_cflicts, buf))
|
||||
xbps_array_add_cstring(trans_cflicts, buf);
|
||||
|
||||
@@ -142,7 +154,7 @@ pkgdb_conflicts_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
||||
xbps_dictionary_t pkgd;
|
||||
xbps_object_t obj2;
|
||||
xbps_object_iterator_t iter;
|
||||
- const char *cfpkg, *repopkgver, *pkgver;
|
||||
+ const char *cfpkg, *repopkgver, *pkgver, *tract;
|
||||
char *pkgname, *repopkgname, *buf;
|
||||
|
||||
pkg_cflicts = xbps_dictionary_get(obj, "conflicts");
|
||||
@@ -169,6 +181,13 @@ pkgdb_conflicts_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
||||
(pkgd = xbps_find_virtualpkg_in_array(xhp, pkgs, cfpkg, NULL))) {
|
||||
xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||
"pkgver", &pkgver);
|
||||
+ /* ignore pkgs to be removed or on hold */
|
||||
+ if (xbps_dictionary_get_cstring_nocopy(pkgd,
|
||||
+ "transaction", &tract)) {
|
||||
+ if (!strcmp(tract, "remove") || !strcmp(tract, "hold"))
|
||||
+ continue;
|
||||
+ }
|
||||
+ /* ignore itself */
|
||||
pkgname = xbps_pkg_name(pkgver);
|
||||
assert(pkgname);
|
||||
if (strcmp(pkgname, repopkgname) == 0) {
|
||||
@@ -177,7 +196,7 @@ pkgdb_conflicts_cb(struct xbps_handle *xhp, xbps_object_t obj,
|
||||
}
|
||||
free(pkgname);
|
||||
xbps_dbg_printf(xhp, "found conflicting pkgs in "
|
||||
- "transaction %s <-> %s (matched by %s)\n",
|
||||
+ "transaction %s <-> %s (matched by %s [pkgdb])\n",
|
||||
pkgver, repopkgver, cfpkg);
|
||||
buf = xbps_xasprintf("CONFLICT: %s with "
|
||||
"%s in transaction (matched by %s)",
|
||||
--- tests/xbps/libxbps/shell/conflicts.sh
|
||||
+++ tests/xbps/libxbps/shell/conflicts.sh
|
||||
@@ -27,6 +27,47 @@ conflicts_trans_body() {
|
||||
atf_check_equal $(xbps-query -r root -l|wc -l) 0
|
||||
}
|
||||
|
||||
+conflicts_trans_hold_head() {
|
||||
+ atf_set "descr" "Tests for pkg conflicts: conflicting pkg with on-hold installed pkg"
|
||||
+}
|
||||
+
|
||||
+conflicts_trans_hold_body() {
|
||||
+ mkdir some_repo
|
||||
+ mkdir -p pkg_{A,B}/usr/bin
|
||||
+ cd some_repo
|
||||
+ xbps-create -A noarch -n A-1.0_1 -s "A pkg" --conflicts "vpkg>19_1" ../pkg_A
|
||||
+ atf_check_equal $? 0
|
||||
+ xbps-create -A noarch -n B-1.0_1 -s "B pkg" --provides "vpkg-19_1" ../pkg_B
|
||||
+ atf_check_equal $? 0
|
||||
+ xbps-rindex -d -a $PWD/*.xbps
|
||||
+ atf_check_equal $? 0
|
||||
+ cd ..
|
||||
+
|
||||
+ xbps-install -r root --repository=$PWD/some_repo -dy A B
|
||||
+ atf_check_equal $? 0
|
||||
+
|
||||
+ cd some_repo
|
||||
+ xbps-create -A noarch -n A-1.1_1 -s "A pkg" --conflicts "vpkg>19_1" ../pkg_B
|
||||
+ atf_check_equal $? 0
|
||||
+ xbps-create -A noarch -n B-1.1_1 -s "B pkg" --provides "vpkg-20_1" ../pkg_B
|
||||
+ atf_check_equal $? 0
|
||||
+ xbps-rindex -d -a $PWD/*.xbps
|
||||
+ atf_check_equal $? 0
|
||||
+ cd ..
|
||||
+
|
||||
+ echo "B updated to 1.1_1"
|
||||
+ xbps-install -r root --repository=$PWD/some_repo -dyuv B
|
||||
+ atf_check_equal $? 11
|
||||
+
|
||||
+ echo "B is now on hold"
|
||||
+ xbps-pkgdb -r root -m hold B
|
||||
+ xbps-install -r root --repository=$PWD/some_repo -dyuv
|
||||
+ atf_check_equal $? 0
|
||||
+
|
||||
+ atf_check_equal $(xbps-query -r root -p pkgver A) A-1.1_1
|
||||
+ atf_check_equal $(xbps-query -r root -p pkgver B) B-1.0_1
|
||||
+}
|
||||
+
|
||||
atf_test_case conflicts_trans_vpkg
|
||||
|
||||
conflicts_trans_vpkg_head() {
|
||||
@@ -242,6 +283,7 @@ conflicts_trans_installed_multi_body() {
|
||||
|
||||
atf_init_test_cases() {
|
||||
atf_add_test_case conflicts_trans
|
||||
+ atf_add_test_case conflicts_trans_hold
|
||||
atf_add_test_case conflicts_trans_vpkg
|
||||
atf_add_test_case conflicts_trans_multi
|
||||
atf_add_test_case conflicts_trans_installed
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'xbps'
|
||||
pkgname=xbps
|
||||
version=0.50
|
||||
revision=5
|
||||
version=0.51
|
||||
revision=1
|
||||
bootstrap=yes
|
||||
build_style=configure
|
||||
short_desc="The XBPS package system utilities"
|
||||
|
@ -9,11 +9,12 @@ maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
|||
homepage="https://github.com/voidlinux/xbps"
|
||||
license="2-clause-BSD"
|
||||
distfiles="https://github.com/voidlinux/xbps/archive/$version.tar.gz"
|
||||
checksum=d8a8b7a62d7b3da16d457dc703f6acfa3ebe97c59b25e39544361330ed82650d
|
||||
checksum=fb97f78a2d1e78ca7fb74426bbc7edac7af36366491dbcf3b97db3aa1b20a8b7
|
||||
|
||||
hostmakedepends="pkg-config"
|
||||
makedepends="zlib-devel libressl-devel libarchive-devel"
|
||||
depends="ca-certificates xbps-triggers"
|
||||
|
||||
# xbps needs symbols from glibc-2.22
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
*-musl) : ;;
|
||||
|
|
Loading…
Reference in a new issue