Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix autoremove when used with -q, which fixes #1399
Brad Davis committed 10 years ago
commit c03c89d2ab078efa64ca8de0b070bf918046c360
parent 8670022
2 files changed +25 -2
modified src/autoremove.c
@@ -138,7 +138,10 @@ exec_autoremove(int argc, char **argv)
			rc = query_yesno(false,
		            "\nProceed with deinstalling packages? ");
	}
-
	if (!rc || dry_run || (retcode = pkg_jobs_apply(jobs)) != EPKG_OK) {
+
//printf("yes: %d\n", yes);
+
//printf("rc: %d\n", rc);
+
//printf("dry_run: %d\n", dry_run);
+
	if ((yes || rc ) && !dry_run && ((retcode = pkg_jobs_apply(jobs)) != EPKG_OK)) {
		goto cleanup;
	}

modified tests/frontend/autoremove.sh
@@ -4,7 +4,8 @@

tests_init \
	autoremove \
-
	autoremove_quiet
+
	autoremove_quiet \
+
	autoremove_dryrun

autoremove_prep() {
	touch file1
@@ -102,3 +103,22 @@ autoremove_quiet_body() {

	test ! -f ${TMPDIR}/file1 -o ! -f ${TMPDIR}/file2 || atf_fail "Files are still present"
}
+

+
autoremove_dryrun_body() {
+
	autoremove_prep
+

+
	atf_check \
+
	    -o match:"^Installed packages to be REMOVED:$" \
+
	    -o match:"^	test-1$" \
+
	    -e empty \
+
	    -s exit:0 \
+
	    pkg autoremove -yn
+

+
	atf_check \
+
	    -o match:"^test-1                         a test$" \
+
	    -e empty \
+
	    -s exit:0 \
+
	    pkg info
+

+
	test -f ${TMPDIR}/file1 -o -f ${TMPDIR}/file2 || atf_fail "Files are missing"
+
}