1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-04 16:45:07 -05:00

* Fix total transfered size on download bar

* Fix -Qm segfault
* Minor query cleanup
This commit is contained in:
Aaron Griffin 2007-02-07 05:25:45 +00:00
parent ca4078b115
commit ad224b2703
2 changed files with 35 additions and 46 deletions

View File

@ -147,7 +147,7 @@ void log_progress(const char *filename, int xfered, int total)
} }
printf(" %-*s %6d%c %#6.1f%c/s %02u:%02u:%02u", FILENAME_TRIM_LEN, fname, printf(" %-*s %6d%c %#6.1f%c/s %02u:%02u:%02u", FILENAME_TRIM_LEN, fname,
xfered/1024, xfered_size, rate, rate_size, eta_h, eta_m, eta_s); xfered, xfered_size, rate, rate_size, eta_h, eta_m, eta_s);
free(fname); free(fname);

View File

@ -81,7 +81,7 @@ static void query_fileowner(pmdb_t *db, char *filename)
int pacman_query(alpm_list_t *targets) int pacman_query(alpm_list_t *targets)
{ {
alpm_list_t *sync_dbs = NULL, *i, *j;; alpm_list_t *sync_dbs = NULL, *i, *j, *k;
pmpkg_t *info = NULL; pmpkg_t *info = NULL;
char *package = NULL; char *package = NULL;
int done = 0; int done = 0;
@ -224,16 +224,15 @@ int pacman_query(alpm_list_t *targets)
if(info == NULL) { if(info == NULL) {
/* something weird happened */ /* something weird happened */
ERR(NL, _("package \"%s\" not found\n"), pkgname); ERR(NL, _("package \"%s\" not found\n"), pkgname);
/* do not return on query operations - let's just carry on */
/*return(1);*/
continue; continue;
} }
}
if(config->op_q_foreign) { if(config->op_q_foreign) {
int match = 0; int match = 0;
for(i = sync_dbs; i; i = alpm_list_next(i)) { for(j = sync_dbs; j; j = alpm_list_next(j)) {
pmdb_t *db = (pmdb_t *)alpm_list_getdata(i); pmdb_t *db = (pmdb_t *)alpm_list_getdata(j);
for(j = alpm_db_getpkgcache(db); j; j = alpm_list_next(j)) { for(k = alpm_db_getpkgcache(db); k; k = alpm_list_next(k)) {
pmpkg_t *pkg = alpm_list_getdata(j); pmpkg_t *pkg = alpm_list_getdata(k);
if(strcmp(alpm_pkg_get_name(pkg), alpm_pkg_get_name(info)) == 0) { if(strcmp(alpm_pkg_get_name(pkg), alpm_pkg_get_name(info)) == 0) {
match = 1; match = 1;
} }
@ -242,32 +241,25 @@ int pacman_query(alpm_list_t *targets)
if(match==0) { if(match==0) {
MSG(NL, "%s %s\n", pkgname, pkgver); MSG(NL, "%s %s\n", pkgname, pkgver);
} }
} } else if(config->op_q_list) {
if(config->op_q_list) {
dump_pkg_files(info); dump_pkg_files(info);
} } else if(config->op_q_orphans) {
if(config->op_q_orphans) {
if(alpm_pkg_get_requiredby(info) == NULL if(alpm_pkg_get_requiredby(info) == NULL
&& (long)alpm_pkg_get_reason(info) == PM_PKG_REASON_DEPEND) { && (long)alpm_pkg_get_reason(info) == PM_PKG_REASON_DEPEND) {
MSG(NL, "%s %s\n", pkgname, pkgver); MSG(NL, "%s %s\n", pkgname, pkgver);
} }
}
} else { } else {
MSG(NL, "%s %s\n", pkgname, pkgver); MSG(NL, "%s %s\n", pkgname, pkgver);
} }
} }
} else { } else {
info = alpm_db_readpkg(db_local, package); info = alpm_db_readpkg(db_local, package);
if(info == NULL) { if(info == NULL) {
ERR(NL, _("package \"%s\" not found\n"), package); ERR(NL, _("package \"%s\" not found\n"), package);
/* do not return on query operations - let's just carry on */
/*return(2);*/
continue; continue;
} }
/* find a target */ /* find a target */
if(config->op_q_changelog || config->op_q_info || config->op_q_list) {
if(config->op_q_changelog) { if(config->op_q_changelog) {
char changelog[PATH_MAX]; char changelog[PATH_MAX];
snprintf(changelog, PATH_MAX, "%s%s/%s/%s-%s/changelog", snprintf(changelog, PATH_MAX, "%s%s/%s/%s-%s/changelog",
@ -276,13 +268,10 @@ int pacman_query(alpm_list_t *targets)
alpm_pkg_get_name(info), alpm_pkg_get_name(info),
alpm_pkg_get_version(info)); alpm_pkg_get_version(info));
dump_pkg_changelog(changelog, alpm_pkg_get_name(info)); dump_pkg_changelog(changelog, alpm_pkg_get_name(info));
} } else if(config->op_q_info) {
if(config->op_q_info) {
dump_pkg_full(info, config->op_q_info); dump_pkg_full(info, config->op_q_info);
} } else if(config->op_q_list) {
if(config->op_q_list) {
dump_pkg_files(info); dump_pkg_files(info);
}
} else if(config->op_q_orphans) { } else if(config->op_q_orphans) {
if(alpm_pkg_get_requiredby(info) == NULL) { if(alpm_pkg_get_requiredby(info) == NULL) {
MSG(NL, "%s %s\n", alpm_pkg_get_name(info), alpm_pkg_get_version(info)); MSG(NL, "%s %s\n", alpm_pkg_get_name(info), alpm_pkg_get_version(info));