Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/sync.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-08-08 23:54:46 -0500
committerDan McGee <dan@archlinux.org>2011-08-09 16:13:25 -0500
commit5c1b83d9b1e8c25e78fd9f24faf0f15b9a933c8b (patch)
tree785e6477a4287b6f4e30868d46a2e862e632304a /lib/libalpm/sync.c
parentce74f76a4c923f9c13463189dedbdb04683b2142 (diff)
Parse replaces strings as dep strings with version specs
This is done extremely crudely and is not very efficient, but it does push us down the path of being closer to right, as one additional test now passes. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm/sync.c')
-rw-r--r--lib/libalpm/sync.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index e8605914..878971ea 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -85,20 +85,16 @@ alpm_pkg_t SYMEXPORT *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_syn
/** Search for packages to upgrade and add them to the transaction. */
int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
{
- alpm_list_t *i, *j, *k;
+ alpm_list_t *i, *j;
alpm_trans_t *trans;
- alpm_db_t *db_local;
- alpm_list_t *dbs_sync;
CHECK_HANDLE(handle, return -1);
trans = handle->trans;
- db_local = handle->db_local;
- dbs_sync = handle->dbs_sync;
ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1));
_alpm_log(handle, ALPM_LOG_DEBUG, "checking for package upgrades\n");
- for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) {
+ for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = i->next) {
alpm_pkg_t *lpkg = i->data;
if(_alpm_pkg_find(trans->add, lpkg->name)) {
@@ -108,7 +104,7 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
/* Search for literal then replacers in each sync database.
* If found, don't check other databases */
- for(j = dbs_sync; j; j = j->next) {
+ for(j = handle->dbs_sync; j; j = j->next) {
alpm_db_t *sdb = j->data;
/* Check sdb */
alpm_pkg_t *spkg = _alpm_db_get_pkgfromcache(sdb, lpkg->name);
@@ -150,10 +146,20 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
} else {
/* 2. search for replacers in sdb */
int found = 0;
+ alpm_list_t *k, *l;
for(k = _alpm_db_get_pkgcache(sdb); k; k = k->next) {
spkg = k->data;
- if(alpm_list_find_str(alpm_pkg_get_replaces(spkg), lpkg->name)) {
- found = 1;
+ for(l = alpm_pkg_get_replaces(spkg); l; l = l->next) {
+ const char *replace = l->data;
+ alpm_depend_t *parsed_replace = _alpm_splitdep(replace);
+ if(_alpm_depcmp(lpkg, parsed_replace)) {
+ found = 1;
+ _alpm_dep_free(parsed_replace);
+ break;
+ }
+ _alpm_dep_free(parsed_replace);
+ }
+ if(found) {
/* check IgnorePkg/IgnoreGroup */
if(_alpm_pkg_should_ignore(handle, spkg)
|| _alpm_pkg_should_ignore(handle, lpkg)) {
@@ -197,7 +203,8 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
}
}
if(found) {
- break; /* jump to next local package */
+ /* jump to next local package */
+ break;
}
}
}