[cowdancer] 01/02: qemubuilder: Only use --force-yes if --allow-untrusted is given

James Clarke jrtc27-guest at moszumanska.debian.org
Thu Apr 28 11:52:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

jrtc27-guest pushed a commit to branch master
in repository cowdancer.

commit 088a6d1821ff84b518534d21c8fa4b82eb253bd9
Author: James Clarke <jrtc27 at jrtc27.com>
Date:   Wed Apr 6 15:45:52 2016 +0100

    qemubuilder: Only use --force-yes if --allow-untrusted is given
    
    Closes: #819093
---
 parameter.c   | 11 ++++++++++-
 parameter.h   |  1 +
 qemubuilder.c | 18 ++++++++++++------
 3 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/parameter.c b/parameter.c
index 0a7e349..491019d 100644
--- a/parameter.c
+++ b/parameter.c
@@ -194,6 +194,10 @@ int load_config_file(const char* config, pbuilderconfig* pc)
 	    {
 	      pc->http_proxy=strdup_strip_quote(delim);
 	    }
+	  else if (!strcmp(buf, "ALLOWUNTRUSTED"))
+	    {
+	      pc->allow_untrusted=!strcmp(delim, "yes");
+	    }
 	}
     }
 
@@ -297,6 +301,7 @@ int parse_parameter(int ac, char** av,
     {"outputfile", required_argument, 0, 0},
     {"architecture", required_argument, 0, 0},
     {"http-proxy", required_argument, 0, 0},
+    {"allow-untrusted", no_argument, 0, 0},
 
     /* cowbuilder specific options */
     {"no-cowdancer-update", no_argument, 0, 0},
@@ -318,7 +323,6 @@ int parse_parameter(int ac, char** av,
     {"debootstrap", required_argument, 0, 'M'},
 
     /* verbatim options without argument, synced as of pbuilder 0.153 */
-    {"allow-untrusted", no_argument, 0, 'm'},
     {"removepackages", no_argument, 0, 'm'},
     {"override-config", no_argument, 0, 'm'},
     {"pkgname-logfile", no_argument, 0, 'm'},
@@ -530,6 +534,11 @@ int parse_parameter(int ac, char** av,
 	      pc.binary_arch=1;
 	      PBUILDER_ADD_PARAM(cmdstr);
 	    }
+	  else if (!strcmp(long_options[index_point].name,"allow-untrusted"))
+	    {
+	      pc.allow_untrusted=1;
+	      PBUILDER_ADD_PARAM(cmdstr);
+	    }
 	  break;
 	case 'h':		/* -h */
 	case 'v':		/* -v --version */
diff --git a/parameter.h b/parameter.h
index ad2f204..d70cc47 100644
--- a/parameter.h
+++ b/parameter.h
@@ -42,6 +42,7 @@ typedef struct pbuilderconfig
   char* debbuildopts;
   int binary_arch;
   char* http_proxy;
+  int allow_untrusted;
 
   /* files to be copied into the chroot,
      and copied out of the chroot */
diff --git a/qemubuilder.c b/qemubuilder.c
index 1aa927f..b8c92c5 100755
--- a/qemubuilder.c
+++ b/qemubuilder.c
@@ -822,8 +822,8 @@ int cpbuilder_create(const struct pbuilderconfig* pc)
 	  "apt-get update || exit_from_qemu 1\n"
 	  //TODO: "dpkg --purge $REMOVEPACKAGES\n"
 	  //recover aptcache
-	  "apt-get -y --force-yes -o DPkg::Options::=--force-confnew dist-upgrade || exit_from_qemu 1\n"
-	  "apt-get install --force-yes -y build-essential dpkg-dev apt aptitude pbuilder %s || exit_from_qemu 1\n"
+	  "apt-get -y %s -o DPkg::Options::=--force-confnew dist-upgrade || exit_from_qemu 1\n"
+	  "apt-get install %s -y build-essential dpkg-dev apt aptitude pbuilder %s || exit_from_qemu 1\n"
 	  //TODO: save aptcache
 	  //optionally autoclean aptcache
 	  //run E hook
@@ -835,6 +835,8 @@ int cpbuilder_create(const struct pbuilderconfig* pc)
 	  timestring,
 	  t=sanitize_mirror(pc->mirror), pc->distribution, pc->components,
 	  pc->othermirror?pc->othermirror:"",
+	  pc->allow_untrusted?"--force-yes":"",
+	  pc->allow_untrusted?"--force-yes":"",
 	  pc->extrapackages?pc->extrapackages:"");
   fclose(f);
   f = NULL;
@@ -901,13 +903,15 @@ int cpbuilder_build(const struct pbuilderconfig* pc, const char* dscfile)
 
   asprintf(&commandline,
 	   /* TODO: executehooks D: */
-	   "/usr/lib/pbuilder/pbuilder-satisfydepends --control $PBUILDER_MOUNTPOINT/*.dsc --internal-chrootexec 'chroot . ' %s \n"
-	   "apt-get install --force-yes -y %s\n"
+	   "ALLOWUNTRUSTED=%s /usr/lib/pbuilder/pbuilder-satisfydepends --control $PBUILDER_MOUNTPOINT/*.dsc --internal-chrootexec 'chroot . ' %s \n"
+	   "apt-get install %s -y %s\n"
 	   "cd $PBUILDER_MOUNTPOINT; /usr/bin/dpkg-source -x $(basename %s) \n"
 	   "echo ' -> Building the package'\n"
 	   /* TODO: executehooks A: */
 	   "cd $PBUILDER_MOUNTPOINT/*-*/; dpkg-buildpackage -us -uc %s\n",
+	   pc->allow_untrusted?"yes":"no",
 	   buildopt,
+	   pc->allow_untrusted?"--force-yes":"",
 	   pc->extrapackages?pc->extrapackages:"",
 	   dscfile,
 	   debbuildopts);
@@ -978,10 +982,12 @@ int cpbuilder_update(const struct pbuilderconfig* pc)
 		 //TODO: "dpkg --purge $REMOVEPACKAGES\n"
 		 //TODO: add error code handling.
 		 "apt-get update -o Acquire::PDiffs=false\n"
-		 "apt-get -y --force-yes -o DPkg::Options::=--force-confnew dist-upgrade\n"
-		 "apt-get install --force-yes -y build-essential dpkg-dev apt aptitude pbuilder %s\n"
+		 "apt-get -y %s -o DPkg::Options::=--force-confnew dist-upgrade\n"
+		 "apt-get install %s -y build-essential dpkg-dev apt aptitude pbuilder %s\n"
 		 //TODO: optionally autoclean aptcache
 		 //run E hook
+		 , pc->allow_untrusted?"--force-yes":""
+		 , pc->allow_untrusted?"--force-yes":""
 		 , pc->extrapackages?pc->extrapackages:""))
     {
       fprintf(stderr, "qemubuilder: out of memory.\n");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/cowdancer.git



More information about the Pbuilder-maint mailing list