[pacman-dev] [PATCH] Remove SyncFirst option

Dave Reisner d at falconindy.com
Tue Feb 14 17:08:53 EST 2012


On Tue, Feb 14, 2012 at 02:30:06PM -0600, Dan McGee wrote:
> This has outlived its usefulness and causes more problems than it
> solves.
> 
> Signed-off-by: Dan McGee <dan at archlinux.org>
> ---
> 
> This is an RFC first of all, so please feel free to comment.
> 
> Pros:
> 1. Removes complexity and a fair amount of code.
> 2. Removes the hack necesary for download-only and print operations.
> 3. Closes at least two bug reports.
> 4. Pacman is now much more resiliant to updates to itself since vercmp is
>    statically linked, etc. so updating it alone isn't always necessary.
> 
> Cons:
> 1. If a major underlying change occurs (such as a new compression format),
>    users would need to update pacman explicitly first.
> 2. ???

Just to be a jerk... Suppose the following:

- The fabled keyring package exists. Life is awesome.
- I go insane and have to be forcefully removed from the dev team, and
  my packaging key needs to be blacklisted. Alternatively, I'm off on
  vacation and my desktop+gpg key is compromised. Same end effect.
- It's assumed that a number of the packages that I maintain are now
  highly suspect and should NOT be installed.

In this case, SyncFirst seems like the only way to make sure that people
are safe from the rootkits that are infecting my packages.

