1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-02-28 17:31:52 -05:00

* Fixed some alpm_get_option calls (long params were used for C99 compliance,

but were used in error)
* Cleaned up some output newlines
* Added "local database is up to date" when no packages are upgraded
This commit is contained in:
Aaron Griffin 2006-11-02 02:29:10 +00:00
parent 22ce4a2a00
commit fbf1aa6539
6 changed files with 27 additions and 29 deletions

View File

@ -164,6 +164,9 @@ int yesno(char *fmt, ...)
*++pch = 0;
strtrim(response);
/* User hits 'enter', forcing a newline here */
neednl = 0;
if(!strcasecmp(response, _("Y")) || !strcasecmp(response, _("YES")) || !strlen(response)) {
return(1);
}

View File

@ -91,7 +91,7 @@ void dump_pkg_full(PM_PKG *pkg, int level)
long lroot;
char *root;
alpm_get_option(PM_OPT_ROOT, &lroot);
root = (void *)&root;
root = (void *)lroot;
fprintf(stdout, "\n");
for(i = alpm_list_first(alpm_pkg_getinfo(pkg, PM_PKG_BACKUP)); i; i = alpm_list_next(i)) {
struct stat buf;

View File

@ -543,10 +543,10 @@ int main(int argc, char *argv[])
FREE(config->dbpath);
long ldbpath, lcachedir;
alpm_get_option(PM_OPT_DBPATH, &ldbpath);
config->dbpath = (void *)&ldbpath;
config->dbpath = (char *)ldbpath;
FREE(config->cachedir);
alpm_get_option(PM_OPT_CACHEDIR, &lcachedir);
config->cachedir = (void *)&lcachedir;
config->cachedir = (char *)lcachedir;
for(lp = config->op_s_ignore; lp; lp = lp->next) {
if(alpm_set_option(PM_OPT_IGNOREPKG, (long)lp->data) == -1) {

View File

@ -63,7 +63,7 @@ static int query_fileowner(PM_DB *db, char *filename)
}
alpm_get_option(PM_OPT_ROOT, &lroot);
root = (void *)&lroot;
root = (char *)lroot;
for(lp = alpm_db_getpkgcache(db); lp && !gotcha; lp = alpm_list_next(lp)) {
PM_PKG *info;
@ -74,9 +74,10 @@ static int query_fileowner(PM_DB *db, char *filename)
for(i = alpm_pkg_getinfo(info, PM_PKG_FILES); i && !gotcha; i = alpm_list_next(i)) {
char path[PATH_MAX];
snprintf(path, PATH_MAX, "%s%s", root, (char *)alpm_list_getdata(i));
char *filename = (char *)alpm_list_getdata(i);
snprintf(path, PATH_MAX, "%s%s", root, filename);
if(!strcmp(path, rpath)) {
printf(_("%s is owned by %s %s\n"), filename, (char *)alpm_pkg_getinfo(info, PM_PKG_NAME),
printf(_("%s is owned by %s %s\n"), path, (char *)alpm_pkg_getinfo(info, PM_PKG_NAME),
(char *)alpm_pkg_getinfo(info, PM_PKG_VERSION));
gotcha = 1;
break;
@ -266,7 +267,7 @@ int pacman_query(list_t *targets)
long ldbpath;
char *dbpath;
alpm_get_option(PM_OPT_DBPATH, &ldbpath);
dbpath = (void *)&ldbpath;
dbpath = (char *)ldbpath;
snprintf(changelog, PATH_MAX, "%s%s/%s/%s-%s/changelog",
config->root, dbpath,
(char*)alpm_db_getinfo(db_local, PM_DB_TREENAME),

View File

@ -173,13 +173,18 @@ static int sync_synctree(int level, list_t *syncs)
} else {
ERR(NL, _("failed to update %s (%s)\n"), sync->treename, alpm_strerror(pm_errno));
}
success--;
} else if(ret == 1) {
MSG(NL, _(" %s is up to date\n"), sync->treename);
} else {
success++;
}
}
return(success);
/* We should always succeed if at least one DB was upgraded - we may possibly
* fail later with unresolved deps, but that should be rare, and would be
* expected
*/
return(success > 0);
}
static int sync_search(list_t *syncs, list_t *targets)
@ -569,6 +574,7 @@ int pacman_sync(list_t *targets)
packages = alpm_trans_getinfo(PM_TRANS_PACKAGES);
if(packages == NULL) {
/* nothing to do: just exit without complaining */
MSG(NL," local database is up to date");
goto cleanup;
}

View File

@ -70,8 +70,6 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
case PM_TRANS_EVT_FILECONFLICTS_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
} else {
MSG(NL, "");
}
break;
case PM_TRANS_EVT_CHECKDEPS_DONE:
@ -80,8 +78,8 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
pm_fprintf(stderr, CL, _("done.\n"));
break;
case PM_TRANS_EVT_EXTRACT_DONE:
if(!config->noprogressbar) {
MSG(NL, "");
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
}
break;
case PM_TRANS_EVT_ADD_START:
@ -106,8 +104,6 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
case PM_TRANS_EVT_REMOVE_DONE:
if(config->noprogressbar) {
MSG(CL, _("done.\n"));
} else {
MSG(NL, "");
}
snprintf(str, LOG_STR_LEN, _("removed %s (%s)"),
(char *)alpm_pkg_getinfo(data1, PM_PKG_NAME),
@ -153,7 +149,7 @@ void cb_trans_evt(unsigned char event, void *data1, void *data2)
MSG(NL, "%s%s\n", (char*)data1, (char*)data2);
break;
case PM_TRANS_EVT_RETRIEVE_START:
MSG(NL, _("\n:: Retrieving packages from %s...\n"), (char*)data1);
MSG(NL, _(":: Retrieving packages from %s...\n"), (char*)data1);
fflush(stdout);
break;
case PM_TRANS_EVT_RETRIEVE_LOCAL:
@ -292,11 +288,7 @@ void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howm
int i, hash;
long chomp = 0;
unsigned int maxpkglen, progresslen = maxcols - 57;
char *addstr, *upgstr, *removestr, *conflictstr, *ptr = NULL;
addstr = strdup(_("installing"));
upgstr = strdup(_("upgrading"));
removestr = strdup(_("removing"));
conflictstr = strdup(_("checking for file conflicts"));
char *ptr = NULL;
if(config->noprogressbar) {
return;
@ -312,19 +304,19 @@ void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howm
prevpercent=percent;
switch (event) {
case PM_TRANS_PROGRESS_ADD_START:
ptr = addstr;
ptr = _("installing");
break;
case PM_TRANS_PROGRESS_UPGRADE_START:
ptr = upgstr;
ptr = _("upgrading");
break;
case PM_TRANS_PROGRESS_REMOVE_START:
ptr = removestr;
ptr = _("removing");
break;
case PM_TRANS_PROGRESS_CONFLICTS_START:
ptr = conflictstr;
ptr = _("checking for file conflicts");
break;
}
hash=percent*progresslen/100;
@ -399,10 +391,6 @@ void cb_trans_progress(unsigned char event, char *pkgname, int percent, int howm
if(percent == 100) {
printf("\n");
}
FREE(addstr);
FREE(upgstr);
FREE(removestr);
}
/* vim: set ts=2 sw=2 noet: */