Skip to content

Commit a051794

Browse files
committed
bin/xbps-rindex: add --repository arg
1 parent de07d61 commit a051794

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

bin/xbps-rindex/main.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include <getopt.h>
3131

3232
#include "defs.h"
33+
#include "xbps/xbps_array.h"
3334

3435
static void __attribute__((noreturn))
3536
usage(bool fail)
@@ -46,6 +47,7 @@ usage(bool fail)
4647
" --compression <fmt> Compression format: none, gzip, bzip2, lz4, xz, zstd (default)\n"
4748
" --privkey <key> Path to the private key for signing\n"
4849
" --signedby <string> Signature details, i.e \"name <email>\"\n\n"
50+
" -R, --repository <dir> Add a local repository\n"
4951
"MODE\n"
5052
" -a, --add <repodir/file.xbps> ... Add package(s) to repository index\n"
5153
" -c, --clean <repodir> Clean repository index\n"
@@ -58,7 +60,7 @@ usage(bool fail)
5860
int
5961
main(int argc, char **argv)
6062
{
61-
const char *shortopts = "acdfhrsCSVv";
63+
const char *shortopts = "acdfhrR:sCSVv";
6264
struct option longopts[] = {
6365
{ "add", no_argument, NULL, 'a' },
6466
{ "clean", no_argument, NULL, 'c' },
@@ -74,12 +76,14 @@ main(int argc, char **argv)
7476
{ "sign-pkg", no_argument, NULL, 'S'},
7577
{ "hashcheck", no_argument, NULL, 'C' },
7678
{ "compression", required_argument, NULL, 2},
79+
{ "repository", required_argument, NULL, 'R'},
7780
{ NULL, 0, NULL, 0 }
7881
};
7982
struct xbps_handle xh;
8083
const char *compression = NULL;
8184
const char *privkey = NULL, *signedby = NULL;
8285
int rv, c, flags = 0;
86+
xbps_array_t repos = NULL;
8387
bool add_mode, clean_mode, rm_mode, sign_mode, sign_pkg_mode, force,
8488
hashcheck;
8589

@@ -121,6 +125,14 @@ main(int argc, char **argv)
121125
case 'C':
122126
hashcheck = true;
123127
break;
128+
case 'R':
129+
if (!repos)
130+
repos = xbps_array_create();
131+
if (!repos || !xbps_array_add_cstring(repos, optarg)) {
132+
xbps_error_oom();
133+
exit(1);
134+
}
135+
break;
124136
case 'S':
125137
sign_pkg_mode = true;
126138
break;

0 commit comments

Comments
 (0)