launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21850
[Merge] lp:~cjwatson/launchpad-buildd/snap-set-shell into lp:launchpad-buildd
Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/snap-set-shell into lp:launchpad-buildd.
Commit message:
Set SHELL=/bin/sh in snap builds, since it was previously passed through by the chroot backend and some build systems expect SHELL to be set (LP: #1716739).
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1716739 in launchpad-buildd: "$SHELL should be set in lxc containers building snaps"
https://bugs.launchpad.net/launchpad-buildd/+bug/1716739
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/snap-set-shell/+merge/330675
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/snap-set-shell into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog 2017-09-13 12:05:24 +0000
+++ debian/changelog 2017-09-13 12:23:40 +0000
@@ -3,6 +3,9 @@
[ Colin Watson ]
* Accept a "debug" entry in livefs arguments, which enables detailed
live-build debugging.
+ * Set SHELL=/bin/sh in snap builds, since it was previously passed through
+ by the chroot backend and some build systems expect SHELL to be set
+ (LP: #1716739).
[ Robert C Jennings ]
* LXD: Do not drop sys_rawio capability (LP: #1716060).
=== modified file 'lpbuildd/target/build_snap.py'
--- lpbuildd/target/build_snap.py 2017-08-29 08:50:41 +0000
+++ lpbuildd/target/build_snap.py 2017-09-13 12:23:40 +0000
@@ -76,6 +76,7 @@
path = shell_escape(path)
full_env = OrderedDict()
full_env["LANG"] = "C.UTF-8"
+ full_env["SHELL"] = "/bin/sh"
if env:
full_env.update(env)
args = ["env"] + [
=== modified file 'lpbuildd/target/tests/test_build_snap.py'
--- lpbuildd/target/tests/test_build_snap.py 2017-08-25 16:04:33 +0000
+++ lpbuildd/target/tests/test_build_snap.py 2017-09-13 12:23:40 +0000
@@ -84,7 +84,8 @@
build_snap = parse_args(args=args).operation
build_snap.run_build_command(["echo", "hello world"])
self.assertThat(build_snap.backend.run.calls, MatchesListwise([
- RanBuildCommand("env LANG=C.UTF-8 echo 'hello world'"),
+ RanBuildCommand(
+ "env LANG=C.UTF-8 SHELL=/bin/sh echo 'hello world'"),
]))
def test_run_build_command_env(self):
@@ -98,7 +99,8 @@
["echo", "hello world"], env={"FOO": "bar baz"})
self.assertThat(build_snap.backend.run.calls, MatchesListwise([
RanBuildCommand(
- "env LANG=C.UTF-8 FOO='bar baz' echo 'hello world'"),
+ "env LANG=C.UTF-8 SHELL=/bin/sh FOO='bar baz' "
+ "echo 'hello world'"),
]))
def test_install_bzr(self):
@@ -158,7 +160,7 @@
build_snap.backend.build_path = self.useFixture(TempDir()).path
build_snap.backend.run = FakeRevisionID("42")
build_snap.repo()
- env = "env LANG=C.UTF-8 "
+ env = "env LANG=C.UTF-8 SHELL=/bin/sh "
self.assertThat(build_snap.backend.run.calls, MatchesListwise([
RanBuildCommand(env + "ls /build"),
RanBuildCommand(env + "bzr branch lp:foo test-snap"),
@@ -178,7 +180,7 @@
build_snap.backend.build_path = self.useFixture(TempDir()).path
build_snap.backend.run = FakeRevisionID("0" * 40)
build_snap.repo()
- env = "env LANG=C.UTF-8 "
+ env = "env LANG=C.UTF-8 SHELL=/bin/sh "
self.assertThat(build_snap.backend.run.calls, MatchesListwise([
RanBuildCommand(env + "git clone lp:foo test-snap"),
RanBuildCommand(
@@ -200,7 +202,7 @@
build_snap.backend.build_path = self.useFixture(TempDir()).path
build_snap.backend.run = FakeRevisionID("0" * 40)
build_snap.repo()
- env = "env LANG=C.UTF-8 "
+ env = "env LANG=C.UTF-8 SHELL=/bin/sh "
self.assertThat(build_snap.backend.run.calls, MatchesListwise([
RanBuildCommand(env + "git clone -b next lp:foo test-snap"),
RanBuildCommand(
@@ -225,7 +227,8 @@
build_snap.backend.run = FakeRevisionID("0" * 40)
build_snap.repo()
env = (
- "env LANG=C.UTF-8 http_proxy=http://proxy.example:3128/ "
+ "env LANG=C.UTF-8 SHELL=/bin/sh "
+ "http_proxy=http://proxy.example:3128/ "
"https_proxy=http://proxy.example:3128/ "
"GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy ")
self.assertThat(build_snap.backend.run.calls, MatchesListwise([
@@ -233,7 +236,8 @@
RanBuildCommand(
env + "git -C test-snap submodule update --init --recursive"),
RanBuildCommand(
- "env LANG=C.UTF-8 git -C test-snap rev-parse HEAD",
+ "env LANG=C.UTF-8 SHELL=/bin/sh "
+ "git -C test-snap rev-parse HEAD",
get_output=True),
]))
status_path = os.path.join(build_snap.backend.build_path, "status")
@@ -249,7 +253,7 @@
build_snap = parse_args(args=args).operation
build_snap.pull()
env = (
- "env LANG=C.UTF-8 "
+ "env LANG=C.UTF-8 SHELL=/bin/sh "
"SNAPCRAFT_LOCAL_SOURCES=1 SNAPCRAFT_SETUP_CORE=1 ")
self.assertThat(build_snap.backend.run.calls, MatchesListwise([
RanBuildCommand(env + "snapcraft pull", path="/build/test-snap"),
@@ -265,7 +269,7 @@
build_snap = parse_args(args=args).operation
build_snap.pull()
env = (
- "env LANG=C.UTF-8 "
+ "env LANG=C.UTF-8 SHELL=/bin/sh "
"SNAPCRAFT_LOCAL_SOURCES=1 SNAPCRAFT_SETUP_CORE=1 "
"http_proxy=http://proxy.example:3128/ "
"https_proxy=http://proxy.example:3128/ "
@@ -282,7 +286,7 @@
]
build_snap = parse_args(args=args).operation
build_snap.build()
- env = "env LANG=C.UTF-8 "
+ env = "env LANG=C.UTF-8 SHELL=/bin/sh "
self.assertThat(build_snap.backend.run.calls, MatchesListwise([
RanBuildCommand(env + "snapcraft", path="/build/test-snap"),
]))
@@ -297,7 +301,7 @@
build_snap = parse_args(args=args).operation
build_snap.build()
env = (
- "env LANG=C.UTF-8 "
+ "env LANG=C.UTF-8 SHELL=/bin/sh "
"http_proxy=http://proxy.example:3128/ "
"https_proxy=http://proxy.example:3128/ "
"GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy ")
@@ -321,13 +325,14 @@
self.assertThat(build_snap.backend.run.calls, MatchesAll(
AnyMatch(RanAptGet("install", "snapcraft", "bzr")),
AnyMatch(RanBuildCommand(
- "env LANG=C.UTF-8 bzr branch lp:foo test-snap")),
+ "env LANG=C.UTF-8 SHELL=/bin/sh bzr branch lp:foo test-snap")),
AnyMatch(RanBuildCommand(
- "env LANG=C.UTF-8 "
+ "env LANG=C.UTF-8 SHELL=/bin/sh "
"SNAPCRAFT_LOCAL_SOURCES=1 SNAPCRAFT_SETUP_CORE=1 "
"snapcraft pull", path="/build/test-snap")),
AnyMatch(RanBuildCommand(
- "env LANG=C.UTF-8 snapcraft", path="/build/test-snap")),
+ "env LANG=C.UTF-8 SHELL=/bin/sh snapcraft",
+ path="/build/test-snap")),
))
def test_run_install_fails(self):