From 9dd016001eafb69991661d4d8bda91906d51ed78 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Tue, 8 Jan 2008 15:49:52 -0600 Subject: [PATCH] Remove upgradedelay and all code associated with it It wasn't even implemented correctly, and it really doesn't have a use if packagers just do their job correctly anyway for a distro. Let's not try to solve a problem with the wrong solution now. Signed-off-by: Dan McGee --- README | 1 - lib/libalpm/alpm.h | 3 --- lib/libalpm/handle.c | 14 -------------- lib/libalpm/handle.h | 1 - lib/libalpm/package.c | 23 ----------------------- lib/libalpm/package.h | 1 - src/pacman/pacman.c | 5 ----- 7 files changed, 48 deletions(-) diff --git a/README b/README index 9b804f77..46b5bb2b 100644 --- a/README +++ b/README @@ -59,7 +59,6 @@ library is initialized. * cachedir: The base path to pacman's download cache (Default: var/cache/pacman) * logfile: The base path to pacman's log file (Default: var/log/pacman.log) * usesyslog: Log to syslog instead of `logfile` for file-base logging. -* upgradedelay: The time span to wait before listing a package as an upgrade (Default: 0) * xfercommand: The command to use for downloading instead of pacman's internal downloading functionality. * nopassiveftp: Do not use passive FTP commands for ftp connections. diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 4faeedd3..4797fcfa 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -140,9 +140,6 @@ void alpm_option_add_ignoregrp(const char *grp); void alpm_option_set_ignoregrps(alpm_list_t *ignoregrps); int alpm_option_remove_ignoregrp(const char *grp); -time_t alpm_option_get_upgradedelay(); -void alpm_option_set_upgradedelay(time_t delay); - const char *alpm_option_get_xfercommand(); void alpm_option_set_xfercommand(const char *cmd); diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 189c934f..7aab5161 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -219,15 +219,6 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps() return handle->ignoregrp; } -time_t SYMEXPORT alpm_option_get_upgradedelay() -{ - if (handle == NULL) { - pm_errno = PM_ERR_HANDLE_NULL; - return -1; - } - return handle->upgradedelay; -} - const char SYMEXPORT *alpm_option_get_xfercommand() { if (handle == NULL) { @@ -561,11 +552,6 @@ int SYMEXPORT alpm_option_remove_ignoregrp(const char *grp) return(0); } -void SYMEXPORT alpm_option_set_upgradedelay(time_t delay) -{ - handle->upgradedelay = delay; -} - void SYMEXPORT alpm_option_set_xfercommand(const char *cmd) { if(handle->xfercommand) FREE(handle->xfercommand); diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 128ab7e2..5051917e 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -58,7 +58,6 @@ typedef struct _pmhandle_t { /* options */ unsigned short usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */ unsigned short nopassiveftp; /* Don't use PASV ftp connections */ - time_t upgradedelay; /* Time to wait before upgrading a package */ char *xfercommand; /* External download command */ unsigned short usedelta; /* Download deltas if possible */ } pmhandle_t; diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 1293ccff..e79c5b43 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -850,15 +850,6 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg) alpm_pkg_get_name(local_pkg), alpm_pkg_get_version(local_pkg), alpm_db_get_name(db), alpm_pkg_get_version(pkg)); cmp = 0; - } else if(cmp > 0) { - /* we have an upgrade, make sure we should actually do it */ - if(_alpm_pkg_istoonew(pkg)) { - /* package too new (UpgradeDelay) */ - _alpm_log(PM_LOG_WARNING, _("%s-%s: delaying upgrade of package (%s)\n"), - alpm_pkg_get_name(local_pkg), alpm_pkg_get_version(local_pkg), - alpm_pkg_get_version(pkg)); - cmp = 0; - } } return(cmp); @@ -1150,20 +1141,6 @@ pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack) return(NULL); } -/* TODO this should either be public, or done somewhere else */ -int _alpm_pkg_istoonew(pmpkg_t *pkg) -{ - time_t t; - - ALPM_LOG_FUNC; - - if (!handle->upgradedelay) { - return 0; - } - time(&t); - return((pkg->builddate + handle->upgradedelay) > t); -} - /** Test if a package should be ignored. * * Checks if the package is ignored via IgnorePkg, or if the package is diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index f818ae21..d883eee1 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -93,7 +93,6 @@ int _alpm_pkg_cmp(const void *p1, const void *p2); int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg); pmpkg_t *_alpm_pkg_load(const char *pkgfile, unsigned short full); pmpkg_t *_alpm_pkg_find(const char *needle, alpm_list_t *haystack); -int _alpm_pkg_istoonew(pmpkg_t *pkg); int _alpm_pkg_should_ignore(pmpkg_t *pkg); #endif /* _ALPM_PACKAGE_H */ diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 70ef7767..1b8724ba 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -689,11 +689,6 @@ static int _parseconfig(const char *file, const char *givensection, } else if (strcmp(key, "XferCommand") == 0 || strcmp(upperkey, "XFERCOMMAND") == 0) { alpm_option_set_xfercommand(ptr); pm_printf(PM_LOG_DEBUG, "config: xfercommand: %s\n", ptr); - } else if (strcmp(key, "UpgradeDelay") == 0 || strcmp(upperkey, "UPGRADEDELAY") == 0) { - /* The config value is in days, we use seconds */ - time_t ud = atol(ptr) * 60 * 60 *24; - alpm_option_set_upgradedelay(ud); - pm_printf(PM_LOG_DEBUG, "config: upgradedelay: %d\n", (int)ud); } else { pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive '%s' not recognized.\n"), file, linenum, key);