mirror of
https://github.com/moparisthebest/pacman
synced 2024-08-13 17:03:46 -04:00
pacman/upgrade: switch to new interface
Note that there is a behavior change here : if the same package name appeared several times in the target list, the alpm_add_target interface chooses the new package, while alpm_add_pkg returns PKG_DUP. I don't see why we cannot unify the behavior of -S and -U, and just choose one behavior that applies to both. Otherwise, it's always possible to handle these different behaviors in the frontend, it just requires more work. Signed-off-by: Xavier Chantry <chantry.xavier@gmail.com>
This commit is contained in:
parent
953e0d48d7
commit
4a72c0964a
@ -71,12 +71,21 @@ int pacman_upgrade(alpm_list_t *targets)
|
||||
/* add targets to the created transaction */
|
||||
for(i = targets; i; i = alpm_list_next(i)) {
|
||||
char *targ = alpm_list_getdata(i);
|
||||
if(alpm_add_target(targ) == -1) {
|
||||
pmpkg_t *pkg;
|
||||
|
||||
if(alpm_pkg_load(targ, 1, &pkg) != 0) {
|
||||
pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n",
|
||||
targ, alpm_strerrorlast());
|
||||
trans_release();
|
||||
return(1);
|
||||
}
|
||||
if(alpm_add_pkg(pkg) == -1) {
|
||||
pm_fprintf(stderr, PM_LOG_ERROR, "'%s': %s\n",
|
||||
targ, alpm_strerrorlast());
|
||||
alpm_pkg_free(pkg);
|
||||
trans_release();
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* Step 2: "compute" the transaction based on targets and flags */
|
||||
|
Loading…
Reference in New Issue
Block a user