← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad-buildd/snapcraft-build-env-host into lp:launchpad-buildd

 

Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/snapcraft-build-env-host into lp:launchpad-buildd.

Commit message:
Set SNAPCRAFT_BUILD_ENVIRONMENT=host when building snaps (LP: #1791201).

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1791201 in launchpad-buildd: "add support for --destructive-mode"
  https://bugs.launchpad.net/launchpad-buildd/+bug/1791201

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/snapcraft-build-env-host/+merge/356506
-- 
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/snapcraft-build-env-host into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2018-10-09 11:54:04 +0000
+++ debian/changelog	2018-10-11 09:00:09 +0000
@@ -6,6 +6,9 @@
     images as part of a single build, in order to be selective about what
     builds to run.
 
+  [ Colin Watson ]
+  * Set SNAPCRAFT_BUILD_ENVIRONMENT=host when building snaps (LP: #1791201).
+
  -- Colin Watson <cjwatson@xxxxxxxxxx>  Tue, 09 Oct 2018 11:38:07 +0200
 
 launchpad-buildd (164) xenial; urgency=medium

=== modified file 'lpbuildd/target/build_snap.py'
--- lpbuildd/target/build_snap.py	2018-07-30 10:09:14 +0000
+++ lpbuildd/target/build_snap.py	2018-10-11 09:00:09 +0000
@@ -184,6 +184,7 @@
         # we'll need to make this optional in some way.
         env["SNAPCRAFT_BUILD_INFO"] = "1"
         env["SNAPCRAFT_IMAGE_INFO"] = self.image_info
+        env["SNAPCRAFT_BUILD_ENVIRONMENT"] = "host"
         if self.args.proxy_url:
             env["http_proxy"] = self.args.proxy_url
             env["https_proxy"] = self.args.proxy_url
@@ -208,6 +209,7 @@
         # we'll need to make this optional in some way.
         env["SNAPCRAFT_BUILD_INFO"] = "1"
         env["SNAPCRAFT_IMAGE_INFO"] = self.image_info
+        env["SNAPCRAFT_BUILD_ENVIRONMENT"] = "host"
         if self.args.proxy_url:
             env["http_proxy"] = self.args.proxy_url
             env["https_proxy"] = self.args.proxy_url

=== modified file 'lpbuildd/target/tests/test_build_snap.py'
--- lpbuildd/target/tests/test_build_snap.py	2018-07-30 10:09:14 +0000
+++ lpbuildd/target/tests/test_build_snap.py	2018-10-11 09:00:09 +0000
@@ -316,6 +316,7 @@
             "SNAPCRAFT_SETUP_CORE": "1",
             "SNAPCRAFT_BUILD_INFO": "1",
             "SNAPCRAFT_IMAGE_INFO": "{}",
+            "SNAPCRAFT_BUILD_ENVIRONMENT": "host",
             }
         self.assertThat(build_snap.backend.run.calls, MatchesListwise([
             RanBuildCommand(
@@ -338,6 +339,7 @@
             "SNAPCRAFT_BUILD_INFO": "1",
             "SNAPCRAFT_IMAGE_INFO": (
                 '{"build_url": "https://launchpad.example/build"}'),
+            "SNAPCRAFT_BUILD_ENVIRONMENT": "host",
             "http_proxy": "http://proxy.example:3128/";,
             "https_proxy": "http://proxy.example:3128/";,
             "GIT_PROXY_COMMAND": "/usr/local/bin/snap-git-proxy",
@@ -360,6 +362,7 @@
             "SNAPCRAFT_SETUP_CORE": "1",
             "SNAPCRAFT_BUILD_INFO": "1",
             "SNAPCRAFT_IMAGE_INFO": "{}",
+            "SNAPCRAFT_BUILD_ENVIRONMENT": "host",
             }
         self.assertThat(build_snap.backend.run.calls, MatchesListwise([
             RanBuildCommand(
@@ -383,7 +386,8 @@
         self.assertThat(build_snap.backend.run.calls, MatchesListwise([
             RanBuildCommand(
                 ["snapcraft"], cwd="/build/test-snap",
-                SNAPCRAFT_BUILD_INFO="1", SNAPCRAFT_IMAGE_INFO="{}"),
+                SNAPCRAFT_BUILD_INFO="1", SNAPCRAFT_IMAGE_INFO="{}",
+                SNAPCRAFT_BUILD_ENVIRONMENT="host"),
             ]))
 
     def test_build_proxy(self):
@@ -400,6 +404,7 @@
             "SNAPCRAFT_BUILD_INFO": "1",
             "SNAPCRAFT_IMAGE_INFO": (
                 '{"build_url": "https://launchpad.example/build"}'),
+            "SNAPCRAFT_BUILD_ENVIRONMENT": "host",
             "http_proxy": "http://proxy.example:3128/";,
             "https_proxy": "http://proxy.example:3128/";,
             "GIT_PROXY_COMMAND": "/usr/local/bin/snap-git-proxy",
@@ -431,12 +436,14 @@
                 SNAPCRAFT_LOCAL_SOURCES="1", SNAPCRAFT_SETUP_CORE="1",
                 SNAPCRAFT_BUILD_INFO="1",
                 SNAPCRAFT_IMAGE_INFO=(
-                    '{"build_url": "https://launchpad.example/build"}'))),
+                    '{"build_url": "https://launchpad.example/build"}'),
+                SNAPCRAFT_BUILD_ENVIRONMENT="host")),
             AnyMatch(RanBuildCommand(
                 ["snapcraft"], cwd="/build/test-snap",
                 SNAPCRAFT_BUILD_INFO="1",
                 SNAPCRAFT_IMAGE_INFO=(
-                    '{"build_url": "https://launchpad.example/build"}'))),
+                    '{"build_url": "https://launchpad.example/build"}'),
+                SNAPCRAFT_BUILD_ENVIRONMENT="host")),
             ))
 
     def test_run_install_fails(self):