Merge lp:~mvo/click/lp1319790-chroot-fstab into lp:click

Proposed by Michael Vogt on 2014-05-15
Status: Needs review
Proposed branch: lp:~mvo/click/lp1319790-chroot-fstab
Merge into: lp:click
Diff against target: 139 lines (+29/-20)
6 files modified
Makefile.am (+1/-1)
click/chroot.py (+25/-1)
click/commands/chroot.py (+1/-2)
click/tests/test_chroot.py (+2/-1)
schroot/Makefile.am (+0/-3)
schroot/fstab (+0/-12)
To merge this branch: bzr merge lp:~mvo/click/lp1319790-chroot-fstab
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing on 2014-06-23
click hackers 2014-05-15 Pending
Review via email: mp+219728@code.launchpad.net

Description of the change

This branch may be a bit controversial, not sure. I ran into the issue that my $HOME is not on /home but instead on /space/home. This branch generates the fstab for the schroot more dynamically so that this case is taken into account.

However the autogeneration isn't exactly dynamic as its only done on create and AIUI the other commands do not require root so we can't easily update. So the branch helps but ideas/suggestions how to auto-generate fstab on each schroot command would be great.

Thanks,
 Michael

To post a comment you must log in.
lp:~mvo/click/lp1319790-chroot-fstab updated on 2014-05-20
427. By Michael Vogt on 2014-05-20

click/commands/chroot.py: remove check for /etc/schroot/click/fstab. the fstab is auto-generated now

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:427
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mvo/click/lp1319790-chroot-fstab/+merge/219728/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/click-ci/2/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/click-utopic-amd64-ci/2/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/click-utopic-armhf-ci/2/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/click-ci/2/rebuild

review: Needs Fixing (continuous-integration)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:427
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~mvo/click/lp1319790-chroot-fstab/+merge/219728/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/click-ci/4/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/click-utopic-amd64-ci/4/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/click-utopic-armhf-ci/4/console

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/click-ci/4/rebuild

review: Needs Fixing (continuous-integration)
Timo Jyrinki (timo-jyrinki) wrote :

Can this see work to get it in? See bug #1427264

Timo Jyrinki (timo-jyrinki) wrote :
lp:~mvo/click/lp1319790-chroot-fstab updated on 2015-05-08
428. By Michael Vogt on 2014-09-29

merged lp:click/devel

429. By Michael Vogt on 2015-05-08

merged lp:click, fixes conflicts, fixed tests

Michael Vogt (mvo) wrote :

Thanks Timo for the reminder and sorry that this was so long untouched. I updated the branch and resolved conflicts/updated tests. There is a bit of a reviewers shortage for click right now, I will try to find someone who can do a review.

Unmerged revisions

429. By Michael Vogt on 2015-05-08

merged lp:click, fixes conflicts, fixed tests

428. By Michael Vogt on 2014-09-29

merged lp:click/devel

427. By Michael Vogt on 2014-05-20

click/commands/chroot.py: remove check for /etc/schroot/click/fstab. the fstab is auto-generated now

426. By Michael Vogt on 2014-05-15

