mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-23 08:18:51 -05:00
Only query pacman upgrade when performing actual upgrade
Fixes FS#7147. Do not ask about upgrading pacman when -w and -p flags are used. Signed-off-by: Allan McRae <mcrae_allan@hotmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
a11b2065af
commit
e5cdac7d48
@ -512,43 +512,45 @@ static int sync_trans(alpm_list_t *targets, int sync_only)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if pacman itself is one of the packages to upgrade.
|
if(!(alpm_trans_get_flags() & (PM_TRANS_FLAG_DOWNLOADONLY | PM_TRANS_FLAG_PRINTURIS))) {
|
||||||
* this can prevent some of the "syntax error" problems users can have
|
/* check if pacman itself is one of the packages to upgrade.
|
||||||
* when sysupgrade'ing with an older version of pacman.
|
* this can prevent some of the "syntax error" problems users can have
|
||||||
*/
|
* when sysupgrade'ing with an older version of pacman.
|
||||||
pkgs = alpm_trans_get_pkgs();
|
*/
|
||||||
for(i = pkgs; i; i = alpm_list_next(i)) {
|
pkgs = alpm_trans_get_pkgs();
|
||||||
pmsyncpkg_t *sync = alpm_list_getdata(i);
|
for(i = pkgs; i; i = alpm_list_next(i)) {
|
||||||
pmpkg_t *spkg = alpm_sync_get_pkg(sync);
|
pmsyncpkg_t *sync = alpm_list_getdata(i);
|
||||||
/* TODO pacman name should probably not be hardcoded. In addition, we
|
pmpkg_t *spkg = alpm_sync_get_pkg(sync);
|
||||||
* have problems on an -Syu if pacman has to pull in deps, so recommend
|
/* TODO pacman name should probably not be hardcoded. In addition, we
|
||||||
* an '-S pacman' operation */
|
* have problems on an -Syu if pacman has to pull in deps, so recommend
|
||||||
if(strcmp("pacman", alpm_pkg_get_name(spkg)) == 0) {
|
* an '-S pacman' operation */
|
||||||
printf("\n");
|
if(strcmp("pacman", alpm_pkg_get_name(spkg)) == 0) {
|
||||||
printf(_(":: pacman has detected a newer version of itself.\n"
|
printf("\n");
|
||||||
":: It is recommended that you upgrade pacman by itself\n"
|
printf(_(":: pacman has detected a newer version of itself.\n"
|
||||||
":: using 'pacman -S pacman', and then rerun the current\n"
|
":: It is recommended that you upgrade pacman by itself\n"
|
||||||
":: operation. If you wish to continue the operation and\n"
|
":: using 'pacman -S pacman', and then rerun the current\n"
|
||||||
":: not upgrade pacman separately, answer no.\n"));
|
":: operation. If you wish to continue the operation and\n"
|
||||||
if(yesno(_(":: Cancel current operation? [Y/n] "))) {
|
":: not upgrade pacman separately, answer no.\n"));
|
||||||
if(alpm_trans_release() == -1) {
|
if(yesno(_(":: Cancel current operation? [Y/n] "))) {
|
||||||
fprintf(stderr, _("error: failed to release transaction (%s)\n"),
|
if(alpm_trans_release() == -1) {
|
||||||
alpm_strerrorlast());
|
fprintf(stderr, _("error: failed to release transaction (%s)\n"),
|
||||||
retval = 1;
|
alpm_strerrorlast());
|
||||||
goto cleanup;
|
retval = 1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags,
|
||||||
|
cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
|
||||||
|
fprintf(stderr, _("error: failed to init transaction (%s)\n"),
|
||||||
|
alpm_strerrorlast());
|
||||||
|
return(1);
|
||||||
|
}
|
||||||
|
if(alpm_trans_addtarget("pacman") == -1) {
|
||||||
|
fprintf(stderr, _("error: pacman: %s\n"), alpm_strerrorlast());
|
||||||
|
retval = 1;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags,
|
|
||||||
cb_trans_evt, cb_trans_conv, cb_trans_progress) == -1) {
|
|
||||||
fprintf(stderr, _("error: failed to init transaction (%s)\n"),
|
|
||||||
alpm_strerrorlast());
|
|
||||||
return(1);
|
|
||||||
}
|
|
||||||
if(alpm_trans_addtarget("pacman") == -1) {
|
|
||||||
fprintf(stderr, _("error: pacman: %s\n"), alpm_strerrorlast());
|
|
||||||
retval = 1;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user