1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-23 08:18:51 -05:00

Remove the IgnorePkg handling from alpm_pkg_compare_version.

And check the IgnorePkg handling is done correctly in the other places.
For example, -Qu and -Su will automatically skip the ignored packages (-Su will print a warning),
but -S will install ignored packages anyway, because it was asked explicitly.

Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This commit is contained in:
Chantry Xavier 2007-11-16 15:34:04 +01:00 committed by Dan McGee
parent e174865bdc
commit 8f824e70bb
3 changed files with 16 additions and 29 deletions

View File

@ -464,7 +464,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
if(strcmp(k->data, alpm_pkg_get_name(lpkg)) == 0) { if(strcmp(k->data, alpm_pkg_get_name(lpkg)) == 0) {
_alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n", _alpm_log(PM_LOG_DEBUG, "checking replacement '%s' for package '%s'\n",
(char *)k->data, alpm_pkg_get_name(spkg)); (char *)k->data, alpm_pkg_get_name(spkg));
if(_alpm_pkg_should_ignore(lpkg)) { if(_alpm_pkg_should_ignore(spkg) || _alpm_pkg_should_ignore(lpkg)) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"), _alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (to be replaced by %s-%s)\n"),
alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg), alpm_pkg_get_name(lpkg), alpm_pkg_get_version(lpkg),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg)); alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
@ -545,6 +545,10 @@ alpm_list_t SYMEXPORT *alpm_db_get_upgrades(void)
syncpkg = _alpm_sync_find(syncpkgs, alpm_pkg_get_name(local)); syncpkg = _alpm_sync_find(syncpkgs, alpm_pkg_get_name(local));
if(!syncpkg) { if(!syncpkg) {
/* If package is in the ignorepkg list, skip it */
if(_alpm_pkg_should_ignore(spkg)) {
continue;
}
pmpkg_t *dummy = _alpm_pkg_new(alpm_pkg_get_name(local), pmpkg_t *dummy = _alpm_pkg_new(alpm_pkg_get_name(local),
alpm_pkg_get_version(local)); alpm_pkg_get_version(local));
if(dummy == NULL) { if(dummy == NULL) {

View File

@ -731,16 +731,6 @@ int alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg)
/* compare versions and see if we need to upgrade */ /* compare versions and see if we need to upgrade */
cmp = _alpm_versioncmp(alpm_pkg_get_version(pkg), alpm_pkg_get_version(local_pkg)); cmp = _alpm_versioncmp(alpm_pkg_get_version(pkg), alpm_pkg_get_version(local_pkg));
if(_alpm_pkg_should_ignore(pkg)) {
/* package should be ignored (IgnorePkg) */
if(cmp > 0) {
_alpm_log(PM_LOG_WARNING, _("%s-%s: ignoring package upgrade (%s)\n"),
alpm_pkg_get_name(local_pkg), alpm_pkg_get_version(local_pkg),
alpm_pkg_get_version(pkg));
}
return(0);
}
if(cmp != 0 && pkg->force) { if(cmp != 0 && pkg->force) {
cmp = 1; cmp = 1;
_alpm_log(PM_LOG_WARNING, _("%s: forcing upgrade to version %s\n"), _alpm_log(PM_LOG_WARNING, _("%s: forcing upgrade to version %s\n"),

View File

@ -208,18 +208,16 @@ 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 */ /* compare versions and see if we need to upgrade */
if(alpm_pkg_compare_versions(local, spkg)) { if(alpm_pkg_compare_versions(local, spkg)) {
_alpm_log(PM_LOG_DEBUG, "%s-%s elected for upgrade (%s => %s)\n", _alpm_log(PM_LOG_DEBUG, "%s elected for upgrade (%s => %s)\n",
alpm_pkg_get_name(local), alpm_pkg_get_version(local), alpm_pkg_get_name(local), alpm_pkg_get_version(local),
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg)); alpm_pkg_get_version(spkg));
if(!_alpm_sync_find(trans->packages, alpm_pkg_get_name(spkg))) { if(!_alpm_sync_find(trans->packages, alpm_pkg_get_name(spkg))) {
/* If package is in the ignorepkg list, ask before we add it to /* If package is in the ignorepkg list, skip it */
* the transaction */ if(_alpm_pkg_should_ignore(spkg)) {
if(_alpm_pkg_should_ignore(local)) { _alpm_log(PM_LOG_WARNING, _("%s: ignoring package upgrade (%s => %s)\n"),
int resp = 0; alpm_pkg_get_name(local), alpm_pkg_get_version(local),
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp); alpm_pkg_get_version(spkg));
if(!resp) { continue;
continue;
}
} }
pmpkg_t *tmp = _alpm_pkg_dup(local); pmpkg_t *tmp = _alpm_pkg_dup(local);
if(tmp == NULL) { if(tmp == NULL) {
@ -318,17 +316,12 @@ int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sy
if(local) { if(local) {
if(alpm_pkg_compare_versions(local, spkg) == 0) { if(alpm_pkg_compare_versions(local, spkg) == 0) {
/* spkg is NOT an upgrade, get confirmation before adding */ /* spkg is NOT an upgrade, get confirmation before adding */
int resp = 0; if(!(trans->flags & PM_TRANS_FLAG_PRINTURIS)) {
if(_alpm_pkg_should_ignore(local)) { int resp = 0;
QUESTION(trans, PM_TRANS_CONV_INSTALL_IGNOREPKG, local, NULL, NULL, &resp);
if(!resp) {
return(0);
}
} else if(!(trans->flags & PM_TRANS_FLAG_PRINTURIS)) {
QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp); QUESTION(trans, PM_TRANS_CONV_LOCAL_UPTODATE, local, NULL, NULL, &resp);
if(!resp) { if(!resp) {
_alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"), _alpm_log(PM_LOG_WARNING, _("%s-%s is up to date -- skipping\n"),
alpm_pkg_get_name(local), alpm_pkg_get_version(local)); alpm_pkg_get_name(local), alpm_pkg_get_version(local));
return(0); return(0);
} }
} }