This will be used in the next commit. Signed-off-by: Nathan Jones <nathanj@insightbb.com> --- doc/pacman.conf.5.txt | 4 ++++ lib/libalpm/alpm.h | 1 + lib/libalpm/handle.c | 6 ++++++ lib/libalpm/handle.h | 2 ++ src/pacman/pacman.c | 3 +++ 5 files changed, 16 insertions(+), 0 deletions(-) diff --git a/doc/pacman.conf.5.txt b/doc/pacman.conf.5.txt index 06ba81d..c9783c8 100644 --- a/doc/pacman.conf.5.txt +++ b/doc/pacman.conf.5.txt @@ -109,6 +109,10 @@ Options Download delta files instead of complete packages if possible. Requires the xdelta program to be installed. +*TotalDownload*:: + When downloading, display the completed percentage as the percent of + the entire download list list rather than the percent of each + individual download target. Repository Sections ------------------- diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 20d7787..5170c15 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -139,6 +139,7 @@ void alpm_option_set_xfercommand(const char *cmd); unsigned short alpm_option_get_nopassiveftp(); void alpm_option_set_nopassiveftp(unsigned short nopasv); void alpm_option_set_usedelta(unsigned short usedelta); +void alpm_option_set_totaldownload(unsigned short totaldownload); pmdb_t *alpm_option_get_localdb(); alpm_list_t *alpm_option_get_syncdbs(); diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index af54949..fed4d9c 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -65,6 +65,7 @@ pmhandle_t *_alpm_handle_new() handle->lockfile = NULL; handle->logfile = NULL; handle->usedelta = 0; + handle->totaldownload = 0; return(handle); } @@ -482,4 +483,9 @@ void SYMEXPORT alpm_option_set_usedelta(unsigned short usedelta) handle->usedelta = usedelta; } +void SYMEXPORT alpm_option_set_totaldownload(unsigned short totaldownload) +{ + handle->totaldownload = totaldownload; +} + /* vim: set ts=2 sw=2 noet: */ diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 0874ecd..f2c0453 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -62,6 +62,8 @@ typedef struct _pmhandle_t { time_t upgradedelay; /* Time to wait before upgrading a package */ char *xfercommand; /* External download command */ unsigned short usedelta; /* Download deltas if possible */ + unsigned short totaldownload;/* When downloading, display the percent + downloaded of the total download list */ } pmhandle_t; /* global handle variable */ diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 9c650f2..795f1e0 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -572,6 +572,9 @@ static int _parseconfig(const char *file, const char *givensection, } else if(strcmp(key, "UseDelta") == 0 || strcmp(upperkey, "USEDELTA") == 0) { alpm_option_set_usedelta(1); pm_printf(PM_LOG_DEBUG, "config: usedelta\n"); + } else if(strcmp(key, "TotalDownload") == 0 || strcmp(upperkey, "TOTALDOWNLOAD") == 0) { + alpm_option_set_totaldownload(1); + pm_printf(PM_LOG_DEBUG, "config: totaldownload\n"); } else { pm_printf(PM_LOG_ERROR, _("config file %s, line %d: directive '%s' not recognized.\n"), file, linenum, key); -- 1.5.3.5