alternatives: really make relative symlinks this time.
This commit is contained in:
parent
b8abe80362
commit
512122da4c
2
NEWS
2
NEWS
@ -1,5 +1,7 @@
|
|||||||
xbps-0.50 (???):
|
xbps-0.50 (???):
|
||||||
|
|
||||||
|
* alternatives: really make relative symlinks this time.
|
||||||
|
|
||||||
xbps-0.49 (2015-10-31):
|
xbps-0.49 (2015-10-31):
|
||||||
|
|
||||||
* alternatives: relative symlinks are now supported. Contributed
|
* alternatives: relative symlinks are now supported. Contributed
|
||||||
|
@ -102,23 +102,28 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
|||||||
cnt = xbps_array_count(a);
|
cnt = xbps_array_count(a);
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
xbps_string_t str;
|
xbps_string_t str;
|
||||||
char *l, *lnk;
|
char *l, *lnk, *tgt;
|
||||||
const char *tgt;
|
const char *tgt0;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
str = xbps_array_get(a, i);
|
str = xbps_array_get(a, i);
|
||||||
l = left(xbps_string_cstring_nocopy(str));
|
l = left(xbps_string_cstring_nocopy(str));
|
||||||
assert(l);
|
assert(l);
|
||||||
tgt = right(xbps_string_cstring_nocopy(str));
|
tgt0 = right(xbps_string_cstring_nocopy(str));
|
||||||
assert(tgt);
|
assert(tgt);
|
||||||
if (l[0] != '/') {
|
if (l[0] != '/') {
|
||||||
char *tgt_dup, *tgt_dir;
|
char *tgt_dup, *tgt_dir;
|
||||||
tgt_dup = strdup(tgt);
|
tgt_dup = strdup(tgt0);
|
||||||
assert(tgt_dup);
|
assert(tgt_dup);
|
||||||
tgt_dir = dirname(tgt_dup);
|
tgt_dir = dirname(tgt_dup);
|
||||||
lnk = xbps_xasprintf("%s%s/%s", xhp->rootdir, tgt_dir, l);
|
lnk = xbps_xasprintf("%s%s/%s", xhp->rootdir, tgt_dir, l);
|
||||||
free(tgt_dup);
|
free(tgt_dup);
|
||||||
|
tgt_dup = strdup(tgt0);
|
||||||
|
assert(tgt_dup);
|
||||||
|
tgt = strdup(basename(tgt_dup));
|
||||||
|
free(tgt_dup);
|
||||||
} else {
|
} else {
|
||||||
|
tgt = strdup(tgt0);
|
||||||
lnk = xbps_xasprintf("%s%s", xhp->rootdir, l);
|
lnk = xbps_xasprintf("%s%s", xhp->rootdir, l);
|
||||||
}
|
}
|
||||||
xbps_set_cb_state(xhp, XBPS_STATE_ALTGROUP_LINK_ADDED, 0, NULL,
|
xbps_set_cb_state(xhp, XBPS_STATE_ALTGROUP_LINK_ADDED, 0, NULL,
|
||||||
@ -128,10 +133,12 @@ create_symlinks(struct xbps_handle *xhp, xbps_array_t a, const char *grname)
|
|||||||
xbps_dbg_printf(xhp, "failed to create alt symlink '%s'"
|
xbps_dbg_printf(xhp, "failed to create alt symlink '%s'"
|
||||||
"for group '%s': %s\n", lnk, grname,
|
"for group '%s': %s\n", lnk, grname,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
free(tgt);
|
||||||
free(lnk);
|
free(lnk);
|
||||||
free(l);
|
free(l);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
free(tgt);
|
||||||
free(lnk);
|
free(lnk);
|
||||||
free(l);
|
free(l);
|
||||||
}
|
}
|
||||||
|
@ -35,9 +35,9 @@ register_one_relative_head() {
|
|||||||
}
|
}
|
||||||
register_one_relative_body() {
|
register_one_relative_body() {
|
||||||
mkdir -p repo pkg_A/usr/bin
|
mkdir -p repo pkg_A/usr/bin
|
||||||
touch pkg_A/usr/bin/fileA pkg_A/usr/bin/fileB
|
touch pkg_A/usr/bin/fileA
|
||||||
cd repo
|
cd repo
|
||||||
xbps-create -A noarch -n A-1.1_1 -s "A pkg" --alternatives "file:../file:/usr/bin/fileA file2:file2:/usr/bin/fileB" ../pkg_A
|
xbps-create -A noarch -n A-1.1_1 -s "A pkg" --alternatives "file:file:/usr/bin/fileA" ../pkg_A
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
xbps-rindex -d -a $PWD/*.xbps
|
xbps-rindex -d -a $PWD/*.xbps
|
||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
@ -47,17 +47,8 @@ register_one_relative_body() {
|
|||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
rv=1
|
rv=1
|
||||||
if [ -e root/usr/bin/fileA ]; then
|
if [ -e root/usr/bin/fileA ]; then
|
||||||
lnk=$(readlink root/usr/file)
|
lnk=$(readlink root/usr/bin/file)
|
||||||
if [ "$lnk" = "/usr/bin/fileA" ]; then
|
if [ "$lnk" = "fileA" ]; then
|
||||||
rv=0
|
|
||||||
fi
|
|
||||||
echo "A lnk: $lnk"
|
|
||||||
fi
|
|
||||||
atf_check_equal $rv 0
|
|
||||||
rv=1
|
|
||||||
if [ -e root/usr/bin/fileB ]; then
|
|
||||||
lnk=$(readlink root/usr/bin/file2)
|
|
||||||
if [ "$lnk" = "/usr/bin/fileB" ]; then
|
|
||||||
rv=0
|
rv=0
|
||||||
fi
|
fi
|
||||||
echo "A lnk: $lnk"
|
echo "A lnk: $lnk"
|
||||||
@ -150,7 +141,7 @@ unregister_one_body() {
|
|||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
xbps-remove -r root -yvd A
|
xbps-remove -r root -yvd A
|
||||||
rv=1
|
rv=1
|
||||||
if [ ! -L root/usr/bin/file -a ! -e root/usr/bin/fileA ]; then
|
if [ ! -e root/usr/bin/file -a ! -e root/usr/bin/fileA ]; then
|
||||||
rv=0
|
rv=0
|
||||||
fi
|
fi
|
||||||
atf_check_equal $rv 0
|
atf_check_equal $rv 0
|
||||||
@ -175,7 +166,7 @@ unregister_one_relative_body() {
|
|||||||
atf_check_equal $? 0
|
atf_check_equal $? 0
|
||||||
xbps-remove -r root -yvd A
|
xbps-remove -r root -yvd A
|
||||||
rv=1
|
rv=1
|
||||||
if [ ! -L root/usr/bin/file -a ! -e root/usr/bin/fileA ]; then
|
if [ ! -e root/usr/bin/file -a ! -e root/usr/bin/fileA ]; then
|
||||||
rv=0
|
rv=0
|
||||||
fi
|
fi
|
||||||
atf_check_equal $rv 0
|
atf_check_equal $rv 0
|
||||||
@ -211,7 +202,7 @@ unregister_multi_body() {
|
|||||||
atf_check_equal $rv 0
|
atf_check_equal $rv 0
|
||||||
xbps-remove -r root -yvd A
|
xbps-remove -r root -yvd A
|
||||||
rv=1
|
rv=1
|
||||||
if [ ! -L root/usr/bin/file -a ! -e root/usr/bin/fileA ]; then
|
if [ ! -e root/usr/bin/file -a ! -e root/usr/bin/fileA ]; then
|
||||||
rv=0
|
rv=0
|
||||||
fi
|
fi
|
||||||
atf_check_equal $rv 0
|
atf_check_equal $rv 0
|
||||||
@ -230,7 +221,7 @@ unregister_multi_body() {
|
|||||||
|
|
||||||
xbps-remove -r root -yvd B
|
xbps-remove -r root -yvd B
|
||||||
rv=1
|
rv=1
|
||||||
if [ ! -L root/usr/bin/file -a ! -e root/usr/bin/fileB ]; then
|
if [ ! -e root/usr/bin/file -a ! -e root/usr/bin/fileB ]; then
|
||||||
rv=0
|
rv=0
|
||||||
fi
|
fi
|
||||||
atf_check_equal $rv 0
|
atf_check_equal $rv 0
|
||||||
|
Loading…
Reference in New Issue
Block a user