Skip to content

Commit b875cdb

Browse files
committed
lib: add fetch_jobs configuration option
1 parent f64a0af commit b875cdb

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

bin/xbps-install/main.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ usage(bool fail)
5757
" -M, --memory-sync Remote repository data is fetched and stored\n"
5858
" in memory, ignoring on-disk repodata archives\n"
5959
" -n, --dry-run Dry-run mode\n"
60+
" -p, --parallel-download <n> Number of parallel fetch jobs\n"
6061
" -R, --repository <url> Add repository to the top of the list\n"
6162
" This option can be specified multiple times\n"
6263
" -r, --rootdir <dir> Full path to rootdir\n"
@@ -97,7 +98,7 @@ repo_import_key_cb(struct xbps_repo *repo, void *arg UNUSED, bool *done UNUSED)
9798
int
9899
main(int argc, char **argv)
99100
{
100-
const char *shortopts = "AC:c:DdfhIiMnR:r:SuUVvy";
101+
const char *shortopts = "AC:c:DdfhIip:MnR:r:SuUVvy";
101102
const struct option longopts[] = {
102103
{ "automatic", no_argument, NULL, 'A' },
103104
{ "config", required_argument, NULL, 'C' },
@@ -110,6 +111,7 @@ main(int argc, char **argv)
110111
{ "ignore-file-conflicts", no_argument, NULL, 'I' },
111112
{ "memory-sync", no_argument, NULL, 'M' },
112113
{ "dry-run", no_argument, NULL, 'n' },
114+
{ "parallel-download", required_argument, NULL, 'p' },
113115
{ "repository", required_argument, NULL, 'R' },
114116
{ "rootdir", required_argument, NULL, 'r' },
115117
{ "sync", no_argument, NULL, 'S' },
@@ -134,6 +136,7 @@ main(int argc, char **argv)
134136
syncf = yes = force = drun = update = false;
135137

136138
memset(&xh, 0, sizeof(xh));
139+
xh.fetch_jobs = 1;
137140

138141
while ((c = getopt_long(argc, argv, shortopts, longopts, NULL)) != -1) {
139142
switch (c) {
@@ -179,6 +182,11 @@ main(int argc, char **argv)
179182
case 'n':
180183
drun = true;
181184
break;
185+
case 'p':
186+
xh.fetch_jobs = atoi(optarg);
187+
if (xh.fetch_jobs <= 0)
188+
xh.fetch_jobs = 1;
189+
break;
182190
case 'R':
183191
xbps_repo_store(&xh, optarg);
184192
break;

bin/xbps-install/xbps-install.1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ for in memory sync.
138138
.Pp
139139
The output will be a line for each action in the following format:
140140
.D1 <pkgver> <action> <arch> <repository> <installedsize> <downloadsize>
141+
.Fl p , Fl -parallel-download
142+
.Ar jobs
143+
Set the number of parallel downloads when fetching binary packages
144+
from remote repositories. The default value is 1, which performs
145+
downloads sequentially. Increasing this value allows multiple
146+
packages to be downloaded concurrently and may improve performance
147+
on high bandwidth or high latency connections.
141148
.It Fl R , Fl -repository Ar url
142149
Appends the specified repository to the top of the list.
143150
The

0 commit comments

Comments
 (0)