93 lines
3.1 KiB
Diff
93 lines
3.1 KiB
Diff
From d7633e88e0bf25cd2c319ac1c0706fe69bfd5885 Mon Sep 17 00:00:00 2001
|
|
From: Juan RP <xtraeme@gmail.com>
|
|
Date: Fri, 17 Oct 2014 09:52:32 +0200
|
|
Subject: [PATCH 02/13] Fix #62 (Dup replaced pkgs in transaction)
|
|
|
|
---
|
|
NEWS | 3 +++
|
|
lib/transaction_package_replace.c | 3 +--
|
|
tests/xbps/libxbps/shell/replace_test.sh | 40 ++++++++++++++++++++++++++++++++
|
|
3 files changed, 44 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/lib/transaction_package_replace.c b/lib/transaction_package_replace.c
|
|
index 56048f8..2eebd51 100644
|
|
--- lib/transaction_package_replace.c
|
|
+++ lib/transaction_package_replace.c
|
|
@@ -103,14 +103,13 @@ xbps_transaction_package_replace(struct xbps_handle *xhp)
|
|
*/
|
|
xbps_dictionary_get_bool(instd, "automatic-install", &instd_auto);
|
|
if ((reppkgd = xbps_find_pkg_in_array(unsorted, curpkgname, NULL))) {
|
|
- xbps_dictionary_set_bool(instd,
|
|
- "remove-and-update", true);
|
|
xbps_dictionary_set_bool(reppkgd,
|
|
"automatic-install", instd_auto);
|
|
xbps_dictionary_set_bool(reppkgd,
|
|
"skip-obsoletes", true);
|
|
xbps_array_replace_dict_by_name(unsorted,
|
|
reppkgd, curpkgname);
|
|
+ continue;
|
|
}
|
|
/*
|
|
* If new package is providing a virtual package to the
|
|
diff --git a/tests/xbps/libxbps/shell/replace_test.sh b/tests/xbps/libxbps/shell/replace_test.sh
|
|
index 469b7f8..0e54dc2 100644
|
|
--- tests/xbps/libxbps/shell/replace_test.sh
|
|
+++ tests/xbps/libxbps/shell/replace_test.sh
|
|
@@ -37,6 +37,45 @@ replace_dups_body() {
|
|
atf_check_equal $(xbps-query -C empty.conf -r root -p state B) installed
|
|
}
|
|
|
|
+atf_test_case replace_ntimes
|
|
+
|
|
+replace_ntimes_head() {
|
|
+ atf_set "descr" "Tests for package replace: replacing installed pkg by multiple pkgs"
|
|
+}
|
|
+
|
|
+replace_ntimes_body() {
|
|
+ mkdir some_repo root
|
|
+ mkdir -p pkg_{A,B,C,D}/usr/bin
|
|
+ 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" ../pkg_B
|
|
+ atf_check_equal $? 0
|
|
+ xbps-create -A noarch -n C-1.0_1 -s "C pkg" ../pkg_C
|
|
+ atf_check_equal $? 0
|
|
+ xbps-create -A noarch -n D-1.0_1 -s "D pkg" ../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 -yd A B C D
|
|
+ atf_check_equal $? 0
|
|
+ cd some_repo
|
|
+ xbps-create -A noarch -n A-1.1_1 -s "A pkg" ../pkg_A
|
|
+ atf_check_equal $? 0
|
|
+ xbps-create -A noarch -n B-1.1_1 -s "B pkg" --replaces "A<1.1" ../pkg_B
|
|
+ atf_check_equal $? 0
|
|
+ xbps-create -A noarch -n C-1.1_1 -s "C pkg" --replaces "A<1.1" ../pkg_C
|
|
+ atf_check_equal $? 0
|
|
+ xbps-create -A noarch -n D-1.1_1 -s "D pkg" --replaces "A<1.1" ../pkg_D
|
|
+ atf_check_equal $? 0
|
|
+ xbps-rindex -a *.xbps
|
|
+ atf_check_equal $? 0
|
|
+ cd ..
|
|
+ result=$(xbps-install -C empty.conf -r root --repository=$PWD/some_repo -yun|wc -l)
|
|
+ atf_check_equal $result 4
|
|
+}
|
|
+
|
|
atf_test_case self_replace
|
|
|
|
self_replace_head() {
|
|
@@ -97,6 +136,7 @@ replace_vpkg_body() {
|
|
|
|
atf_init_test_cases() {
|
|
atf_add_test_case replace_dups
|
|
+ atf_add_test_case replace_ntimes
|
|
atf_add_test_case replace_vpkg
|
|
atf_add_test_case self_replace
|
|
}
|
|
--
|
|
2.1.2
|
|
|