[pacman-dev,1/3] pacman-conf: add support for new ParallelDownloads config option

Message ID 20200510043240.1631106-1-eschwartz@archlinux.org
State Accepted, archived
Headers show
Series [pacman-dev,1/3] pacman-conf: add support for new ParallelDownloads config option | expand

Commit Message

Eli Schwartz May 10, 2020, 4:32 a.m. UTC
This was forgotten in the initial implementation, so it was impossible
to figure out the value from a script, or correctly roundtrip the
config file.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---
 src/pacman/pacman-conf.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Allan McRae May 10, 2020, 8:04 a.m. UTC | #1
On 10/5/20 2:32 pm, Eli Schwartz wrote:
> This was forgotten in the initial implementation, so it was impossible
> to figure out the value from a script, or correctly roundtrip the
> config file.
> 
> Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
> ---
>  src/pacman/pacman-conf.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)

OK.

> diff --git a/src/pacman/pacman-conf.c b/src/pacman/pacman-conf.c
> index 60739bf6..d76c0985 100644
> --- a/src/pacman/pacman-conf.c
> +++ b/src/pacman/pacman-conf.c
> @@ -142,6 +142,14 @@ static void show_str(const char *directive, const char *val)
>  	printf("%s%c", val, sep);
>  }
>  
> +static void show_int(const char *directive, unsigned int val)
> +{
> +	if (verbose) {
> +		printf("%s = ", directive);
> +	}
> +	printf("%u%c", val, sep);
> +}
> +
>  static void show_list_str(const char *directive, alpm_list_t *list)
>  {
>  	alpm_list_t *i;
> @@ -261,6 +269,8 @@ static void dump_config(void)
>  	show_bool("ILoveCandy", config->chomp);
>  	show_bool("NoProgressBar", config->noprogressbar);
>  
> +	show_int("ParallelDownloads", config->parallel_downloads);
> +
>  	show_cleanmethod("CleanMethod", config->cleanmethod);
>  
>  	show_siglevel("SigLevel", config->siglevel, 0);
> @@ -372,6 +382,9 @@ static int list_directives(void)
>  		} else if(strcasecmp(i->data, "NoProgressBar") == 0) {
>  			show_bool("NoProgressBar", config->noprogressbar);
>  
> +		} else if(strcasecmp(i->data, "ParallelDownloads") == 0) {
> +			show_int("ParallelDownloads", config->parallel_downloads);
> +
>  		} else if(strcasecmp(i->data, "CleanMethod") == 0) {
>  			show_cleanmethod("CleanMethod", config->cleanmethod);
>  
>

Patch

diff --git a/src/pacman/pacman-conf.c b/src/pacman/pacman-conf.c
index 60739bf6..d76c0985 100644
--- a/src/pacman/pacman-conf.c
+++ b/src/pacman/pacman-conf.c
@@ -142,6 +142,14 @@  static void show_str(const char *directive, const char *val)
 	printf("%s%c", val, sep);
 }
 
+static void show_int(const char *directive, unsigned int val)
+{
+	if (verbose) {
+		printf("%s = ", directive);
+	}
+	printf("%u%c", val, sep);
+}
+
 static void show_list_str(const char *directive, alpm_list_t *list)
 {
 	alpm_list_t *i;
@@ -261,6 +269,8 @@  static void dump_config(void)
 	show_bool("ILoveCandy", config->chomp);
 	show_bool("NoProgressBar", config->noprogressbar);
 
+	show_int("ParallelDownloads", config->parallel_downloads);
+
 	show_cleanmethod("CleanMethod", config->cleanmethod);
 
 	show_siglevel("SigLevel", config->siglevel, 0);
@@ -372,6 +382,9 @@  static int list_directives(void)
 		} else if(strcasecmp(i->data, "NoProgressBar") == 0) {
 			show_bool("NoProgressBar", config->noprogressbar);
 
+		} else if(strcasecmp(i->data, "ParallelDownloads") == 0) {
+			show_int("ParallelDownloads", config->parallel_downloads);
+
 		} else if(strcasecmp(i->data, "CleanMethod") == 0) {
 			show_cleanmethod("CleanMethod", config->cleanmethod);