xbps-fbulk: added -a <cross-target> support.

This commit is contained in:
Juan RP 2015-04-19 11:49:29 +02:00
parent d50a6866bc
commit e60ab98e2c

View File

@ -93,6 +93,7 @@ int NParallel = 1;
int VerboseOpt; int VerboseOpt;
int NRunning; int NRunning;
char *LogDir; char *LogDir;
char *TargetArch;
/* /*
* Item hashing and dependency helper routines, called during the * Item hashing and dependency helper routines, called during the
@ -147,7 +148,7 @@ addItem(const char *pkgn)
static void __attribute__((noreturn)) static void __attribute__((noreturn))
usage(const char *progname) 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); exit(EXIT_FAILURE);
} }
@ -360,7 +361,13 @@ runBuilds(const char *bpath)
close(fd); close(fd);
} }
/* build the current pkg! */ /* 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); _exit(99);
} else if (item->pid < 0) { } else if (item->pid < 0) {
/* /*
@ -461,7 +468,11 @@ ordered_depends(const char *bpath, const char *pkgn)
if (VerboseOpt) if (VerboseOpt)
printf("%s: collecting build dependencies...\n", pkgn); printf("%s: collecting build dependencies...\n", 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); cmd = xbps_xasprintf("%s/xbps-src show-build-deps %s 2>&1", bpath, pkgn);
fp = popen(cmd, "r"); fp = popen(cmd, "r");
while (fgets(buf, sizeof(buf), fp) != NULL) { while (fgets(buf, sizeof(buf), fp) != NULL) {
char *tmp, *tmp2, *depn; char *tmp, *tmp2, *depn;
@ -560,8 +571,11 @@ main(int argc, char **argv)
size_t blen; size_t blen;
int ch; int ch;
while ((ch = getopt(argc, argv, "j:l:v")) != -1) { while ((ch = getopt(argc, argv, "a:j:l:v")) != -1) {
switch (ch) { switch (ch) {
case 'a':
TargetArch = optarg;
break;
case 'j': case 'j':
NParallel = strtol(optarg, NULL, 0); NParallel = strtol(optarg, NULL, 0);
break; break;