97 lines
2.9 KiB
Diff
97 lines
2.9 KiB
Diff
From 21f32a75c5d95dc2e1917c56a99aef17dc3054d6 Mon Sep 17 00:00:00 2001
|
|
From: Juan RP <xtraeme@gmail.com>
|
|
Date: Tue, 1 Jul 2014 15:35:55 +0200
|
|
Subject: [PATCH] Fixed a new issue with vpkgs replacing the same vpkg they are
|
|
providing.
|
|
|
|
Added a new testcase to verify its correctness.
|
|
---
|
|
NEWS | 5 ++++
|
|
lib/transaction_sortdeps.c | 3 ++-
|
|
tests/xbps/libxbps/shell/vpkg_test.sh | 46 ++++++++++++++++++++++++++++++++---
|
|
3 files changed, 49 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/lib/transaction_sortdeps.c b/lib/transaction_sortdeps.c
|
|
index c7114dd..05652af 100644
|
|
--- lib/transaction_sortdeps.c
|
|
+++ lib/transaction_sortdeps.c
|
|
@@ -316,7 +316,8 @@ xbps_transaction_sort(struct xbps_handle *xhp)
|
|
}
|
|
}
|
|
}
|
|
- if (!vpkg_found && (pd = pkgdep_find(pkgver)) == NULL) {
|
|
+ pd = pkgdep_find(pkgver);
|
|
+ if ((!strcmp(tract, "remove") || (!pd && !vpkg_found))) {
|
|
/*
|
|
* If package not in list, just add to the tail.
|
|
*/
|
|
diff --git a/tests/xbps/libxbps/shell/vpkg_test.sh b/tests/xbps/libxbps/shell/vpkg_test.sh
|
|
index 2b3ba95..ba311bc 100644
|
|
--- tests/xbps/libxbps/shell/vpkg_test.sh
|
|
+++ tests/xbps/libxbps/shell/vpkg_test.sh
|
|
@@ -13,13 +13,13 @@
|
|
# D should replace A only if it has "replaces" property on A. The result should be
|
|
# that D must be installed and A being as is.
|
|
|
|
-atf_test_case vpkg_noupdate
|
|
+atf_test_case vpkg00
|
|
|
|
-vpkg_noupdate_head() {
|
|
+vpkg00_head() {
|
|
atf_set "descr" "Tests for virtual pkgs: don't update vpkg"
|
|
}
|
|
|
|
-vpkg_noupdate_body() {
|
|
+vpkg00_body() {
|
|
mkdir some_repo
|
|
mkdir -p pkg_{A,B,C,D}/usr/bin
|
|
cd some_repo
|
|
@@ -42,6 +42,44 @@ vpkg_noupdate_body() {
|
|
atf_check_equal $? 0
|
|
}
|
|
|
|
+atf_test_case vpkg01
|
|
+
|
|
+vpkg01_head() {
|
|
+ atf_set "descr" "Tests for virtual pkgs: commit ebc0f27ae1c"
|
|
+}
|
|
+
|
|
+vpkg01_body() {
|
|
+ mkdir some_repo
|
|
+ mkdir -p pkg_{A,B,C,D}/usr/bin
|
|
+ mkdir -p pkg_C/usr/share/xbps/virtualpkg.d
|
|
+ echo "virtualpkg=A-1.0_1:C" > pkg_C/usr/share/xbps/virtualpkg.d/C.conf
|
|
+ cd some_repo
|
|
+ xbps-create -A noarch -n A-1.0_1 -s "A pkg" ../pkg_A
|
|
+ atf_check_equal $? 0
|
|
+ xbps-create -A noarch -n B-1.0_1 -s "B pkg" --dependencies "A>=0" ../pkg_B
|
|
+ atf_check_equal $? 0
|
|
+ xbps-create -A noarch -n C-1.0_1 -s "C pkg" --provides "A-1.0_1" --replaces="A>=0" ../pkg_C
|
|
+ atf_check_equal $? 0
|
|
+ xbps-create -A noarch -n D-1.0_1 -s "D pkg" --dependencies "C>=0" ../pkg_D
|
|
+ atf_check_equal $? 0
|
|
+
|
|
+ xbps-rindex -a *.xbps
|
|
+ atf_check_equal $? 0
|
|
+ cd ..
|
|
+
|
|
+ xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy B
|
|
+ atf_check_equal $? 0
|
|
+ xbps-install -C empty.conf -r root --repository=$PWD/some_repo -dy D
|
|
+ atf_check_equal $? 0
|
|
+
|
|
+ out=$(xbps-query -C empty.conf -r root -l|awk '{print $2}'|tr -d '\n')
|
|
+ exp="B-1.0_1C-1.0_1D-1.0_1"
|
|
+ echo "out: $out"
|
|
+ echo "exp: $exp"
|
|
+ atf_check_equal $out $exp
|
|
+}
|
|
+
|
|
atf_init_test_cases() {
|
|
- atf_add_test_case vpkg_noupdate
|
|
+ atf_add_test_case vpkg00
|
|
+ atf_add_test_case vpkg01
|
|
}
|
|
--
|
|
2.0.1
|
|
|