-
Notifications
You must be signed in to change notification settings - Fork 138
lib: handle replaces if replaced pkg is installed in the same transaction #668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
lib: handle replaces if replaced pkg is installed in the same transaction #668
Conversation
…tion replaces isn't honoured if the package to be replaced is currently being installed. This fixes a corner case where a transitional package could be installed along with its replacement, when it should be "ignored" and only the new package installed. This requires transaction commits to not fail if a replaced package isn't installed when it should be "removed". Also, indicate to the user that a package is being replaced, with details about what replaced what shown in verbose output, not just debug output. fixes: void-linux#667
43ac61f to
7b9f9c8
Compare
|
Another test case (passing) for pair replacing each other, like diff --git a/tests/xbps/libxbps/shell/replace_test.sh b/tests/xbps/libxbps/shell/replace_test.sh
index 0efbbfd0..741f379e 100644
--- a/tests/xbps/libxbps/shell/replace_test.sh
+++ b/tests/xbps/libxbps/shell/replace_test.sh
@@ -421,6 +421,32 @@ replace_transitional_pkg_automatically_installed3_body() {
atf_test_case replace_transitional_pkg_during_install
+dont_replace_alternative_pkg_during_install_head() {
+ atf_set "descr" "Tests for package replace: install a package that has a pair replacing each other"
+}
+
+dont_replace_alternative_pkg_during_install_body() {
+ mkdir some_repo root
+ mkdir -p pkg_A/usr/bin empty
+ echo "A-1.0_1" > pkg_A/usr/bin/foo
+ cd some_repo
+ xbps-create -A noarch -n A-1.0_1 -s "A pkg" --replaces "B>=0" ../pkg_A
+ atf_check_equal $? 0
+ xbps-create -A noarch -n B-1.0_1 -s "B pkg" --replaces "A>=0" ../pkg_A
+ atf_check_equal $? 0
+ xbps-rindex -d -a $PWD/*.xbps
+ atf_check_equal $? 0
+ cd ..
+ xbps-install -C xbps.d -r root --repository=$PWD/some_repo -yd B
+ atf_check_equal $? 0
+ result=$(xbps-query -r root -l | wc -l)
+ atf_check_equal $result 1
+ atf_check_equal $(xbps-query -C xbps.d -r root -p state A) ""
+ atf_check_equal $(xbps-query -C xbps.d -r root -p state B) installed
+}
+
+atf_test_case replace_transitional_pkg_during_install
+
replace_transitional_pkg_during_install_head() {
atf_set "descr" "Tests for package replace: install a transitional package and replace it during the transaction"
}
@@ -627,6 +653,7 @@ atf_init_test_cases() {
atf_add_test_case replace_transitional_pkg_automatically_installed2
atf_add_test_case replace_transitional_pkg_automatically_installed3
atf_add_test_case replace_transitional_pkg_during_install
+ atf_add_test_case dont_replace_alternative_pkg_during_install
atf_add_test_case replace_automatically_installed_dep
atf_add_test_case replace_automatically_installed_dep2
atf_add_test_case replace_automatically_installed_dep3 |
|
shouldn't that test try installing A and B at once? |
|
That's another case, add it if you wish. I meant to make sure A won't replace B as they have |
Co-authored-by: Piotr Wójcik <[email protected]>
|
hmm, looks like on the latest release, not sure how that would be best solved. |
replacesisn't honoured if the package to be replaced is currently being installed. This fixes a corner case where a transitional package could be installed along with its replacement, when it should be "ignored" and only the new package installed.This requires transaction commits to not fail if a replaced package isn't installed when it should be "removed".
Also, indicate to the user that a package is being replaced, with details about what replaced what shown in verbose output, not just debug output.
fixes: #667
both installed at once:
updating to transitional: