[pacman-dev] [PATCH 4/5] Make pacman forget deltas exist

Allan McRae allan at archlinux.org
Sat Mar 2 10:19:15 UTC 2019


Dummy callbacks are still present to prevent compiler warnings until
libalpm is delta free.

Also remove Delta parsing from pacman.conf.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 doc/pacman.conf.5.asciidoc |  8 --------
 src/pacman/callback.c      | 27 ++++++++-------------------
 src/pacman/conf.c          | 25 -------------------------
 src/pacman/conf.h          |  1 -
 src/pacman/pacman-conf.c   | 13 -------------
 src/pacman/sync.c          |  5 +----
 6 files changed, 9 insertions(+), 70 deletions(-)

diff --git a/doc/pacman.conf.5.asciidoc b/doc/pacman.conf.5.asciidoc
index 9810fc7f..b297e332 100644
--- a/doc/pacman.conf.5.asciidoc
+++ b/doc/pacman.conf.5.asciidoc
@@ -186,14 +186,6 @@ Options
 *Color*::
 	Automatically enable colors only when pacman's output is on a tty.
 
-*UseDelta* [= ratio]::
-	Download delta files instead of complete packages if possible. Requires
-	the `xdelta3` program to be installed. If a ratio is specified (e.g.,
-	`0.5`), then it is used as a cutoff for determining whether to use deltas.
-	Allowed values are between `0.0` and `2.0`; sensible values are between
-	`0.2` and `0.9`.  Using a value above `1.0` is not recommended.  The
-	default is `0.7` if left unspecified.
-
 *TotalDownload*::
 	When downloading, display the amount downloaded, download rate, ETA,
 	and completed percentage of the entire download list rather
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 40e7832c..b8e3dd73 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -267,23 +267,6 @@ void cb_event(alpm_event_t *event)
 				printf(_("loading package files...\n"));
 			}
 			break;
-		case ALPM_EVENT_DELTA_INTEGRITY_START:
-			printf(_("checking delta integrity...\n"));
-			break;
-		case ALPM_EVENT_DELTA_PATCHES_START:
-			printf(_("applying deltas...\n"));
-			break;
-		case ALPM_EVENT_DELTA_PATCH_START:
-			printf(_("generating %s with %s... "),
-					event->delta_patch.delta->to,
-					event->delta_patch.delta->delta);
-			break;
-		case ALPM_EVENT_DELTA_PATCH_DONE:
-			printf(_("success!\n"));
-			break;
-		case ALPM_EVENT_DELTA_PATCH_FAILED:
-			printf(_("failed.\n"));
-			break;
 		case ALPM_EVENT_SCRIPTLET_INFO:
 			fputs(event->scriptlet_info.line, stdout);
 			break;
@@ -355,8 +338,6 @@ void cb_event(alpm_event_t *event)
 		case ALPM_EVENT_KEYRING_DONE:
 		case ALPM_EVENT_KEY_DOWNLOAD_DONE:
 		case ALPM_EVENT_LOAD_DONE:
-		case ALPM_EVENT_DELTA_INTEGRITY_DONE:
-		case ALPM_EVENT_DELTA_PATCHES_DONE:
 		case ALPM_EVENT_DISKSPACE_DONE:
 		case ALPM_EVENT_RETRIEVE_DONE:
 		case ALPM_EVENT_RETRIEVE_FAILED:
@@ -366,6 +347,14 @@ void cb_event(alpm_event_t *event)
 		case ALPM_EVENT_PKGDOWNLOAD_START:
 		case ALPM_EVENT_PKGDOWNLOAD_DONE:
 		case ALPM_EVENT_PKGDOWNLOAD_FAILED:
+		/* temporary until removed from libalpm */
+		case ALPM_EVENT_DELTA_INTEGRITY_START:
+		case ALPM_EVENT_DELTA_INTEGRITY_DONE:
+		case ALPM_EVENT_DELTA_PATCHES_START:
+		case ALPM_EVENT_DELTA_PATCHES_DONE:
+		case ALPM_EVENT_DELTA_PATCH_START:
+		case ALPM_EVENT_DELTA_PATCH_DONE:
+		case ALPM_EVENT_DELTA_PATCH_FAILED:
 			/* nothing */
 			break;
 	}
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 29f69052..febd35e3 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -103,7 +103,6 @@ config_t *config_new(void)
 	newconfig->op = PM_OP_MAIN;
 	newconfig->logmask = ALPM_LOG_ERROR | ALPM_LOG_WARNING;
 	newconfig->configfile = strdup(CONFFILE);
-	newconfig->deltaratio = 0.0;
 	if(alpm_capabilities() & ALPM_CAPABILITY_SIGNATURES) {
 		newconfig->siglevel = ALPM_SIG_PACKAGE | ALPM_SIG_PACKAGE_OPTIONAL |
 			ALPM_SIG_DATABASE | ALPM_SIG_DATABASE_OPTIONAL;
@@ -485,9 +484,6 @@ static int _parse_options(const char *key, char *value,
 		} else if(strcmp(key, "VerbosePkgLists") == 0) {
 			config->verbosepkglists = 1;
 			pm_printf(ALPM_LOG_DEBUG, "config: verbosepkglists\n");
-		} else if(strcmp(key, "UseDelta") == 0) {
-			config->deltaratio = 0.7;
-			pm_printf(ALPM_LOG_DEBUG, "config: usedelta (default 0.7)\n");
 		} else if(strcmp(key, "TotalDownload") == 0) {
 			config->totaldownload = 1;
 			pm_printf(ALPM_LOG_DEBUG, "config: totaldownload\n");
@@ -525,26 +521,6 @@ static int _parse_options(const char *key, char *value,
 			if(!config->arch) {
 				config_set_arch(value);
 			}
-		} else if(strcmp(key, "UseDelta") == 0) {
-			double ratio;
-			char *endptr;
-			const char *oldlocale;
-
-			/* set the locale to 'C' for consistent decimal parsing (0.7 and never
-			 * 0,7) from config files, then restore old setting when we are done */
-			oldlocale = setlocale(LC_NUMERIC, NULL);
-			setlocale(LC_NUMERIC, "C");
-			ratio = strtod(value, &endptr);
-			setlocale(LC_NUMERIC, oldlocale);
-
-			if(*endptr != '\0' || ratio < 0.0 || ratio > 2.0) {
-				pm_printf(ALPM_LOG_ERROR,
-						_("config file %s, line %d: invalid value for '%s' : '%s'\n"),
-						file, linenum, "UseDelta", value);
-				return 1;
-			}
-			config->deltaratio = ratio;
-			pm_printf(ALPM_LOG_DEBUG, "config: usedelta = %f\n", ratio);
 		} else if(strcmp(key, "DBPath") == 0) {
 			/* don't overwrite a path specified on the command line */
 			if(!config->dbpath) {
@@ -766,7 +742,6 @@ static int setup_libalpm(void)
 	alpm_option_set_arch(handle, config->arch);
 	alpm_option_set_checkspace(handle, config->checkspace);
 	alpm_option_set_usesyslog(handle, config->usesyslog);
-	alpm_option_set_deltaratio(handle, config->deltaratio);
 
 	alpm_option_set_ignorepkgs(handle, config->ignorepkg);
 	alpm_option_set_ignoregroups(handle, config->ignoregrp);
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index ababf2e0..f45ed436 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -56,7 +56,6 @@ typedef struct __config_t {
 	unsigned short usesyslog;
 	unsigned short color;
 	unsigned short disable_dl_timeout;
-	double deltaratio;
 	char *arch;
 	char *print_format;
 	/* unfortunately, we have to keep track of paths both here and in the library
diff --git a/src/pacman/pacman-conf.c b/src/pacman/pacman-conf.c
index 56196f79..df874029 100644
--- a/src/pacman/pacman-conf.c
+++ b/src/pacman/pacman-conf.c
@@ -125,14 +125,6 @@ static void list_repos(void)
 	}
 }
 
-static void show_float(const char *directive, float val)
-{
-	if(verbose) {
-		printf("%s = ", directive);
-	}
-	printf("%f%c", val, sep);
-}
-
 static void show_bool(const char *directive, short unsigned int val)
 {
 	if(val) {
@@ -269,8 +261,6 @@ static void dump_config(void)
 	show_bool("DisableDownloadTimeout", config->disable_dl_timeout);
 	show_bool("ILoveCandy", config->chomp);
 
-	show_float("UseDelta", config->deltaratio);
-
 	show_cleanmethod("CleanMethod", config->cleanmethod);
 
 	show_siglevel("SigLevel", config->siglevel, 0);
@@ -380,9 +370,6 @@ static int list_directives(void)
 		} else if(strcasecmp(i->data, "DisableDownloadTimeout") == 0) {
 			show_bool("DisableDownloadTimeout", config->disable_dl_timeout);
 
-		} else if(strcasecmp(i->data, "UseDelta") == 0) {
-			show_float("UseDelta", config->deltaratio);
-
 		} else if(strcasecmp(i->data, "CleanMethod") == 0) {
 			show_cleanmethod("CleanMethod", config->cleanmethod);
 
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 2406fed5..7dc69079 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -222,9 +222,7 @@ static int sync_cleancache(int level)
 					/* skip package databases within the cache directory */
 					"*.db*", "*.files*",
 					/* skip source packages within the cache directory */
-					"*.src.tar.*",
-					/* skip package deltas, we aren't smart enough to clean these yet */
-					"*.delta"
+					"*.src.tar.*"
 				};
 				size_t j;
 
@@ -847,7 +845,6 @@ int sync_prepare_execute(void)
 			case ALPM_ERR_PKG_INVALID:
 			case ALPM_ERR_PKG_INVALID_CHECKSUM:
 			case ALPM_ERR_PKG_INVALID_SIG:
-			case ALPM_ERR_DLT_INVALID:
 				for(i = data; i; i = alpm_list_next(i)) {
 					char *filename = i->data;
 					printf(_("%s is invalid or corrupted\n"), filename);
-- 
2.20.1


More information about the pacman-dev mailing list