From e60ab98e2ca1444849fe9c5310d6e576a936dec4 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 19 Apr 2015 11:49:29 +0200 Subject: [PATCH] xbps-fbulk: added -a support. --- bin/xbps-fbulk/main.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/bin/xbps-fbulk/main.c b/bin/xbps-fbulk/main.c index 971ae09b..710b21fc 100644 --- a/bin/xbps-fbulk/main.c +++ b/bin/xbps-fbulk/main.c @@ -93,6 +93,7 @@ int NParallel = 1; int VerboseOpt; int NRunning; char *LogDir; +char *TargetArch; /* * Item hashing and dependency helper routines, called during the @@ -147,7 +148,7 @@ addItem(const char *pkgn) static void __attribute__((noreturn)) usage(const char *progname) { - fprintf(stderr, "%s [-j parallel] [-l logdir] /path/to/void-packages\n", progname); + fprintf(stderr, "%s [-a targetarch] [-j parallel] [-l logdir] /path/to/void-packages\n", progname); exit(EXIT_FAILURE); } @@ -360,7 +361,13 @@ runBuilds(const char *bpath) close(fd); } /* build the current pkg! */ - execl("./xbps-src", "./xbps-src", "-E", "-N", "-t", "pkg", item->pkgn, NULL); + if (TargetArch != NULL) + execl("./xbps-src", "./xbps-src", "-a", TargetArch, + "-E", "-N", "-t", "pkg", item->pkgn, NULL); + else + execl("./xbps-src", "./xbps-src", + "-E", "-N", "-t", "pkg", item->pkgn, NULL); + _exit(99); } else if (item->pid < 0) { /* @@ -461,7 +468,11 @@ ordered_depends(const char *bpath, const char *pkgn) if (VerboseOpt) printf("%s: collecting build dependencies...\n", pkgn); - cmd = xbps_xasprintf("%s/xbps-src show-build-deps %s 2>&1", bpath, pkgn); + if (TargetArch != NULL) + cmd = xbps_xasprintf("%s/xbps-src -a %s show-build-deps %s 2>&1", bpath, TargetArch, pkgn); + else + cmd = xbps_xasprintf("%s/xbps-src show-build-deps %s 2>&1", bpath, pkgn); + fp = popen(cmd, "r"); while (fgets(buf, sizeof(buf), fp) != NULL) { char *tmp, *tmp2, *depn; @@ -560,8 +571,11 @@ main(int argc, char **argv) size_t blen; int ch; - while ((ch = getopt(argc, argv, "j:l:v")) != -1) { + while ((ch = getopt(argc, argv, "a:j:l:v")) != -1) { switch (ch) { + case 'a': + TargetArch = optarg; + break; case 'j': NParallel = strtol(optarg, NULL, 0); break;