summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
authorNagy Gabor <ngaba@bibl.u-szeged.hu>2009-05-14 18:25:16 +0200
committerDan McGee <dan@archlinux.org>2009-07-22 20:16:52 -0500
commit1d19f0896ccc1560a7e2f5b93cfe095b4aefe84a (patch)
treefc8916e5fb63e474d3cdcd8af937b1c6d07d811d /lib/libalpm
parentca6ef852f9944ad31e8a136f7faf71da2c5fb57f (diff)
downloadpacman-1d19f0896ccc1560a7e2f5b93cfe095b4aefe84a.tar.xz
Introduce -Suu
If the user switches from unstable repo to a stable one, it is quite hard to sync its system with the new repo (the user will see many "Local is newer than stable" messages, nothing more). That's why I introduced -Suu, which treats a sync package like an upgrade, iff the package version doesn't match with the local one's. I added a new pactest (sync104.py) to test this, and I updated the documentation of -Su. Signed-off-by: Nagy Gabor <ngaba@bibl.u-szeged.hu> [Dan: slight doc reword] Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.h2
-rw-r--r--lib/libalpm/sync.c18
-rw-r--r--lib/libalpm/sync.h2
-rw-r--r--lib/libalpm/trans.c4
4 files changed, 19 insertions, 7 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index e46942d9..5285ac39 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -397,7 +397,7 @@ alpm_list_t * alpm_trans_get_pkgs();
int alpm_trans_init(pmtranstype_t type, pmtransflag_t flags,
alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv,
alpm_trans_cb_progress cb_progress);
-int alpm_trans_sysupgrade(void);
+int alpm_trans_sysupgrade(int enable_downgrade);
int alpm_trans_addtarget(char *target);
int alpm_trans_prepare(alpm_list_t **data);
int alpm_trans_commit(alpm_list_t **data);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index ffcddf98..47639248 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -80,7 +80,7 @@ pmpkg_t SYMEXPORT *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync)
return(NULL);
}
-int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync)
+int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, int enable_downgrade)
{
alpm_list_t *i, *j, *k;
@@ -116,8 +116,20 @@ int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_s
trans->packages = alpm_list_add(trans->packages, spkg);
}
} else if(cmp < 0) {
- _alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)\n"),
- lpkg->name, lpkg->version, sdb->treename, spkg->version);
+ if(enable_downgrade) {
+ /* check IgnorePkg/IgnoreGroup */
+ if(_alpm_pkg_should_ignore(spkg) || _alpm_pkg_should_ignore(lpkg)) {
+ _alpm_log(PM_LOG_WARNING, _("%s: ignoring package downgrade (%s => %s)\n"),
+ lpkg->name, lpkg->version, spkg->version);
+ } else {
+ _alpm_log(PM_LOG_WARNING, _("%s: downgrading from version %s to version %s\n"),
+ lpkg->name, lpkg->version, spkg->version);
+ trans->packages = alpm_list_add(trans->packages, spkg);
+ }
+ } else {
+ _alpm_log(PM_LOG_WARNING, _("%s: local (%s) is newer than %s (%s)\n"),
+ lpkg->name, lpkg->version, sdb->treename, spkg->version);
+ }
}
break; /* jump to next local package */
} else { /* 2. search for replacers in sdb */
diff --git a/lib/libalpm/sync.h b/lib/libalpm/sync.h
index 5d642073..c2905a45 100644
--- a/lib/libalpm/sync.h
+++ b/lib/libalpm/sync.h
@@ -24,7 +24,7 @@
#include "alpm.h"
-int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync);
+int _alpm_sync_sysupgrade(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, int enable_downgrade);
int _alpm_sync_addtarget(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, char *name);
int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync, alpm_list_t **data);
diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c
index d1c0e930..6e847e64 100644
--- a/lib/libalpm/trans.c
+++ b/lib/libalpm/trans.c
@@ -89,7 +89,7 @@ int SYMEXPORT alpm_trans_init(pmtranstype_t type, pmtransflag_t flags,
/** Search for packages to upgrade and add them to the transaction.
* @return 0 on success, -1 on error (pm_errno is set accordingly)
*/
-int SYMEXPORT alpm_trans_sysupgrade()
+int SYMEXPORT alpm_trans_sysupgrade(int enable_downgrade)
{
pmtrans_t *trans;
@@ -102,7 +102,7 @@ int SYMEXPORT alpm_trans_sysupgrade()
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1));
ASSERT(trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1));
- return(_alpm_sync_sysupgrade(trans, handle->db_local, handle->dbs_sync));
+ return(_alpm_sync_sysupgrade(trans, handle->db_local, handle->dbs_sync, enable_downgrade));
}
/** Add a target to the transaction.