index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | lib/libalpm/alpm.h | 1 | ||||
-rw-r--r-- | lib/libalpm/be_package.c | 2 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 12 | ||||
-rw-r--r-- | src/pacman/callback.c | 9 | ||||
-rw-r--r-- | src/pacman/util.c | 4 |
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 32a2856c..7c4cd48b 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -395,6 +395,7 @@ typedef enum _pmtransprog_t { PM_TRANS_PROGRESS_REMOVE_START, PM_TRANS_PROGRESS_CONFLICTS_START, PM_TRANS_PROGRESS_DISKSPACE_START, + PM_TRANS_PROGRESS_INTEGRITY_START, } pmtransprog_t; /* Transaction Event callback */ diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 42f33599..b69161b4 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -279,6 +279,8 @@ static pmpkg_t *pkg_load(const char *pkgfile, int full) newpkg->filename = strdup(pkgfile); newpkg->size = st.st_size; + _alpm_log(PM_LOG_DEBUG, "starting package load for %s\n", pkgfile); + /* If full is false, only read through the archive until we find our needed * metadata. If it is true, read through the entire archive, which serves * as a verfication of integrity and allows us to create the filelist. */ diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index dce1daff..b1eab55b 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -822,7 +822,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) { alpm_list_t *i, *j, *files = NULL; alpm_list_t *deltas = NULL; - size_t replaces = 0; + size_t numtargs, current = 0, replaces = 0; int errors = 0; const char *cachedir = NULL; int ret = -1; @@ -949,14 +949,18 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) } /* Check integrity of packages */ + numtargs = alpm_list_count(trans->add); EVENT(trans, PM_TRANS_EVT_INTEGRITY_START, NULL, NULL); errors = 0; for(i = trans->add; i; i = i->next) { pmpkg_t *spkg = i->data; + int percent = (current * 100) / numtargs; if(spkg->origin == PKG_FROM_FILE) { continue; /* pkg_load() has been already called, this package is valid */ } + PROGRESS(trans, PM_TRANS_PROGRESS_INTEGRITY_START, "", percent, + numtargs, current); const char *filename = alpm_pkg_get_filename(spkg); const char *md5sum = alpm_pkg_get_md5sum(spkg); @@ -982,12 +986,16 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) pkgfile->reason = spkg->reason; /* copy over install reason */ i->data = pkgfile; _alpm_pkg_free_trans(spkg); /* spkg has been removed from the target list */ + current++; } + PROGRESS(trans, PM_TRANS_PROGRESS_INTEGRITY_START, "", 100, + numtargs, current); + EVENT(trans, PM_TRANS_EVT_INTEGRITY_DONE, NULL, NULL); if(errors) { pm_errno = PM_ERR_PKG_INVALID; goto error; } - EVENT(trans, PM_TRANS_EVT_INTEGRITY_DONE, NULL, NULL); + if(trans->flags & PM_TRANS_FLAG_DOWNLOADONLY) { ret = 0; goto error; diff --git a/src/pacman/callback.c b/src/pacman/callback.c index da07b161..e3feea16 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -161,7 +161,7 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2) break; case PM_TRANS_EVT_FILECONFLICTS_START: if(config->noprogressbar) { - printf(_("checking for file conflicts...\n")); + printf(_("checking for file conflicts...\n")); } break; case PM_TRANS_EVT_RESOLVEDEPS_START: @@ -204,7 +204,9 @@ void cb_trans_evt(pmtransevt_t event, void *data1, void *data2) display_new_optdepends(data2,data1); break; case PM_TRANS_EVT_INTEGRITY_START: - printf(_("checking package integrity...\n")); + if(config->noprogressbar) { + printf(_("checking package integrity...\n")); + } break; case PM_TRANS_EVT_DELTA_INTEGRITY_START: printf(_("checking delta integrity...\n")); @@ -374,6 +376,9 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, case PM_TRANS_PROGRESS_DISKSPACE_START: opr = _("checking available disk space"); break; + case PM_TRANS_PROGRESS_INTEGRITY_START: + opr = _("checking package integrity"); + break; default: return; } diff --git a/src/pacman/util.c b/src/pacman/util.c index fbc1a184..d91d1d43 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -523,7 +523,9 @@ void display_targets(const alpm_list_t *pkgs, int install) for(i = pkgs; i; i = alpm_list_next(i)) { pmpkg_t *pkg = alpm_list_getdata(i); - dlsize += alpm_pkg_download_size(pkg); + if(install) { + dlsize += alpm_pkg_download_size(pkg); + } isize += alpm_pkg_get_isize(pkg); /* print the package size with the output if ShowSize option set */ |