xbps: merge patch from master to fix the new vpkg issue.

This commit is contained in:
Juan RP 2014-07-01 15:42:17 +02:00
parent 08f63bb20b
commit 7dc4c95423
2 changed files with 98 additions and 1 deletions

View File

@ -0,0 +1,97 @@
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

View File

@ -1,7 +1,7 @@
# Template file for 'xbps'
pkgname=xbps
version=0.37
revision=3
revision=4
bootstrap=yes
short_desc="The XBPS package system utilities"
maintainer="Juan RP <xtraeme@gmail.com>"