Merge ~tchavadar/ubuntu-images:add-debian-packaging into ubuntu-images:noble

Proposed by Talha Can Havadar
Status: Needs review
Proposed branch: ~tchavadar/ubuntu-images:add-debian-packaging
Merge into: ubuntu-images:noble
Diff against target: 147 lines (+99/-0)
8 files modified
debian/changelog (+5/-0)
debian/control (+13/-0)
debian/copyright (+22/-0)
debian/gbp.conf (+6/-0)
debian/install (+2/-0)
debian/rules (+5/-0)
debian/source/format (+1/-0)
hooks/README.md (+45/-0)
Reviewer Review Type Date Requested Status
Ubuntu Release Team Pending
Review via email: mp+464536@code.launchpad.net

This proposal supersedes a proposal from 2024-04-17.

Description of the change

# Proposal to have ubuntu-images as debian package

Based on the experiences we have during hardware enablement using ubuntu-image and livecd-rootfs together in livefs build environment. We are thinking having ubuntu-images repo as package will give us much more flexibility in our customized builds. This is with an assumption of using (this new) ubuntu-images package as a dependency in livecd-rootfs package.

Right now we have a mechanism in upstream livecd-rootfs which just clones this repository to use image definitions. (https://git.launchpad.net/livecd-rootfs/tree/live-build/auto/config#n534)

This way of working with image-definitions is not suitable for private projects which in most cases, especially in early stages of enablement, we are using private PPAs to test and built the images which requires us to put image-definition files in private repos. With the current environment that livefs gives us it is not possible to clone a private git repository.

If ubuntu-images repo could be installed as debian package then we would be able to create our own version of ubuntu-images package and put it in our own private ppa and trigger livefs build using that ppa.

With the help of hooks being integrated with the ubuntu-images package, we could do any sort of customization without having a need of changing livecd-rootfs once we have livecd-rootfs compatible with ubuntu-images deb package.

I would like to hear your opinions about this and based on your feedback I will create a merge proposal in livecd-rootfs repo as well to support this way of working.

PPA: https://launchpad.net/~tchavadar/+archive/ubuntu/ubuntu-images-test
Please see the changes in livecd-rootfs as well: https://code.launchpad.net/~tchavadar/livecd-rootfs/+git/livecd-rootfs/+merge/464550

To post a comment you must log in.

Unmerged commits

46c8b06... by Talha Can Havadar

debian: add debian packaging files

4ed7bc1... by Talha Can Havadar

add readme to explain usage of hooks

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2new file mode 100644
3index 0000000..251c089
4--- /dev/null
5+++ b/debian/changelog
6@@ -0,0 +1,5 @@
7+ubuntu-images (0.0.1) noble; urgency=low
8+
9+ * Initial release.
10+
11+ -- Talha Can Havadar <talha.can.havadar@canonical.com> Wed, 17 Apr 2024 14:41:36 +0200
12diff --git a/debian/control b/debian/control
13new file mode 100644
14index 0000000..27e50c8
15--- /dev/null
16+++ b/debian/control
17@@ -0,0 +1,13 @@
18+Source: ubuntu-images
19+Section: devel
20+Priority: optional
21+Maintainer: Talha Can Havadar <talha.can.havadar@canonical.com>
22+Build-Depends: debhelper-compat (= 13)
23+Standards-Version: 4.6.2
24+
25+Package: ubuntu-images
26+Architecture: any
27+Multi-Arch: foreign
28+Depends: ${misc:Depends}, ${shlibs:Depends}
29+Description: ubuntu-image image definitions
30+ ubuntu-images holds the image definition files that can be used by ubuntu-image tool.
31diff --git a/debian/copyright b/debian/copyright
32new file mode 100644
33index 0000000..ce06e54
34--- /dev/null
35+++ b/debian/copyright
36@@ -0,0 +1,22 @@
37+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
38+
39+Files: *
40+Copyright: Canonical Ltd.
41+License: GPL-3.0
42+
43+License: GPL-3.0
44+ This program is free software: you can redistribute it and/or modify it
45+ under the terms of the GNU General Public License version 3, as
46+ published by the Free Software Foundation.
47+ .
48+ This program is distributed in the hope that it will be useful, but
49+ WITHOUT ANY WARRANTY; without even the implied warranties of
50+ MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
51+ PURPOSE. See the applicable version of the GNU Lesser General Public
52+ License for more details.
53+ .
54+ You should have received a copy of the GNU General Public License
55+ along with this program. If not, see <http://www.gnu.org/licenses/>.
56+ .
57+ On Debian systems, the complete text of the GNU General Public License
58+ can be found in `/usr/share/common-licenses/GPL-3'
59diff --git a/debian/gbp.conf b/debian/gbp.conf
60new file mode 100644
61index 0000000..ccb69a5
62--- /dev/null
63+++ b/debian/gbp.conf
64@@ -0,0 +1,6 @@
65+# Configuration file for "gbp <command>"
66+
67+[DEFAULT]
68+debian-branch = noble
69+debian-tag = ubuntu/%(version)s
70+export-dir = ../build-area
71diff --git a/debian/install b/debian/install
72new file mode 100644
73index 0000000..6ff555d
74--- /dev/null
75+++ b/debian/install
76@@ -0,0 +1,2 @@
77+*.yaml usr/share/ubuntu-images
78+hooks usr/share/ubuntu-images
79diff --git a/debian/rules b/debian/rules
80new file mode 100755
81index 0000000..098338c
82--- /dev/null
83+++ b/debian/rules
84@@ -0,0 +1,5 @@
85+#!/usr/bin/make -f
86+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
87+
88+%:
89+ dh $@
90diff --git a/debian/source/format b/debian/source/format
91new file mode 100644
92index 0000000..89ae9db
93--- /dev/null
94+++ b/debian/source/format
95@@ -0,0 +1 @@
96+3.0 (native)
97diff --git a/hooks/README.md b/hooks/README.md
98new file mode 100644
99index 0000000..675884e
100--- /dev/null
101+++ b/hooks/README.md
102@@ -0,0 +1,45 @@
103+# Hooks to Run During Image Build
104+`hooks` directory witholds the necessary hooks to build specific images.
105+Hooks must be structered using a specific convention explained below and each hook file must be executable.
106+```
107+hooks/
108+├── <subarch>
109+ ├── <execution_order>-<hook_name>.binary
110+ └── <hook_name>.chroot
111+```
112+
113+Example:
114+```
115+hooks/
116+├── kria
117+ ├── 010-flash-kernel-fitimage.binary
118+ ├── 080-add-snaps-to-manifest.binary
119+ ├── wait-cloud-init-before-getty.sh.chroot
120+ └── run-flash-kernel.sh.chroot
121+```
122+
123+## .binary hooks
124+Binary hooks are the hooks that must be run after ubuntu-image build is completed.
125+
126+This hooks are typically being executed from a build script after the image build is completed. Please see below as an example:
127+
128+```bash
129+echo "Binary hooks for $SUBARCH is being executed"
130+for binary in $LB_UBUNTU_IMAGES_ROOT/hooks/$SUBARCH/*.binary; do
131+ echo "Executing $binary $PREFIX..."
132+ $binary $PREFIX
133+done
134+echo "Binary hooks execution completed"
135+```
136+
137+## .chroot hooks
138+Chroot hooks are the hooks that is designed to be run in the chroot shell of the image that is being built. These are the hooks that is typically will be specified in image-definition yaml file as in the example below.
139+
140+```yaml
141+manual:
142+ copy-file:
143+ - source: hooks/kria/wait-cloud-init-before-getty.sh.chroot
144+ destination: /home
145+ execute:
146+ - path: /home/wait-cloud-init-before-getty.sh.chroot
147+```

Subscribers

People subscribed via source and target branches