mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-08 08:03:51 +02:00
xbps{,-static}: patch from master for another alternatives bugfix.
This commit is contained in:
parent
938adfa1e8
commit
25e60c9dc0
3 changed files with 93 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
||||||
# NOTE: keep this package synchronized with "srcpkgs/xbps".
|
# NOTE: keep this package synchronized with "srcpkgs/xbps".
|
||||||
pkgname=xbps-static
|
pkgname=xbps-static
|
||||||
version=0.50
|
version=0.50
|
||||||
revision=2
|
revision=3
|
||||||
build_style=configure
|
build_style=configure
|
||||||
short_desc="The XBPS package system utilities - static binaries"
|
short_desc="The XBPS package system utilities - static binaries"
|
||||||
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
From b3c7d27c6b9ffddda9914a9110680df91c6b17ff Mon Sep 17 00:00:00 2001
|
||||||
|
From: Juan RP <xtraeme@voidlinux.eu>
|
||||||
|
Date: Sat, 14 Nov 2015 07:26:27 +0100
|
||||||
|
Subject: [PATCH 1/2] alternatives: fix creation of symlinks with unexistent
|
||||||
|
dirs.
|
||||||
|
|
||||||
|
If an alternative needs to create /usr/bin/foo, and /usr/bin
|
||||||
|
does not exist, this directory must be created prior to create
|
||||||
|
the symlink.
|
||||||
|
---
|
||||||
|
lib/package_alternatives.c | 24 +++++++++++++++++++++++-
|
||||||
|
tests/xbps/xbps-alternatives/main.sh | 8 ++++----
|
||||||
|
2 files changed, 27 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/lib/package_alternatives.c b/lib/package_alternatives.c
|
||||||
|
index e4d94e3..510b536 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;
|
||||||
|
@@ -171,12 +171,34 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
||||||
|
xbps_dbg_printf(xhp, "failed to create symlink"
|
||||||
|
"target dir '%s' for group '%s': %s\n",
|
||||||
|
tgt, grname, strerror(errno));
|
||||||
|
+ free(tgt_dup);
|
||||||
|
free(tgt);
|
||||||
|
free(l);
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(tgt);
|
||||||
|
+ /* always create link dir, for dangling symlinks */
|
||||||
|
+ lnk_dup = strdup(l);
|
||||||
|
+ assert(lnk_dup);
|
||||||
|
+ lnk_dir = dirname(lnk_dup);
|
||||||
|
+ 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(tgt);
|
||||||
|
+ 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"
|
||||||
|
--
|
||||||
|
2.6.3
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'xbps'
|
# Template file for 'xbps'
|
||||||
pkgname=xbps
|
pkgname=xbps
|
||||||
version=0.50
|
version=0.50
|
||||||
revision=2
|
revision=3
|
||||||
bootstrap=yes
|
bootstrap=yes
|
||||||
build_style=configure
|
build_style=configure
|
||||||
short_desc="The XBPS package system utilities"
|
short_desc="The XBPS package system utilities"
|
||||||
|
|
Loading…
Add table
Reference in a new issue