summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-02-23 02:10:56 +0000
committerAaron Griffin <aaron@archlinux.org>2007-02-23 02:10:56 +0000
commitd584d8c06842cec99bff1e07b565ee0511cfade8 (patch)
treeb1563526d705c6d52a061de93fe4c738effcceb2 /lib/libalpm
parentc799433e423d5bdd6737b81483de82b9e98aed46 (diff)
downloadpacman-d584d8c06842cec99bff1e07b565ee0511cfade8.tar.xz
* Modified the handling and output w.r.t. IgnorePkg entries. -Sy always ignores
these packages, but -S explicitly asks for confirmation.
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/package.c8
-rw-r--r--lib/libalpm/package.h2
-rw-r--r--lib/libalpm/sync.c44
3 files changed, 29 insertions, 25 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 09161dba..bf086aba 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -141,27 +141,29 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
}
/* compare versions and see if we need to upgrade */
- cmp = _alpm_versioncmp(local_pkg->version, pkg->version);
+ cmp = _alpm_versioncmp(pkg->version, local_pkg->version);
if(cmp != 0 && pkg->force) {
cmp = 1;
_alpm_log(PM_LOG_WARNING, _("%s: forcing upgrade to version %s"), local_pkg->name, pkg->version);
- } else if(cmp > 0) {
+ } else if(cmp < 0) {
/* local version is newer */
pmdb_t *db = pkg->data;
_alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)"),
local_pkg->name, local_pkg->version, db->treename, pkg->version);
cmp = 0;
- } else if(cmp < 0) {
+ } else if(cmp > 0) {
/* we have an upgrade, make sure we should actually do it */
if(alpm_list_find_str(handle->ignorepkg, pkg->name)) {
/* package should be ignored (IgnorePkg) */
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)"),
local_pkg->name, local_pkg->version, pkg->version);
+ cmp = 0;
} else if(_alpm_pkg_istoonew(pkg)) {
/* package too new (UpgradeDelay) */
_alpm_log(PM_LOG_WARNING, _("%s-%s: delaying upgrade of package (%s)"),
local_pkg->name, local_pkg->version, pkg->version);
+ cmp = 0;
}
}
diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h
index 6ef8a8a6..820a476f 100644
--- a/lib/libalpm/package.h
+++ b/lib/libalpm/package.h
@@ -102,7 +102,7 @@ pmpkg_t* _alpm_pkg_new(const char *name, const char *version);
pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg);
void _alpm_pkg_free(void *data);
int _alpm_pkg_cmp(const void *p1, const void *p2);
-int alpm_pkg_compare_versions(pmpkg_t *pkgA, pmpkg_t *pkgB);
+int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg);
pmpkg_t *_alpm_pkg_load(char *pkgfile);
pmpkg_t *_alpm_pkg_isin(char *needle, alpm_list_t *haystack);
int _alpm_pkg_splitname(char *target, char *name, char *version, int witharch);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 31c3b6a4..8cc50108 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -228,24 +228,19 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
/* compare versions and see if we need to upgrade */
if(alpm_pkg_compare_versions(local, spkg)) {
- if(alpm_list_find_str(handle->ignorepkg, local->name)) {
- _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s => %s)"),
- local->name, local->version, local->version, spkg->version);
- } else {
- _alpm_log(PM_LOG_DEBUG, _("%s-%s elected for upgrade (%s => %s)"),
- local->name, local->version, local->version, spkg->version);
- if(!find_pkginsync(spkg->name, trans->packages)) {
- pmpkg_t *dummy = _alpm_pkg_new(local->name, local->version);
- if(dummy == NULL) {
- goto error;
- }
- sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
- if(sync == NULL) {
- FREEPKG(dummy);
- goto error;
- }
- trans->packages = alpm_list_add(trans->packages, sync);
+ _alpm_log(PM_LOG_DEBUG, _("%s-%s elected for upgrade (%s => %s)"),
+ local->name, local->version, local->version, spkg->version);
+ if(!find_pkginsync(spkg->name, trans->packages)) {
+ pmpkg_t *dummy = _alpm_pkg_new(local->name, local->version);
+ if(dummy == NULL) {
+ goto error;
}
+ sync = _alpm_sync_new(PM_SYNC_TYPE_UPGRADE, spkg, dummy);
+ if(sync == NULL) {
+ FREEPKG(dummy);
+ goto error;
+ }
+ trans->packages = alpm_list_add(trans->packages, sync);
}
}
}
@@ -331,10 +326,17 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
if(alpm_pkg_compare_versions(local, spkg) == 0) {
/* spkg is NOT an upgrade, get confirmation before adding */
int resp = 0;
- QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
- if(!resp) {
- _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping"), local->name, local->version);
- return(0);
+ if(alpm_list_find_str(handle->ignorepkg, local->name)) {
+ QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp);
+ if(!resp) {
+ return(0);
+ }
+ } else {
+ QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
+ if(!resp) {
+ _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping"), local->name, local->version);
+ return(0);
+ }
}
}
}