tags 851226 + patch thanks something like this would work
>From d378bef5d7162411e74a405c02c137176727ba7b Mon Sep 17 00:00:00 2001 From: Niv Sardi <xa...@debian.org> Date: Fri, 13 Jan 2017 04:55:46 -0300 Subject: [PATCH] pass debootstrapopts to debootstrap in qemubuilder
This is needed to be able to pass arguments down to debootstrap to be in accordance with documentation We introduce a new debootstrapcommandline that we maintain the same way pbuildercommandline is handled Signed-off-by: Niv Sardi <xa...@debian.org> --- parameter.c | 10 ++++++++-- parameter.h | 9 +++++++++ qemubuilder.c | 19 +++++++++++-------- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/parameter.c b/parameter.c index 2d5ed45..c95dfdc 100644 --- a/parameter.c +++ b/parameter.c @@ -43,7 +43,8 @@ PBUILDER_ADD_PARAM(NULL); */ char* pbuildercommandline[MAXPBUILDERCOMMANDLINE]; int offset=2; - +char* debootstrapcommandline[MAXDEBOOTSTRAPCOMMANDLINE]; +int debootstrapcommandlineoffset=2; /* get size of Null Terminated array of strings @@ -399,6 +400,7 @@ int parse_parameter(int ac, char** av, {"architecture", required_argument, 0, 0}, {"http-proxy", required_argument, 0, 0}, {"allow-untrusted", no_argument, 0, 0}, + {"debootstrapopts", required_argument, 0, 0}, /* cowbuilder specific options */ {"no-cowdancer-update", no_argument, 0, 0}, @@ -416,7 +418,6 @@ int parse_parameter(int ac, char** av, {"keyring", required_argument, 0, 'M'}, {"timeout", required_argument, 0, 'M'}, {"bindmounts", required_argument, 0, 'M'}, - {"debootstrapopts", required_argument, 0, 'M'}, {"debootstrap", required_argument, 0, 'M'}, /* verbatim options without argument, synced as of pbuilder 0.153 */ @@ -654,6 +655,11 @@ int parse_parameter(int ac, char** av, pc.allow_untrusted=1; PBUILDER_ADD_PARAM(cmdstr); } + else if (!strcmp(long_options[index_point].name,"debootstrapopts")) + { + DEBOOTSTRAP_ADD_PARAM(strdup(optarg)); + PASS_TO_PBUILDER_WITH_PARAM + } break; case 'h': /* -h */ case 'v': /* -v --version */ diff --git a/parameter.h b/parameter.h index ec9e94a..20c5e50 100644 --- a/parameter.h +++ b/parameter.h @@ -114,5 +114,14 @@ PBUILDER_ADD_PARAM(NULL); extern char* pbuildercommandline[MAXPBUILDERCOMMANDLINE]; extern int offset; +#define MAXDEBOOTSTRAPCOMMANDLINE 256 +#define DEBOOTSTRAP_ADD_PARAM(a) \ + if(debootstrapcommandlineoffset<(MAXDEBOOTSTRAPCOMMANDLINE-1)) \ + {debootstrapcommandline[debootstrapcommandlineoffset++]=a;} \ + else \ + {debootstrapcommandline[debootstrapcommandlineoffset]=NULL; log_printf(log_error, "debootstrap-command-line: Max command-line exceeded\n");} +extern char* debootstrapcommandline[MAXDEBOOTSTRAPCOMMANDLINE]; +extern int debootstrapcommandlineoffset; + #endif diff --git a/qemubuilder.c b/qemubuilder.c index fdf8b26..2b9bf23 100755 --- a/qemubuilder.c +++ b/qemubuilder.c @@ -1091,6 +1091,16 @@ int cpbuilder_create(const struct pbuilderconfig* pc) char* t; char* timestring; + debootstrapcommandline[0] = "debootstrap"; + debootstrapcommandline[1] = "debootstrap"; + DEBOOTSTRAP_ADD_PARAM("--arch"); + DEBOOTSTRAP_ADD_PARAM(pc->arch); + DEBOOTSTRAP_ADD_PARAM("--foreign"); + DEBOOTSTRAP_ADD_PARAM(pc->distribution); + DEBOOTSTRAP_ADD_PARAM(pc->buildplace); + DEBOOTSTRAP_ADD_PARAM(pc->mirror); + DEBOOTSTRAP_ADD_PARAM(NULL); + /* remove existing file; it can be old qemu image, or a directory if it didn't exist before. */ unlink(pc->basepath); @@ -1119,14 +1129,7 @@ int cpbuilder_create(const struct pbuilderconfig* pc) } log_printf(log_info, "Invoking debootstrap"); - ret=forkexeclp("debootstrap", "debootstrap", - "--arch", - pc->arch, - "--foreign", - pc->distribution, - pc->buildplace, - pc->mirror, - NULL); + ret=forkexecvp(debootstrapcommandline); if (ret) { log_printf(log_error, "debootstrap failed with %i", ret); -- 2.11.0.52.gfb549ca