← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] ~cjwatson/launchpad-buildd:charmcraft-managed into launchpad-buildd:master

 

Colin Watson has proposed merging ~cjwatson/launchpad-buildd:charmcraft-managed into launchpad-buildd:master.

Commit message:
Run charmcraft in managed mode

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/+git/launchpad-buildd/+merge/405877

Since we're providing Launchpad-flavoured LXD containers for charmcraft rather than having it start its own, we need to run it in managed mode and install a few more dependencies for it.
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad-buildd:charmcraft-managed into launchpad-buildd:master.
diff --git a/debian/changelog b/debian/changelog
index 2c14e1e..95e4c8c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ launchpad-buildd (198) UNRELEASED; urgency=medium
   * Run charmcraft in verbose mode.
   * Honour proxy arguments when building charms.
   * Install charmcraft with --classic.
+  * Run charmcraft in managed mode.
 
  -- Colin Watson <cjwatson@xxxxxxxxxx>  Fri, 09 Jul 2021 14:08:58 +0100
 
diff --git a/lpbuildd/target/build_charm.py b/lpbuildd/target/build_charm.py
index 3550117..6f89de5 100644
--- a/lpbuildd/target/build_charm.py
+++ b/lpbuildd/target/build_charm.py
@@ -80,6 +80,11 @@ class BuildCharm(SnapBuildProxyOperationMixin, VCSOperationMixin,
                 if self.backend.is_package_available(dep):
                     deps.append(dep)
         deps.extend(self.vcs_deps)
+        # See charmcraft.provider.CharmcraftBuilddBaseConfiguration.setup.
+        deps.extend([
+            "python3-pip",
+            "python3-setuptools",
+            ])
         self.backend.run(["apt-get", "-y", "install"] + deps)
         if self.args.backend in ("lxd", "fake"):
             self.snap_store_set_proxy()
@@ -115,11 +120,12 @@ class BuildCharm(SnapBuildProxyOperationMixin, VCSOperationMixin,
             self.args.build_path)
         check_path_escape(self.buildd_path, build_context_path)
         env = OrderedDict()
+        env["CHARMCRAFT_MANAGED_MODE"] = "1"
         if self.args.proxy_url:
             env["http_proxy"] = self.args.proxy_url
             env["https_proxy"] = self.args.proxy_url
             env["GIT_PROXY_COMMAND"] = "/usr/local/bin/snap-git-proxy"
-        args = ["charmcraft", "build", "-v", "-f", build_context_path]
+        args = ["charmcraft", "build", "-v", "-p", build_context_path, "-f", build_context_path]
         self.run_build_command(args, env=env)
 
     def run(self):