xbps-fbulk: added support to just building pkgs specified as arguments.

xbps-fbulk [options] void-packages [pkg pkgN]
This commit is contained in:
Juan RP 2015-05-04 18:12:52 +02:00
parent 6f74fd6110
commit 9f08ec5123

View File

@ -148,7 +148,8 @@ addItem(const char *pkgn)
static void __attribute__((noreturn)) static void __attribute__((noreturn))
usage(const char *progname) usage(const char *progname)
{ {
fprintf(stderr, "%s [-a targetarch] [-j parallel] [-l logdir] /path/to/void-packages\n", progname); fprintf(stderr, "%s [-a targetarch] [-j parallel] [-l logdir] "
"/path/to/void-packages [pkg pkgN]\n", progname);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -566,7 +567,7 @@ main(int argc, char **argv)
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc != 1) { if (argc < 1) {
usage(progname); usage(progname);
/* NOT REACHED */ /* NOT REACHED */
} }
@ -646,6 +647,7 @@ main(int argc, char **argv)
if ((dir = opendir(rpath)) != NULL) { if ((dir = opendir(rpath)) != NULL) {
while ((den = readdir(dir)) != NULL) { while ((den = readdir(dir)) != NULL) {
char *xpath; char *xpath;
bool found = false;
if (den->d_name[0] == '.') if (den->d_name[0] == '.')
continue; continue;
@ -656,6 +658,20 @@ main(int argc, char **argv)
if (!S_ISDIR(st.st_mode)) if (!S_ISDIR(st.st_mode))
continue; continue;
if (argc == 1) {
/* process all pkgs */
found = true;
}
/* only process pkgs specified as arguments */
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], den->d_name) == 0) {
found = true;
break;
}
}
if (!found)
continue;
xpath = xbps_xasprintf("%s/template", den->d_name); xpath = xbps_xasprintf("%s/template", den->d_name);
if (lookupItem(den->d_name) == NULL && if (lookupItem(den->d_name) == NULL &&