mirror of
https://github.com/moparisthebest/pacman
synced 2025-01-08 12:28:00 -05:00
- fixed a regression with pacman 2.x (reworked patch from VMiklos <vmiklos@frugalware.org>):
if pacman is desiganted as a target in a sysupgrade operation, it should be able to upgrade itself first upon user request. - removed uneeded sanity checks in alpm interface calls - replaced printf by MSG in pacman
This commit is contained in:
parent
4585060a5a
commit
2c22045ba8
@ -719,8 +719,6 @@ int alpm_logaction(char *fmt, ...)
|
||||
|
||||
PMList *alpm_list_first(PMList *list)
|
||||
{
|
||||
ASSERT(list != NULL, return(NULL));
|
||||
|
||||
return(list);
|
||||
}
|
||||
|
||||
@ -740,10 +738,17 @@ void *alpm_list_getdata(PMList *entry)
|
||||
|
||||
int alpm_list_free(PMList *entry)
|
||||
{
|
||||
ASSERT(entry != NULL, return(-1));
|
||||
|
||||
FREELIST(entry);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int alpm_list_count(PMList *list)
|
||||
{
|
||||
return(_alpm_list_count(list));
|
||||
}
|
||||
/** @} */
|
||||
|
||||
/** @defgroup alpm_misc Miscellaneous Functions
|
||||
|
@ -300,6 +300,7 @@ PM_LIST *alpm_list_first(PM_LIST *list);
|
||||
PM_LIST *alpm_list_next(PM_LIST *entry);
|
||||
void *alpm_list_getdata(PM_LIST *entry);
|
||||
int alpm_list_free(PM_LIST *entry);
|
||||
int alpm_list_count(PM_LIST *list);
|
||||
|
||||
/* md5sums */
|
||||
char *alpm_get_md5sum(char *name);
|
||||
|
@ -437,14 +437,28 @@ int pacman_sync(list_t *targets)
|
||||
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
|
||||
PM_SYNCPKG *sync = alpm_list_getdata(lp);
|
||||
PM_PKG *spkg = alpm_sync_getinfo(sync, PM_SYNC_PKG);
|
||||
if(!strcmp("pacman", alpm_pkg_getinfo(spkg, PM_PKG_NAME))) {
|
||||
if(!strcmp("pacman", alpm_pkg_getinfo(spkg, PM_PKG_NAME)) && alpm_list_count(data) > 1) {
|
||||
MSG(NL, "\n:: pacman has detected a newer version of the \"pacman\" package.\n");
|
||||
MSG(NL, ":: It is recommended that you allow pacman to upgrade itself\n");
|
||||
MSG(NL, ":: first, then you can re-run the operation with the newer version.\n");
|
||||
MSG(NL, "::\n");
|
||||
if(!yesno(":: Upgrade anyway? [Y/n] ")) {
|
||||
retval = 0;
|
||||
goto cleanup;
|
||||
if(yesno(":: Upgrade pacman first? [Y/n] ")) {
|
||||
if(alpm_trans_release() == -1) {
|
||||
ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno));
|
||||
retval = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
|
||||
ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno));
|
||||
retval = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
if(alpm_trans_addtarget("pacman") == -1) {
|
||||
ERR(NL, "could not add target '%s': %s\n", (char *)i->data, alpm_strerror(pm_errno));
|
||||
retval = 1;
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -510,7 +524,7 @@ int pacman_sync(list_t *targets)
|
||||
|
||||
packages = alpm_trans_getinfo(PM_TRANS_PACKAGES);
|
||||
if(packages == NULL) {
|
||||
retval = 0;
|
||||
/* nothing to do: just exit without complaining */
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -531,17 +545,17 @@ int pacman_sync(list_t *targets)
|
||||
PM_PKG *p = alpm_list_getdata(j);
|
||||
char *pkgname = alpm_pkg_getinfo(p, PM_PKG_NAME);
|
||||
if(!list_is_strin(pkgname, list_remove)) {
|
||||
list_remove = list_add(list_remove, pkgname);
|
||||
list_remove = list_add(list_remove, strdup(pkgname));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(list_remove) {
|
||||
printf("\nRemove: ");
|
||||
MSG(NL, "\nRemove: ");
|
||||
str = buildstring(list_remove);
|
||||
indentprint(str, 9);
|
||||
printf("\n");
|
||||
FREELISTPTR(list_remove);
|
||||
MSG(CL, "\n");
|
||||
FREELIST(list_remove);
|
||||
FREE(str);
|
||||
}
|
||||
for(lp = alpm_list_first(packages); lp; lp = alpm_list_next(lp)) {
|
||||
@ -564,7 +578,7 @@ int pacman_sync(list_t *targets)
|
||||
MSG(NL, "\nTargets: ");
|
||||
str = buildstring(list_install);
|
||||
indentprint(str, 9);
|
||||
MSG(NL, "\nTotal Package Size: %.1f MB\n", mb);
|
||||
MSG(NL, "Total Package Size: %.1f MB\n", mb);
|
||||
FREELIST(list_install);
|
||||
FREE(str);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user