[pacman-dev] [PATCH] Remove -F/--freshen operation

Dan McGee dan at archlinux.org
Wed Nov 21 12:27:21 EST 2007


This operation made sense in the days before sync DBs existed, but it no
longer has the same usefulness it once did.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
 contrib/bash_completion |    6 ++----
 contrib/zsh_completion  |   11 +----------
 doc/pacman.8.txt        |    4 ----
 lib/libalpm/add.c       |   13 ++-----------
 lib/libalpm/alpm.h      |    2 +-
 pactest/tests/add030.py |   18 ------------------
 pactest/tests/add031.py |   18 ------------------
 pactest/tests/add032.py |   18 ------------------
 src/pacman/pacman.c     |   12 +-----------
 9 files changed, 7 insertions(+), 95 deletions(-)
 delete mode 100644 pactest/tests/add030.py
 delete mode 100644 pactest/tests/add031.py
 delete mode 100644 pactest/tests/add032.py

diff --git a/contrib/bash_completion b/contrib/bash_completion
index 6aafc9e..844396d 100644
--- a/contrib/bash_completion
+++ b/contrib/bash_completion
@@ -146,7 +146,7 @@ _pacman ()
     toparse="${a:2}"
 
     case "${arg}" in
-      -@(A|U|F|R|S|Q|h|V))
+      -@(A|U|R|S|Q|h|V))
         op="${arg/-}"
         mod="${mod}${a:2}"
         ;;
@@ -156,7 +156,6 @@ _pacman ()
           add) op="A" ;;
           remove) op="R" ;;
           upgrade) op="U" ;;
-          freshen) op="F" ;;
           query) op="Q" ;;
           sync) op="S" ;;
           help) op="h" ;;
