Merge lp:~sergiusens/click/schroot_configuration_overlay_detection into lp:click

Proposed by Sergio Schvezov on 2017-06-07
Status: Merged
Approved by: Michael Vogt on 2017-06-07
Approved revision: 627
Merged at revision: 621
Proposed branch: lp:~sergiusens/click/schroot_configuration_overlay_detection
Merge into: lp:click
Prerequisite: lp:~sergiusens/click/package-rename
Diff against target: 142 lines (+28/-5)
7 files modified
click_package/chroot.py (+11/-2)
click_package/tests/integration/helpers.py (+7/-0)
click_package/tests/integration/test_build_core_apps.py (+2/-0)
click_package/tests/integration/test_chroot.py (+2/-0)
click_package/tests/test_chroot.py (+3/-2)
debian/changelog (+2/-0)
debian/control (+1/-1)
To merge this branch: bzr merge lp:~sergiusens/click/schroot_configuration_overlay_detection
Reviewer Review Type Date Requested Status
Colin Watson 2017-06-07 Approve on 2017-06-07
Review via email: mp+325234@code.launchpad.net
To post a comment you must log in.
Colin Watson (cjwatson) :
review: Approve
627. By Sergio Schvezov on 2017-06-07

Use the correct overlayfs module name for the chroot configuration

628. By Sergio Schvezov on 2017-06-07

helper to modprobe overlay

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'click_package/chroot.py'
2--- click_package/chroot.py 2015-12-29 01:12:58 +0000
3+++ click_package/chroot.py 2017-06-07 18:50:49 +0000
4@@ -34,6 +34,7 @@
5 from urllib2 import URLError, urlopen
6 import os
7 import pwd
8+import fileinput
9 import re
10 import shutil
11 import stat
12@@ -383,6 +384,13 @@
13 dpkg_architecture[new_key] = dpkg_architecture[key]
14 return dpkg_architecture
15
16+ def _get_overlayfs_name(self):
17+ for line in fileinput.input("/proc/filesystems"):
18+ if line.strip() == "nodev\toverlay":
19+ fileinput.close()
20+ return "overlay"
21+ return "overlayfs"
22+
23 def _generate_chroot_config(self, mount):
24 admin_user = "root"
25 users = []
26@@ -399,12 +407,13 @@
27 # Not protocols or services see
28 # debian bug 557730
29 setup.nssdatabases=sbuild/nssdatabases
30- union-type=overlayfs
31+ union-type={overlayfs_name}
32 directory={mount}
33 """).format(full_name=self.full_name,
34 target_arch=self.target_arch,
35 users="\n".join(users),
36- mount=mount))
37+ mount=mount,
38+ overlayfs_name=self._get_overlayfs_name()))
39
40 def _generate_daemon_policy(self, mount):
41 daemon_policy = "%s/usr/sbin/policy-rc.d" % mount
42
43=== modified file 'click_package/tests/integration/helpers.py'
44--- click_package/tests/integration/helpers.py 2014-09-05 09:04:33 +0000
45+++ click_package/tests/integration/helpers.py 2017-06-07 18:50:49 +0000
46@@ -40,6 +40,13 @@
47 pass
48
49
50+def require_overlay():
51+ try:
52+ subprocess.check_call(["/sbin/modprobe", "overlay"])
53+ except subprocess.CalledProcessError:
54+ raise unittest.SkipTest("Requires overlay fs support")
55+
56+
57 @contextlib.contextmanager
58 def chdir(target):
59 curdir = os.getcwd()
60
61=== modified file 'click_package/tests/integration/test_build_core_apps.py'
62--- click_package/tests/integration/test_build_core_apps.py 2015-12-29 04:13:08 +0000
63+++ click_package/tests/integration/test_build_core_apps.py 2017-06-07 18:50:49 +0000
64@@ -26,6 +26,7 @@
65 from .helpers import (
66 chdir,
67 require_network,
68+ require_overlay,
69 require_root,
70 ClickTestCase,
71 )
72@@ -74,6 +75,7 @@
73 super(TestBuildCoreApps, cls).setUpClass()
74 require_root()
75 require_network()
76+ require_overlay()
77
78 def _run_in_chroot(self, cmd):
79 """Run the given cmd in a click chroot"""
80
81=== modified file 'click_package/tests/integration/test_chroot.py'
82--- click_package/tests/integration/test_chroot.py 2015-12-29 04:19:12 +0000
83+++ click_package/tests/integration/test_chroot.py 2017-06-07 18:50:49 +0000
84@@ -20,6 +20,7 @@
85
86 from .helpers import (
87 require_network,
88+ require_overlay,
89 require_root,
90 ClickTestCase,
91 )
92@@ -50,6 +51,7 @@
93 super(TestChroot, cls).setUpClass()
94 require_root()
95 require_network()
96+ require_overlay()
97 cls.arch = subprocess.check_output(
98 ["dpkg", "--print-architecture"], universal_newlines=True).strip()
99 subprocess.check_call(cls.command(cls.arch, "create"))
100
101=== modified file 'click_package/tests/test_chroot.py'
102--- click_package/tests/test_chroot.py 2017-06-07 18:50:49 +0000
103+++ click_package/tests/test_chroot.py 2017-06-07 18:50:49 +0000
104@@ -298,9 +298,10 @@
105 # Not protocols or services see
106 # debian bug 557730
107 setup.nssdatabases=sbuild/nssdatabases
108- union-type=overlayfs
109+ union-type={overlayfs}
110 directory={temp_dir}
111- """).format(user="meep", temp_dir=self.temp_dir))
112+ """).format(user="meep", temp_dir=self.temp_dir,
113+ overlayfs=chroot._get_overlayfs_name()))
114
115 def test_chroot_create_mocked(self):
116 self.use_temp_dir()
117
118=== modified file 'debian/changelog'
119--- debian/changelog 2017-06-07 18:50:49 +0000
120+++ debian/changelog 2017-06-07 18:50:49 +0000
121@@ -2,6 +2,8 @@
122
123 * Rename the python package this installs from click to click_package.
124 (LP: #1693226)
125+ * Use the correct overlayfs module name for the chroot configuration.
126+ (LP: #1696402)
127
128 -- Sergio Schvezov <sergio.schvezov@canonical.com> Fri, 26 May 2017 13:03:44 -0300
129
130
131=== modified file 'debian/control'
132--- debian/control 2017-06-07 18:50:49 +0000
133+++ debian/control 2017-06-07 18:50:49 +0000
134@@ -29,7 +29,7 @@
135 Architecture: any
136 Multi-Arch: foreign
137 Depends: ${misc:Depends}, ${perl:Depends}, python3-click-package (= ${binary:Version})
138-Recommends: debootstrap, schroot, dpkg-dev
139+Recommends: debootstrap, schroot (>= 1.6.10-2~), dpkg-dev
140 Description: build Click packages
141 Click is a simplified packaging format that installs in a separate part of
142 the file system, suitable for third-party applications.

Subscribers

People subscribed via source and target branches

to all changes: