@@ -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)
9798int
9899main (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 ;
0 commit comments