@@ -204,7 +203,6 @@ _pacman ()
   if [ $COMP_CWORD -eq 1 ] && [[ "$cur" == -* ]]; then
     COMPREPLY=( $( compgen -W '\
       -A --add \
-      -F --freshen \
       -h --help \
       -Q --query \
       -R --remove \
@@ -218,7 +216,7 @@ _pacman ()
 
   if [[ "$cur" == -* ]]; then
     case "${op}" in
-      A|U|F)
+      A|U)
         COMPREPLY=( $( compgen -W '\
           --asdeps \
           -d --nodeps \
diff --git a/contrib/zsh_completion b/contrib/zsh_completion
index 4607bd7..566c39f 100644
--- a/contrib/zsh_completion
+++ b/contrib/zsh_completion
@@ -7,7 +7,6 @@ typeset -A opt_args
 # options for passing to _arguments: main pacman commands
 _pacman_opts_commands=(
 	'-A[Add a package to the system]'
-	'-F[Upgrade an installed package]'
 	'-Q[Query the package database]'
 	'-R[Remove a package from the system]'
 	'-S[Synchronize packages]'
@@ -26,7 +25,7 @@ _pacman_opts_common=(
 	'--noconfirm[Do not ask for confirmation]'
 )
 
-# options for passing to _arguments: options for --add, --freshen and --update commands
+# options for passing to _arguments: options for --add, and --update commands
 _pacman_opts_pkgfile=(
 	'-d[Skip dependency checks]'
 	'-f[Overwrite conflicting files]'
@@ -85,13 +84,6 @@ _pacman_action_add() {
 		"$_pacman_opts_pkgfile[@]"
 }
 
-# handles --freshen subcommand
-_pacman_action_freshen() {
-	_arguments -s : \
-		"$_pacman_opts_common[@]" \
-		"$_pacman_opts_pkgfile[@]"
-}
-
 # handles --help subcommand
 _pacman_action_help() {
 	_arguments -s : \
@@ -274,7 +266,6 @@ _pacman_get_command() {
 _pacman() {
 	case $words[2] in
 		-A*)  _pacman_action_add      ;;
-		-F*)  _pacman_action_freshen  ;;
 		-Qg) # ipkg groups
 			_arguments -s : \
 				"$_pacman_opts_common[@]" \
diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
index 7b10bc0..887f912 100644
--- a/doc/pacman.8.txt
+++ b/doc/pacman.8.txt
@@ -35,10 +35,6 @@ Operations
 	version is already installed. *NOTE*: please use '\--upgrade' in place of
 	this option.
 
-*-F, \--freshen*::
-	This is like '\--upgrade' except it will only upgrade packages already
-	installed on the system.
-
 *-Q, \--query*::
 	Query the package database. This operation allows you to view installed
 	packages and their files, as well as meta-information about individual
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index e6efe2d..0b40f95 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -76,19 +76,10 @@ int _alpm_add_loadtarget(pmtrans_t *trans, pmdb_t *db, char *name)
 			pm_errno = PM_ERR_PKG_INSTALLED;
 			goto error;
 		}
-	} else {
-		if(trans->flags & PM_TRANS_FLAG_FRESHEN) {
-			/* only upgrade/install this package if it is already installed and at a lesser version */
-			pmpkg_t *dummy = _alpm_db_get_pkgfromcache(db, pkgname);
-			if(dummy == NULL || _alpm_versioncmp(dummy->version, pkgver) >= 0) {
-				pm_errno = PM_ERR_PKG_CANT_FRESH;
-				goto error;
-			}
-		}
 	}
 
-	/* check if an older version of said package is already in transaction packages.
-	 * if so, replace it in the list */
+	/* check if an older version of said package is already in transaction
+	 * packages.  if so, replace it in the list */
 	for(i = trans->packages; i; i = i->next) {
 		pmpkg_t *pkg = i->data;
 		if(strcmp(pkg->name, pkgname) == 0) {
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index b56f575..76c7208 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -271,7 +271,7 @@ typedef enum _pmtransflag_t {
 	PM_TRANS_FLAG_NODEPS = 0x01,
 	PM_TRANS_FLAG_FORCE = 0x02,
 	PM_TRANS_FLAG_NOSAVE = 0x04,
-	PM_TRANS_FLAG_FRESHEN = 0x08,
+	/* 0x08 flag can go here */
 	PM_TRANS_FLAG_CASCADE = 0x10,
 	PM_TRANS_FLAG_RECURSE = 0x20,
 	PM_TRANS_FLAG_DBONLY = 0x40,
diff --git a/pactest/tests/add030.py b/pactest/tests/add030.py
deleted file mode 100644
index d36311c..0000000
--- a/pactest/tests/add030.py
+++ /dev/null
@@ -1,18 +0,0 @@
-self.description = "Freshen a package"
-
-lp = pmpkg("dummy")
-lp.files = ["bin/dummy",
-            "usr/man/man1/dummy.1"]
-self.addpkg2db("local", lp)
-
-p = pmpkg("dummy", "1.0-2")
-p.files = ["bin/dummy",
-           "usr/man/man1/dummy.1"]
-self.addpkg(p)
-
-self.args = "-F %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_VERSION=dummy|1.0-2")
-for f in p.files:
-	self.addrule("FILE_MODIFIED=%s" % f)
diff --git a/pactest/tests/add031.py b/pactest/tests/add031.py
deleted file mode 100644
index 38b0485..0000000
--- a/pactest/tests/add031.py
+++ /dev/null
@@ -1,18 +0,0 @@
-self.description = "Freshen a package (installed is newer)"
-
-lp = pmpkg("dummy", "1.0-2")
-lp.files = ["bin/dummy",
-            "usr/man/man1/dummy.1"]
-self.addpkg2db("local", lp)
-
-p = pmpkg("dummy")
-p.files = ["bin/dummy",
-           "usr/man/man1/dummy.1"]
-self.addpkg(p)
-
-self.args = "-F %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=1")
-self.addrule("!PKG_MODIFIED=dummy")
-for f in p.files:
-	self.addrule("!FILE_MODIFIED=%s" % f)
diff --git a/pactest/tests/add032.py b/pactest/tests/add032.py
deleted file mode 100644
index 2c5a11f..0000000
--- a/pactest/tests/add032.py
+++ /dev/null
@@ -1,18 +0,0 @@
-self.description = "Freshen a package (installed is same)"
-
-lp = pmpkg("dummy")
-lp.files = ["bin/dummy",
-            "usr/man/man1/dummy.1"]
-self.addpkg2db("local", lp)
-
-p = pmpkg("dummy")
-p.files = ["bin/dummy",
-           "usr/man/man1/dummy.1"]
-self.addpkg(p)
-
-self.args = "-F %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=1")
-self.addrule("!PKG_MODIFIED=dummy")
-for f in p.files:
-	self.addrule("!FILE_MODIFIED=%s" % f)
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index 31d31da..10f4c24 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -71,7 +71,6 @@ static void usage(int op, const char * const myname)
 		printf("    %s {-h --help}\n", myname);
 		printf("    %s {-V --version}\n", myname);
 		printf("    %s {-A --add}     [%s] <%s>\n", myname, str_opt, str_file);
-		printf("    %s {-F --freshen} [%s] <%s>\n", myname, str_opt, str_file);
 		printf("    %s {-Q --query}   [%s] [%s]\n", myname, str_opt, str_pkg);
 		printf("    %s {-R --remove}  [%s] <%s>\n", myname, str_opt, str_pkg);
 		printf("    %s {-S --sync}    [%s] [%s]\n", myname, str_opt, str_pkg);
@@ -93,11 +92,7 @@ static void usage(int op, const char * const myname)
 			printf(_("  -n, --nosave         remove configuration files as well\n"));
 			printf(_("  -s, --recursive      remove dependencies also (that won't break packages)\n"));
 		} else if(op == PM_OP_UPGRADE) {
-			if(config->flags & PM_TRANS_FLAG_FRESHEN) {
-				printf("%s:  %s {-F --freshen} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
-			} else {
-				printf("%s:  %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
-			}
+			printf("%s:  %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
 			printf("%s:\n", str_opt);
 			printf(_("      --asdeps         install packages as non-explicitly installed\n"));
 			printf(_("  -d, --nodeps         skip dependency checks\n"));
@@ -266,7 +261,6 @@ static int parseargs(int argc, char *argv[])
 	static struct option opts[] =
 	{
 		{"add",        no_argument,       0, 'A'},
-		{"freshen",    no_argument,       0, 'F'},
 		{"query",      no_argument,       0, 'Q'},
 		{"remove",     no_argument,       0, 'R'},
 		{"sync",       no_argument,       0, 'S'},
@@ -387,10 +381,6 @@ static int parseargs(int argc, char *argv[])
 				FREELIST(list);
 				break;
 			case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break;
-			case 'F':
-				config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_UPGRADE);
-				config->flags |= PM_TRANS_FLAG_FRESHEN;
-				break;
 			case 'Q': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_QUERY); break;
 			case 'R': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_REMOVE); break;
 			case 'S': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_SYNC); break;
-- 
1.5.3.6





More information about the pacman-dev mailing list