[pacman-dev] [PATCH 3/3] pacman: move --nosave to transaction flags

morganamilo morganamilo at archlinux.org
Mon Sep 20 19:35:18 UTC 2021


--nosave is now useful when installing packages as it can be combined
with --nokeep to reinstall the packages backup files without generating
a pacsave.
---
 doc/pacman.8.asciidoc | 10 +++++-----
 src/pacman/pacman.c   | 11 ++++++-----
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/doc/pacman.8.asciidoc b/doc/pacman.8.asciidoc
index fd2aa21e..e880e054 100644
--- a/doc/pacman.8.asciidoc
+++ b/doc/pacman.8.asciidoc
@@ -210,6 +210,11 @@ Transaction Options (apply to '-S', '-R' and '-U')
 	dependencies are installed and there are no package conflicts in the
 	system. Specify this option twice to skip all dependency checks.
 
+*-n, \--nosave*::
+	Instructs pacman to ignore file backup designations. Normally, when a
+	file is removed from the system, the database is checked to see if the
+	file should be renamed with a '.pacsave' extension.
+
 *\--assume-installed* <package=version>::
 	Add a virtual package "package" with version "version" to the transaction
 	to satisfy dependencies. This allows to disable specific dependency checks
@@ -375,11 +380,6 @@ Remove Options (apply to '-R')[[RO]]
 	or more target packages. This operation is recursive and must be used
 	with care, since it can remove many potentially needed packages.
 
-*-n, \--nosave*::
-	Instructs pacman to ignore file backup designations. Normally, when a
-	file is removed from the system, the database is checked to see if the
-	file should be renamed with a '.pacsave' extension.
-
 *-s, \--recursive*::
 	Remove each target specified including all of their dependencies, provided
 	that (A) they are not required by other packages; and (B) they were not
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 262a2ad6..0647d5bc 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -123,7 +123,6 @@ static void usage(int op, const char * const myname)
 			printf("%s:  %s {-R --remove} [%s] <%s>\n", str_usg, myname, str_opt, str_pkg);
 			printf("%s:\n", str_opt);
 			addlist(_("  -c, --cascade        remove packages and all packages that depend on them\n"));
-			addlist(_("  -n, --nosave         remove configuration files\n"));
 			addlist(_("  -s, --recursive      remove unnecessary dependencies\n"
 			          "                       (-ss includes explicitly installed dependencies)\n"));
 			addlist(_("  -u, --unneeded       remove unneeded packages\n"));
@@ -200,6 +199,7 @@ static void usage(int op, const char * const myname)
 				__attribute__((fallthrough));
 			case PM_OP_REMOVE:
 				addlist(_("  -d, --nodeps         skip dependency version checks (-dd to skip all checks)\n"));
+				addlist(_("  -n, --nosave         remove configuration files\n"));
 				addlist(_("      --assume-installed <package=version>\n"
 				          "                       add a virtual package to satisfy dependencies\n"));
 				addlist(_("      --dbonly         only modify database entries, not package files\n"));
@@ -632,6 +632,11 @@ static int parsearg_trans(int opt)
 				config->flags |= ALPM_TRANS_FLAG_NODEPVERSION;
 			}
 			break;
+		case OP_NOSAVE:
+		case 'n':
+			config->flags |= ALPM_TRANS_FLAG_NOSAVE;
+			break;
+
 		case OP_DBONLY:
 			config->flags |= ALPM_TRANS_FLAG_DBONLY;
 			config->flags |= ALPM_TRANS_FLAG_NOSCRIPTLET;
@@ -681,10 +686,6 @@ static int parsearg_remove(int opt)
 		case 'c':
 			config->flags |= ALPM_TRANS_FLAG_CASCADE;
 			break;
-		case OP_NOSAVE:
-		case 'n':
-			config->flags |= ALPM_TRANS_FLAG_NOSAVE;
-			break;
 		case OP_RECURSIVE:
 		case 's':
 			if(config->flags & ALPM_TRANS_FLAG_RECURSE) {
-- 
2.33.0



More information about the pacman-dev mailing list