>  doc/pacman.conf.5.txt        |    9 -----
>  etc/pacman.conf.in           |    2 -
>  src/pacman/conf.c            |    3 +-
>  src/pacman/conf.h            |    1 -
>  src/pacman/sync.c            |   55 +---------------------------------
>  test/pacman/README           |    1 -
>  test/pacman/tests/sync301.py |   27 -----------------
>  test/pacman/tests/sync302.py |   49 ------------------------------
>  test/pacman/tests/sync303.py |   38 -----------------------
>  test/pacman/tests/sync304.py |   27 -----------------
>  test/pacman/tests/sync305.py |   67 ------------------------------------------
>  11 files changed, 2 insertions(+), 277 deletions(-)
>  delete mode 100644 test/pacman/tests/sync301.py
>  delete mode 100644 test/pacman/tests/sync302.py
>  delete mode 100644 test/pacman/tests/sync303.py
>  delete mode 100644 test/pacman/tests/sync304.py
>  delete mode 100644 test/pacman/tests/sync305.py
> 
> diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt
> index 3913292..a9c5db3 100644
> --- a/doc/pacman.conf.5.txt
> +++ b/doc/pacman.conf.5.txt
> @@ -93,15 +93,6 @@ Options
>  	Instructs pacman to ignore any upgrades for this package when performing
>  	a '\--sysupgrade'. Shell-style glob patterns are allowed.
>  
> -*SyncFirst =* package ...::
> -	Instructs pacman to check for newer version of these packages before any
> -	sync operation. The user will have the choice to either cancel the current
> -	operation and upgrade these packages first or go on with the current
> -	operation. This option is typically used with the 'pacman' package.
> -	*NOTE*: when a `SyncFirst` transaction takes place, no command line flags
> -	(e.g. '\--force') are honored. If this is not ideal, disabling `SyncFirst`
> -	and performing a manual sync of the involved packages may be required.
> -
>  *IgnoreGroup =* group ...::
>  	Instructs pacman to ignore any upgrades for all packages in this
>  	group when performing a '\--sysupgrade'. Shell-style glob patterns are
> diff --git a/etc/pacman.conf.in b/etc/pacman.conf.in
> index 7f9db1b..4c72724 100644
> --- a/etc/pacman.conf.in
> +++ b/etc/pacman.conf.in
> @@ -15,8 +15,6 @@
>  #LogFile     = @localstatedir@/log/pacman.log
>  #GPGDir      = @sysconfdir@/pacman.d/gnupg/
>  HoldPkg     = pacman glibc
> -# If upgrades are available for these packages they will be asked for first
> -SyncFirst   = pacman
>  #XferCommand = /usr/bin/curl -C - -f %u > %o
>  #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
>  #CleanMethod = KeepInstalled
> diff --git a/src/pacman/conf.c b/src/pacman/conf.c
> index bfa8cad..e03df36 100644
> --- a/src/pacman/conf.c
> +++ b/src/pacman/conf.c
> @@ -71,7 +71,6 @@ int config_free(config_t *oldconfig)
>  	alpm_list_free(oldconfig->explicit_removes);
>  
>  	FREELIST(oldconfig->holdpkg);
> -	FREELIST(oldconfig->syncfirst);
>  	FREELIST(oldconfig->ignorepkg);
>  	FREELIST(oldconfig->ignoregrp);
>  	FREELIST(oldconfig->noupgrade);
> @@ -423,7 +422,7 @@ static int _parse_options(const char *key, char *value,
>  		} else if(strcmp(key, "HoldPkg") == 0) {
>  			setrepeatingoption(value, "HoldPkg", &(config->holdpkg));
>  		} else if(strcmp(key, "SyncFirst") == 0) {
> -			setrepeatingoption(value, "SyncFirst", &(config->syncfirst));
> +			/* old option, do nothing */
>  		} else if(strcmp(key, "CacheDir") == 0) {
>  			setrepeatingoption(value, "CacheDir", &(config->cachedirs));
>  		} else if(strcmp(key, "Architecture") == 0) {
> diff --git a/src/pacman/conf.h b/src/pacman/conf.h
> index 481132f..9b6ab20 100644
> --- a/src/pacman/conf.h
> +++ b/src/pacman/conf.h
> @@ -84,7 +84,6 @@ typedef struct __config_t {
>  	/* select -Sc behavior */
>  	unsigned short cleanmethod;
>  	alpm_list_t *holdpkg;
> -	alpm_list_t *syncfirst;
>  	alpm_list_t *ignorepkg;
>  	alpm_list_t *ignoregrp;
>  	alpm_list_t *noupgrade;
> diff --git a/src/pacman/sync.c b/src/pacman/sync.c
> index 700bb78..612cd5f 100644
> --- a/src/pacman/sync.c
> +++ b/src/pacman/sync.c
> @@ -549,26 +549,6 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
>  	return 0;
>  }
>  
> -static alpm_list_t *syncfirst(void) {
> -	alpm_list_t *i, *res = NULL;
> -	alpm_db_t *db_local = alpm_get_localdb(config->handle);
> -	alpm_list_t *syncdbs = alpm_get_syncdbs(config->handle);
> -
> -	for(i = config->syncfirst; i; i = alpm_list_next(i)) {
> -		const char *pkgname = i->data;
> -		alpm_pkg_t *pkg = alpm_db_get_pkg(db_local, pkgname);
> -		if(pkg == NULL) {
> -			continue;
> -		}
> -
> -		if(alpm_sync_newversion(pkg, syncdbs)) {
> -			res = alpm_list_add(res, strdup(pkgname));
> -		}
> -	}
> -
> -	return res;
> -}
> -
>  static alpm_db_t *get_db(const char *dbname)
>  {
>  	alpm_list_t *i;
> @@ -959,40 +939,7 @@ int pacman_sync(alpm_list_t *targets)
>  		}
>  	}
>  
> -	alpm_list_t *targs = alpm_list_strdup(targets);
> -	if(!config->op_s_downloadonly && !config->print) {
> -		/* check for newer versions of packages to be upgraded first */
> -		alpm_list_t *packages = syncfirst();
> -		if(packages) {
> -			/* Do not ask user if all the -S targets are SyncFirst packages, see FS#15810 */
> -			alpm_list_t *tmp = NULL;
> -			if(config->op_s_upgrade || (tmp = alpm_list_diff(targets, packages, (alpm_list_fn_cmp)strcmp))) {
> -				alpm_list_free(tmp);
> -				printf(_(":: The following packages should be upgraded first :\n"));
> -				list_display("   ", packages);
> -				if(yesno(_(":: Do you want to cancel the current operation\n"
> -								":: and upgrade these packages now?"))) {
> -					FREELIST(targs);
> -					targs = packages;
> -					config->flags = 0;
> -					config->flags |= ALPM_TRANS_FLAG_RECURSE;
> -					config->flags |= ALPM_TRANS_FLAG_NEEDED;
> -					config->op_s_upgrade = 0;
> -				} else {
> -					FREELIST(packages);
> -				}
> -				printf("\n");
> -			} else {
> -				pm_printf(ALPM_LOG_DEBUG, "skipping SyncFirst dialog\n");
> -				FREELIST(packages);
> -			}
> -		}
> -	}
> -
> -	int ret = sync_trans(targs);
> -	FREELIST(targs);
> -
> -	return ret;
> +	return sync_trans(targets);
>  }
>  
>  /* vim: set ts=2 sw=2 noet: */
> diff --git a/test/pacman/README b/test/pacman/README
> index a3c36fc..ae3303a 100644
> --- a/test/pacman/README
> +++ b/test/pacman/README
> @@ -108,7 +108,6 @@ is not necessarily complete:
>    - HoldPkg
>    - IgnorePkg
>    - IgnoreGroup
> -  - SyncFirst
>    - NoExtract
>    - NoUpgrade
>    - XferCommand
> diff --git a/test/pacman/tests/sync301.py b/test/pacman/tests/sync301.py
> deleted file mode 100644
> index 96402fc..0000000
> --- a/test/pacman/tests/sync301.py
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -self.description = "Sysupgrade : pacman needs to be upgraded and has new deps"
> -
> -sp = pmpkg("pacman", "1.0-2")
> -sp.depends = ["dep"]
> -self.addpkg2db("sync", sp)
> -
> -spdep = pmpkg("dep")
> -self.addpkg2db("sync", spdep)
> -
> -sp1 = pmpkg("pkg1", "1.0-2")
> -self.addpkg2db("sync", sp1)
> -
> -lp = pmpkg("pacman", "1.0-1")
> -self.addpkg2db("local", lp)
> -
> -lp1 = pmpkg("pkg1", "1.0-1")
> -self.addpkg2db("local", lp1)
> -
> -self.option["SyncFirst"] = ["pacman"]
> -
> -self.args = "-Su"
> -
> -self.addrule("PACMAN_RETCODE=0")
> -self.addrule("PKG_EXIST=pacman")
> -self.addrule("PKG_VERSION=pacman|1.0-2")
> -self.addrule("PKG_VERSION=pkg1|1.0-1")
> -self.addrule("PKG_EXIST=dep")
> diff --git a/test/pacman/tests/sync302.py b/test/pacman/tests/sync302.py
> deleted file mode 100644
> index b44aaed..0000000
> --- a/test/pacman/tests/sync302.py
> +++ /dev/null
> @@ -1,49 +0,0 @@
> -self.description = "Sysupgrade : pacman needs to be upgraded and has updated deps"
> -
> -sp = pmpkg("pacman", "1.0-2")
> -sp.depends = ["zlib", "curl", "libarchive"]
> -self.addpkg2db("sync", sp)
> -
> -libcdep = pmpkg("glibc", "2.15-1")
> -self.addpkg2db("sync", libcdep)
> -
> -curldep = pmpkg("curl", "7.22-1")
> -self.addpkg2db("sync", curldep)
> -
> -libadep = pmpkg("libarchive", "2.8.5-1")
> -self.addpkg2db("sync", libadep)
> -
> -zlibdep = pmpkg("zlib", "1.2.5-3")
> -zlibdep.depends = ["glibc"]
> -self.addpkg2db("sync", zlibdep)
> -
> -
> -lp = pmpkg("pacman", "1.0-1")
> -self.addpkg2db("local", lp)
> -
> -lp1 = pmpkg("curl", "7.21.7-1")
> -self.addpkg2db("local", lp1)
> -
> -lp2 = pmpkg("glibc", "2.13-1")
> -self.addpkg2db("local", lp2)
> -
> -lp3 = pmpkg("libarchive", "2.8.4-1")
> -self.addpkg2db("local", lp3)
> -
> -lp4 = pmpkg("zlib", "1.2.5-3")
> -self.addpkg2db("local", lp4)
> -
> -self.option["SyncFirst"] = ["pacman"]
> -
> -self.args = "-Su"
> -
> -self.addrule("PACMAN_RETCODE=0")
> -self.addrule("PKG_EXIST=pacman")
> -self.addrule("PKG_VERSION=pacman|1.0-2")
> -self.addrule("PKG_EXIST=glibc")
> -self.addrule("PKG_VERSION=glibc|2.15-1")
> -self.addrule("PKG_EXIST=curl")
> -self.addrule("PKG_VERSION=curl|7.22-1")
> -self.addrule("PKG_EXIST=libarchive")
> -self.addrule("PKG_VERSION=libarchive|2.8.5-1")
> -self.addrule("PKG_EXIST=zlib")
> diff --git a/test/pacman/tests/sync303.py b/test/pacman/tests/sync303.py
> deleted file mode 100644
> index b717dd2..0000000
> --- a/test/pacman/tests/sync303.py
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -self.description = "Sysupgrade: upgrade pacman with deps as provisions"
> -
> -sp = pmpkg("pacman", "1.0-2")
> -sp.depends = ["zlib"]
> -self.addpkg2db("sync", sp)
> -
> -glibcdep = pmpkg("glibc", "2.13-1")
> -self.addpkg2db("sync", glibcdep)
> -
> -zlibdep = pmpkg("zlib", "1.2.5-3")
> -zlibdep.depends = ["glibc"]
> -self.addpkg2db("sync", zlibdep)
> -
> -
> -lp = pmpkg("pacman", "1.0-1")
> -lp.depends = ["zlib"]
> -self.addpkg2db("local", lp)
> -
> -lp2 = pmpkg("glibc-awesome", "2.13-2")
> -lp2.provides = ["glibc=2.13"]
> -lp2.conflicts = ["glibc"]
> -self.addpkg2db("local", lp2)
> -
> -lp3 = pmpkg("zlib", "1.2.5-3")
> -self.addpkg2db("local", lp3)
> -
> -self.option["SyncFirst"] = ["pacman"]
> -
> -self.args = "-Su"
> -
> -self.addrule("PACMAN_RETCODE=0")
> -self.addrule("PKG_EXIST=pacman")
> -self.addrule("PKG_VERSION=pacman|1.0-2")
> -self.addrule("PKG_EXIST=glibc-awesome")
> -self.addrule("PKG_VERSION=glibc-awesome|2.13-2")
> -self.addrule("PKG_EXIST=zlib")
> -
> -self.expectfailure = True
> diff --git a/test/pacman/tests/sync304.py b/test/pacman/tests/sync304.py
> deleted file mode 100644
> index 4ac1a01..0000000
> --- a/test/pacman/tests/sync304.py
> +++ /dev/null
> @@ -1,27 +0,0 @@
> -self.description = "Sysupgrade: upgrade pacman being depended on"
> -
> -sp = pmpkg("pacman", "4.0.1-1")
> -self.addpkg2db("sync", sp)
> -
> -sp2 = pmpkg("pyalpm", "2-1")
> -sp2.depends = ["pacman>=4.0", "pacman<4.1"]
> -self.addpkg2db("sync", sp2)
> -
> -lp = pmpkg("pacman", "3.5.4-1")
> -self.addpkg2db("local", lp)
> -
> -lp2 = pmpkg("pyalpm", "1-1")
> -lp2.depends = ["pacman>=3.5", "pacman<3.6"]
> -self.addpkg2db("local", lp2)
> -
> -self.option["SyncFirst"] = ["pacman"]
> -
> -self.args = "-Su"
> -
> -self.addrule("PACMAN_RETCODE=0")
> -self.addrule("PKG_EXIST=pacman")
> -self.addrule("PKG_VERSION=pacman|4.0.1-1")
> -self.addrule("PKG_EXIST=pyalpm")
> -self.addrule("PKG_VERSION=pyalpm|2-1")
> -
> -self.expectfailure = True
> diff --git a/test/pacman/tests/sync305.py b/test/pacman/tests/sync305.py
> deleted file mode 100644
> index 24fcee4..0000000
> --- a/test/pacman/tests/sync305.py
> +++ /dev/null
> @@ -1,67 +0,0 @@
> -self.description = "Sysupgrade: syncfirst with recursive/cascading deps"
> -
> -sp = pmpkg("pacman", "4.0.1-2")
> -sp.depends = ["glibc>=2.15", "curl"]
> -self.addpkg2db("sync", sp)
> -
> -glibcdep = pmpkg("glibc", "2.15-1")
> -self.addpkg2db("sync", glibcdep)
> -
> -gcldep = pmpkg("gcc-libs", "4.6.2-5")
> -gcldep.depends = ["glibc>=2.14"]
> -self.addpkg2db("sync", gcldep)
> -
> -curldep = pmpkg("curl", "7.23.1-2")
> -curldep.depends = ["openssl"]
> -self.addpkg2db("sync", curldep)
> -
> -openssldep = pmpkg("openssl", "1.0.0.e-1")
> -openssldep.depends = ["perl"]
> -self.addpkg2db("sync", openssldep)
> -
> -gccdep = pmpkg("gcc", "4.6.2-5")
> -gccdep.depends = ["gcc-libs=4.6.2-5"]
> -self.addpkg2db("sync", gccdep)
> -
> -perldep = pmpkg("perl", "5.14.2-5")
> -perldep.depends = ["db"]
> -self.addpkg2db("sync", perldep)
> -
> -dbdep = pmpkg("db", "5.2.36-2")
> -dbdep.depends = ["gcc-libs"]
> -self.addpkg2db("sync", dbdep)
> -
> -
> -lp = pmpkg("pacman", "4.0.1-1")
> -lp.depends = ["glibc>=2.14", "curl"]
> -self.addpkg2db("local", lp)
> -
> -lp2 = pmpkg("glibc", "2.14-2")
> -self.addpkg2db("local", lp2)
> -
> -lp3 = pmpkg("curl", "7.23.1-2")
> -self.addpkg2db("local", lp3)
> -
> -lp4 = pmpkg("gcc-libs", "4.6.2-3")
> -self.addpkg2db("local", lp4)
> -
> -lp5 = pmpkg("gcc", "4.6.2-3")
> -lp5.depends = ["gcc-libs=4.6.2-3"]
> -self.addpkg2db("local", lp5)
> -
> -lp6 = pmpkg("perl", "5.14.2-5")
> -lp6.depends = ["db"]
> -self.addpkg2db("local", lp6)
> -
> -lp7 = pmpkg("db", "5.2.36-2")
> -lp7.depends = ["gcc-libs"]
> -self.addpkg2db("local", lp7)
> -
> -self.option["SyncFirst"] = ["pacman"]
> -
> -self.args = "-Su"
> -self.addrule("PACMAN_RETCODE=0")
> -self.addrule("PKG_EXIST=pacman")
> -self.addrule("PKG_VERSION=pacman|4.0.1-2")
> -
> -self.expectfailure = True
> -- 
> 1.7.9
> 
> 


More information about the pacman-dev mailing list