generate schroot fstab (more) dynamically to support $HOME != /home

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Makefile.am'
2--- Makefile.am 2014-06-30 16:48:31 +0000
3+++ Makefile.am 2015-05-08 06:28:53 +0000
4@@ -1,4 +1,4 @@
5-SUBDIRS = lib preload click conf debhelper init po schroot
6+SUBDIRS = lib preload click conf debhelper init po
7 if PACKAGEKIT
8 SUBDIRS += pk-plugin
9 endif
10
11=== modified file 'click/chroot.py'
12--- click/chroot.py 2015-03-10 17:36:06 +0000
13+++ click/chroot.py 2015-05-08 06:28:53 +0000
14@@ -315,6 +315,8 @@
15 else:
16 self.user = pwd.getpwuid(os.getuid()).pw_name
17 self.dpkg_architecture = self._dpkg_architecture()
18+ # allow override in the tests
19+ self.chroot_fstab = "/etc/schroot/click/fstab-autogenerated"
20
21 def _get_native_arch(self, system_arch, target_arch):
22 """Determine the proper native architecture for a chroot.
23@@ -375,7 +377,7 @@
24 {users}
25 type=directory
26 profile=default
27- setup.fstab=click/fstab
28+ setup.fstab=click/fstab-autogenerated
29 # Not protocols or services see
30 # debian bug 557730
31 setup.nssdatabases=sbuild/nssdatabases
32@@ -480,6 +482,22 @@
33 mode = stat.S_IMODE(os.stat(path).st_mode)
34 os.chmod(path, mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
35
36+ def _make_chroot_fstab(self):
37+ with open(self.chroot_fstab, "w") as target:
38+ target.write("""# fstab: static file system information for chroots.
39+# Note that the mount point will be prefixed by the chroot path
40+# (CHROOT_PATH)
41+#
42+# <file system> <mount point> <type> <options> <dump> <pass>
43+/proc /proc none rw,bind 0 0
44+/sys /sys none rw,bind 0 0
45+/dev /dev none rw,bind 0 0
46+/dev/pts /dev/pts none rw,bind 0 0
47+/tmp /tmp none rw,bind 0 0
48+/run/shm /run/shm none rw,bind 0 0
49+{home} {home} none rw,bind 0 0
50+ """.format(home=os.path.expanduser("~")))
51+
52 def _make_cross_package(self, prefix):
53 if self.native_arch == self.target_arch:
54 return prefix
55@@ -518,6 +536,10 @@
56 build_pkgs.append(package)
57 os.makedirs(mount)
58
59+ # FIXME: hrm, hrm, this will work great until the user changes his
60+ # HOME
61+ self._make_chroot_fstab()
62+
63 country_code = get_geoip_country_code_prefix()
64 archive = "http://%sarchive.ubuntu.com/ubuntu" % country_code
65 ports_mirror = "http://%sports.ubuntu.com/ubuntu-ports" % country_code
66@@ -529,11 +551,13 @@
67 self.target_arch,
68 archive, ports_mirror,
69 ' '.join(components))
70+
71 with open("%s/etc/apt/sources.list" % mount, "w") as sources_list:
72 for line in sources:
73 print(line, file=sources_list)
74 shutil.copy2("/etc/localtime", "%s/etc/" % mount)
75 shutil.copy2("/etc/timezone", "%s/etc/" % mount)
76+
77 self._generate_chroot_config(mount)
78 daemon_policy = self._generate_daemon_policy(mount)
79 self._make_executable(daemon_policy)
80
81=== modified file 'click/commands/chroot.py'
82--- click/commands/chroot.py 2014-10-13 12:48:35 +0000
83+++ click/commands/chroot.py 2015-05-08 06:28:53 +0000
84@@ -258,8 +258,7 @@
85 if not hasattr(args, "func"):
86 parser.print_help()
87 return 1
88- if (not osextras.find_on_path("schroot") or
89- not os.path.exists("/etc/schroot/click/fstab")):
90+ if not osextras.find_on_path("schroot"):
91 parser.error(
92 "schroot not installed and configured; install click-dev and "
93 "schroot")
94
95=== modified file 'click/tests/test_chroot.py'
96--- click/tests/test_chroot.py 2015-01-23 17:55:52 +0000
97+++ click/tests/test_chroot.py 2015-05-08 06:28:53 +0000
98@@ -40,6 +40,7 @@
99 self.temp_dir = kwargs.pop("temp_dir")
100 super(FakeClickChroot, self).__init__(*args, **kwargs)
101 self._exists = False
102+ self.chroot_fstab = os.path.join(self.temp_dir, "fstab-autogenerated")
103
104 def exists(self):
105 return self._exists
106@@ -287,7 +288,7 @@
107 source-root-users=root,{user}
108 type=directory
109 profile=default
110- setup.fstab=click/fstab
111+ setup.fstab=click/fstab-autogenerated
112 # Not protocols or services see
113 # debian bug 557730
114 setup.nssdatabases=sbuild/nssdatabases
115
116=== removed file 'schroot/Makefile.am'
117--- schroot/Makefile.am 2013-11-01 00:31:35 +0000
118+++ schroot/Makefile.am 1970-01-01 00:00:00 +0000
119@@ -1,3 +0,0 @@
120-schroot_clickdir = @sysconfdir@/schroot/click
121-
122-schroot_click_DATA = fstab
123
124=== removed file 'schroot/fstab'
125--- schroot/fstab 2014-11-04 13:29:54 +0000
126+++ schroot/fstab 1970-01-01 00:00:00 +0000
127@@ -1,12 +0,0 @@
128-# fstab: static file system information for chroots.
129-# Note that the mount point will be prefixed by the chroot path
130-# (CHROOT_PATH)
131-#
132-# <file system> <mount point> <type> <options> <dump> <pass>
133-/proc /proc none rw,bind 0 0
134-/sys /sys none rw,bind 0 0
135-/dev /dev none rw,bind 0 0
136-/dev/pts /dev/pts none rw,bind 0 0
137-/home /home none rw,rbind 0 0
138-/tmp /tmp none rw,bind 0 0
139-/run/shm /run/shm none rw,bind 0 0

Subscribers

People subscribed via source and target branches

to all changes: