Merge lp:~ubuntu-core-dev/livecd-rootfs/split-custom-tarball into lp:livecd-rootfs

Proposed by Steve Langasek
Status: Merged
Approved by: Colin Watson
Approved revision: no longer in the source branch.
Merged at revision: 981
Proposed branch: lp:~ubuntu-core-dev/livecd-rootfs/split-custom-tarball
Merge into: lp:livecd-rootfs
Diff against target: 163 lines (+109/-2)
5 files modified
debian/changelog (+12/-0)
live-build/auto/build (+6/-0)
live-build/ubuntu-touch/hooks/60-install-click.binary (+9/-0)
live-build/ubuntu-touch/hooks/60-install-click.chroot (+40/-2)
live-build/ubuntu-touch/hooks/90-precompile-apparmor-policies.chroot (+42/-0)
To merge this branch: bzr merge lp:~ubuntu-core-dev/livecd-rootfs/split-custom-tarball
Reviewer Review Type Date Requested Status
Colin Watson Approve
Review via email: mp+237905@code.launchpad.net

Description of the change

First cut at separating a custom tarball out of the ubuntu-touch rootfs
generation. This is a bit ugly because it hard-codes the list of click
packages in the config, but it lets us ensure consistent handling of the
packages in the rootfs vs. the custom tarball with no duplication.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

I think this looks OK with just one small inline comment, and ubuntu-cdimage and ubuntu-system-image/server should now be ready for it. What testing have you been able to do of this, if any?

We'll need to be pretty careful about landing this, though, and it's all-or-nothing right now. Stéphane had a suggestion to make this easier which I think is worth doing. Now that click-apparmor has been fixed, it should be safe to include these click packages in both rootfs and custom temporarily (obviously incurring a space penalty on devices in the interim). That would then give us the following landing procedure:

  1) land a modified version of this branch which includes packages in both rootfs and custom; don't change system-image configuration yet
  2) once step 1 is done, build an image; check that relevant packages are still usable on a device (i.e. in rootfs); inspect published custom.tar.gz by hand and make any necessary corrections
  3) modify all relevant custom tarballs built elsewhere to include the packages due to be removed from the rootfs (can be done in parallel with steps 1 and 2)
  4) once all of steps 1, 2, and 3 are done, switch system-image configuration to use cdimage-custom
  5) once step 4 is done, build an image; check that relevant packages are still usable on a device, and that they are present in /custom
  6) once step 5 is done, land a further livecd-rootfs change that drops the packages from rootfs
  7) once step 6 is done, build an image; check that relevant packages are still usable on a device, and that they are only present in /custom and not rootfs

review: Needs Fixing
Revision history for this message
Chris Wayne (cwayne) wrote :

As per Joe (product owner) we won't be pre-installing sudoku, dropping letters, filemanager, and terminal on commercial builds. My feeling then is that they should be removed from here.

Revision history for this message
Colin Watson (cjwatson) wrote :

The point of this work was to decouple things we aren't installing in
commercial builds from the set of things that go in the community
images. It's not clear why what we install in commercial builds should
continue to have a bearing here. We're removing them from the rootfs so
that the two sets of builds can have independent click package
selections.

977. By Colin Watson

Update hardcoded libmir*-android installations for Mir 0.8.0.

978. By Colin Watson

releasing package livecd-rootfs version 2.253

979. By Oliver Grawert

ubuntu-touch: make sure we force the android alternative for libmir*- packages, in case their -mesa equivalent is installed by accident

980. By Oliver Grawert

releasing package livecd-rootfs version 2.254

Revision history for this message
Colin Watson (cjwatson) wrote :

I think this is working properly now with my modifications, and should be incrementally-landable.

review: Approve
981. By Colin Watson

merge lp:~ubuntu-core-dev/livecd-rootfs/split-custom-tarball

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-10-11 11:13:39 +0000
3+++ debian/changelog 2014-10-13 19:11:47 +0000
4@@ -1,3 +1,15 @@
5+livecd-rootfs (2.255) UNRELEASED; urgency=medium
6+
7+ [ Steve Langasek ]
8+ * Add support to the ubuntu-touch target to generate a separate custom
9+ tarball as part of the build, moving most click packages into it.
10+
11+ [ Colin Watson ]
12+ * Temporarily install the to-be-moved click packages in both core and
13+ custom databases, to simplify the landing process.
14+
15+ -- Steve Langasek <steve.langasek@ubuntu.com> Thu, 09 Oct 2014 20:46:46 -0700
16+
17 livecd-rootfs (2.254) utopic; urgency=medium
18
19 * force the right alternative when the libmir*-android packages are
20
21=== modified file 'live-build/auto/build'
22--- live-build/auto/build 2014-06-26 11:31:07 +0000
23+++ live-build/auto/build 2014-10-13 19:11:47 +0000
24@@ -298,6 +298,12 @@
25 cp -a binary-tar.tar.gz "$PREFIX.rootfs.tar.gz"
26 fi
27
28+if [ "$PROJECT" = "ubuntu-touch" ]; then
29+ (cd "binary/$INITFS/custom.dir/" && tar -c *) | \
30+ gzip -9 --rsyncable > "$PREFIX.custom.tar.gz"
31+ chmod 644 "$PREFIX.custom.tar.gz"
32+fi
33+
34 # '--initramfs none' produces different manifest names.
35 if [ -e "binary/$INITFS/filesystem.packages" ]; then
36 ln "binary/$INITFS/filesystem.packages" "$PREFIX.manifest"
37
38=== added file 'live-build/ubuntu-touch/hooks/60-install-click.binary'
39--- live-build/ubuntu-touch/hooks/60-install-click.binary 1970-01-01 00:00:00 +0000
40+++ live-build/ubuntu-touch/hooks/60-install-click.binary 2014-10-13 19:11:47 +0000
41@@ -0,0 +1,9 @@
42+#!/bin/sh
43+
44+set -e
45+
46+echo "Splitting out custom tarball"
47+
48+rm -f binary/boot/custom.dir
49+mkdir binary/boot/custom.dir
50+mv binary/boot/filesystem.dir/custom binary/boot/custom.dir/custom
51
52=== modified file 'live-build/ubuntu-touch/hooks/60-install-click.chroot'
53--- live-build/ubuntu-touch/hooks/60-install-click.chroot 2013-11-26 15:43:06 +0000
54+++ live-build/ubuntu-touch/hooks/60-install-click.chroot 2014-10-13 19:11:47 +0000
55@@ -7,10 +7,15 @@
56 click_uri=http://archive-team.internal/click_packages
57 click_list=$click_uri/click_list
58 click_db=/usr/share/click/preinstalled
59+click_db_custom=/custom/click
60
61 mkdir -p -m 755 "$click_db"
62 chown clickpkg:clickpkg "$click_db"
63
64+# some of these get installed to /custom/click
65+mkdir -p -m 755 "$click_db_custom"
66+chown clickpkg:clickpkg "$click_db_custom"
67+
68 tmpdir="$(mktemp -d)"
69 cleanup () { rm -rf "$tmpdir"; }
70 trap cleanup EXIT
71@@ -23,7 +28,40 @@
72 if echo $package | egrep -q "_$CLICKARCH.click|_all.click|_unknown.click"; then
73 echo "Setting up $package"
74 wget --no-verbose -O "$tmpdir/$package" "$click_uri/$package"
75- click install --force-missing-framework --root="$click_db" --all-users \
76- "$tmpdir/$package"
77+ # FIXME: first attempt, a hard-coded list of the packages that go to
78+ # the custom tarball
79+ case $package in
80+ com.ubuntu.developer.webapps.webapp-amazon_*|\
81+ com.ubuntu.developer.webapps.webapp-ebay_*|\
82+ com.ubuntu.developer.webapps.webapp-facebook_*|\
83+ com.ubuntu.developer.webapps.webapp-gmail_*|\
84+ com.ubuntu.developer.webapps.webapp-twitter_*|\
85+ com.ubuntu.dropping-letters_*|\
86+ com.ubuntu.filemanager_*|\
87+ com.ubuntu.reminders_*|\
88+ com.ubuntu.sudoku_*|\
89+ com.ubuntu.terminal_*)
90+ roots="$click_db $click_db_custom"
91+ ;;
92+ *)
93+ roots="$click_db"
94+ ;;
95+ esac
96+ for root in $roots; do
97+ if [ "$root" = "$click_db_custom" ]; then
98+ # FIXME: there is no good way to stop click from
99+ # deduplicating things when installing the same package in
100+ # multiple databases; the best we can do is to temporarily
101+ # pretend that the core database does not exist
102+ mv /etc/click/databases/10_core.conf \
103+ /etc/click/databases/10_core.conf.tmp
104+ fi
105+ click install --force-missing-framework --root="$root" --all-users \
106+ "$tmpdir/$package"
107+ if [ "$root" = "$click_db_custom" ]; then
108+ mv /etc/click/databases/10_core.conf.tmp \
109+ /etc/click/databases/10_core.conf
110+ fi
111+ done
112 fi
113 done
114
115=== modified file 'live-build/ubuntu-touch/hooks/90-precompile-apparmor-policies.chroot'
116--- live-build/ubuntu-touch/hooks/90-precompile-apparmor-policies.chroot 2014-07-15 20:35:28 +0000
117+++ live-build/ubuntu-touch/hooks/90-precompile-apparmor-policies.chroot 2014-10-13 19:11:47 +0000
118@@ -7,3 +7,45 @@
119
120 echo "I: precompiling deb apparmor policies"
121 /sbin/apparmor_parser -M ${FEATURES} -Q --write-cache --cache-loc=/etc/apparmor.d/cache/ `find /etc/apparmor.d/ -maxdepth 1 -type f -not -path '*/\.*'`
122+
123+echo "I: precompiling custom click apparmor policies"
124+mkdir -p /custom/cache/apparmor
125+/sbin/apparmor_parser -M ${FEATURES} -Q --write-cache --cache-loc=/custom/cache/apparmor/ `find /var/lib/apparmor/profiles/ -maxdepth 1 -type f -not -path '*/\.*'`
126+
127+
128+#get the apparmor manifests and profiles
129+mkdir -p /custom/lib/apparmor/clicks
130+mkdir -p /custom/lib/apparmor/profiles
131+
132+for manifest in /var/lib/apparmor/clicks/*; do
133+ # FIXME: if this code survives for very long, it should probably be
134+ # rewritten using click's Python bindings
135+ pkgdir="$(click pkgdir "$manifest")"
136+ manifest_real="$(readlink -f "$manifest")"
137+ manifest_tail="${manifest_real#$pkgdir}"
138+ # Does this package exist in the custom tarball? If so, move its
139+ # profiles there (if it only exists in custom) or copy them (if it
140+ # also exists in core).
141+ version="${pkgdir##*/}"
142+ pkgdir_noversion="${pkgdir%/*}"
143+ name="${pkgdir_noversion##*/}"
144+ profile="$(basename "$manifest" .json)"
145+ if [ -d "/custom/click/$name/$version" ]; then
146+ # Clone into custom.
147+ ln -nsf "/custom/click/$name/$version$manifest_tail" "/custom/lib/apparmor/clicks/${manifest##*/}"
148+ cp -a "/var/lib/apparmor/profiles/click_$profile" /custom/lib/apparmor/profiles/
149+ if [ -d "/usr/share/click/preinstalled/$name/$version" ]; then
150+ # Ensure that the version in the rootfs points to
151+ # the core database.
152+ ln -nsf "/usr/share/click/preinstalled/$name/$version$manifest_tail" "$manifest"
153+ else
154+ # Remove from the rootfs.
155+ rm -f "$manifest"
156+ rm -f "/var/lib/apparmor/profiles/click_$profile"
157+ rm -f "/var/cache/apparmor/click_$profile"
158+ fi
159+ else
160+ # Remove from custom.
161+ rm -f "/custom/cache/apparmor/click_$profile"
162+ fi
163+done

Subscribers

People subscribed via source and target branches