mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-09 13:07:58 -05:00
libalpm/sync.c : fix DEPENDSONLY flag handling.
I didn't like the patch proposed by Nagy for the sync1002 pactest here: http://www.archlinux.org/pipermail/pacman-dev/2007-July/008971.html So here is another attempt of fixing it. In case of the DEPENDSONLY flag : 1) pass an empty list to resolvedeps instead of the list of targets 2) empty the trans->packages targets list before adding the resolved deps. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
This commit is contained in:
parent
5991e85abb
commit
b0c064d59b
@ -392,10 +392,12 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
|||||||
*data = NULL;
|
*data = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!(trans->flags & PM_TRANS_FLAG_DEPENDSONLY)) {
|
||||||
for(i = trans->packages; i; i = i->next) {
|
for(i = trans->packages; i; i = i->next) {
|
||||||
pmsyncpkg_t *sync = i->data;
|
pmsyncpkg_t *sync = i->data;
|
||||||
list = alpm_list_add(list, sync->pkg);
|
list = alpm_list_add(list, sync->pkg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
|
if(!(trans->flags & PM_TRANS_FLAG_NODEPS)) {
|
||||||
/* Resolve targets dependencies */
|
/* Resolve targets dependencies */
|
||||||
@ -411,6 +413,10 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if((trans->flags & PM_TRANS_FLAG_DEPENDSONLY)) {
|
||||||
|
FREELIST(trans->packages);
|
||||||
|
}
|
||||||
|
|
||||||
for(i = list; i; i = i->next) {
|
for(i = list; i; i = i->next) {
|
||||||
/* add the dependencies found by resolvedeps to the transaction set */
|
/* add the dependencies found by resolvedeps to the transaction set */
|
||||||
pmpkg_t *spkg = i->data;
|
pmpkg_t *spkg = i->data;
|
||||||
@ -423,19 +429,6 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t *dbs_sync
|
|||||||
trans->packages = alpm_list_add(trans->packages, sync);
|
trans->packages = alpm_list_add(trans->packages, sync);
|
||||||
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s to the transaction targets",
|
_alpm_log(PM_LOG_DEBUG, "adding package %s-%s to the transaction targets",
|
||||||
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
|
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
|
||||||
} else {
|
|
||||||
/* remove the original targets from the list if requested */
|
|
||||||
if((trans->flags & PM_TRANS_FLAG_DEPENDSONLY)) {
|
|
||||||
void *vpkg;
|
|
||||||
pmsyncpkg_t *sync;
|
|
||||||
|
|
||||||
_alpm_log(PM_LOG_DEBUG, "removing package %s-%s from the transaction targets",
|
|
||||||
alpm_pkg_get_name(spkg), alpm_pkg_get_version(spkg));
|
|
||||||
|
|
||||||
sync = _alpm_sync_find(trans->packages, alpm_pkg_get_name(spkg));
|
|
||||||
trans->packages = alpm_list_remove(trans->packages, sync, syncpkg_cmp, &vpkg);
|
|
||||||
_alpm_sync_free(vpkg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user