diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-12-10 03:33:44 +0000 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@gmail.com> | 2024-12-10 03:36:25 +0000 |
commit | 16c742b34499b30819c387698e133c70cfaf0da2 (patch) | |
tree | 6cca1d1a44fed412a384c16926f1bfde0dd10313 | |
parent | 405d625c86bb87500ea5cdb324dbf0fb0b425b5c (diff) | |
download | meta-virtualization-16c742b34499b30819c387698e133c70cfaf0da2.tar.gz |
container-devtools: add editor + package management dependencies
Since we are intalling packagemanagement to this reference container,
it makes sense that our install include common utilities that post
install scriptlets will need.
We also add an editor by default.
Finally, we configure a reference rpm package feed to illustrate
how a container can be hooked to a packagefeed.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
-rw-r--r-- | recipes-extended/images/README.md | 26 | ||||
-rw-r--r-- | recipes-extended/images/container-devtools-base.bb | 31 |
2 files changed, 55 insertions, 2 deletions
diff --git a/recipes-extended/images/README.md b/recipes-extended/images/README.md index f087076a..1a25f724 100644 --- a/recipes-extended/images/README.md +++ b/recipes-extended/images/README.md | |||
@@ -130,7 +130,7 @@ The container shell is changed to bash from busybox. | |||
130 | package-management is added to this image type, but by default there | 130 | package-management is added to this image type, but by default there |
131 | is no package feed configured (since it must be pointed at a build) | 131 | is no package feed configured (since it must be pointed at a build) |
132 | 132 | ||
133 | % root@qemuarm64-54:~# docker run -it zeddii/container-devtools bash | 133 | % root@qemuarm64-54:~# docker run -it zeddii/container-devtools bash |
134 | bash-5.2# du -sh . | 134 | bash-5.2# du -sh . |
135 | 399M . | 135 | 399M . |
136 | bash-5.2# rpm -qa | wc -l | 136 | bash-5.2# rpm -qa | wc -l |
@@ -141,6 +141,30 @@ is no package feed configured (since it must be pointed at a build) | |||
141 | This is free software; see the source for copying conditions. There is NO | 141 | This is free software; see the source for copying conditions. There is NO |
142 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 142 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
143 | 143 | ||
144 | By default this container has (for rpm) package management configured | ||
145 | to point to a feed being run against the local build on the host machine | ||
146 | |||
147 | To create a package feed: | ||
148 | |||
149 | % bitbake package-index | ||
150 | |||
151 | To add a package to the package-index (example: vim-tiny) | ||
152 | |||
153 | % bitbake vim-tiny | ||
154 | % bitbake vim-tiny --runall package_write_rpm | ||
155 | % bitbake package-index | ||
156 | |||
157 | To run a local http server for the package feed: | ||
158 | |||
159 | % cd build/tmp/deploy | ||
160 | % sudo python3 -m http.server 80 | ||
161 | |||
162 | Run the dev container: | ||
163 | |||
164 | % docker run -it zeddii/container-devtools bash | ||
165 | % dnf makecache | ||
166 | % dnf --nogpgcheck install vim-tiny | ||
167 | |||
144 | container-app-base: | 168 | container-app-base: |
145 | -------------------- | 169 | -------------------- |
146 | 170 | ||
diff --git a/recipes-extended/images/container-devtools-base.bb b/recipes-extended/images/container-devtools-base.bb index 21120d1f..12e13fe6 100644 --- a/recipes-extended/images/container-devtools-base.bb +++ b/recipes-extended/images/container-devtools-base.bb | |||
@@ -9,8 +9,15 @@ CORE_DEV_IMAGE_EXTRA_INSTALL ?= "" | |||
9 | include container-base.bb | 9 | include container-base.bb |
10 | inherit core-image | 10 | inherit core-image |
11 | 11 | ||
12 | CORE_DEV_IMAGE_EDITOR ?= "vim-tiny" | ||
13 | # base-utils is required for post-install scriptlets in most packages, | ||
14 | # coreutils or busybox can do the job | ||
15 | CORE_DEV_IMAGE_CORE_UTILS ?= "${VIRTUAL-RUNTIME_base-utils}" | ||
16 | |||
12 | IMAGE_INSTALL += " \ | 17 | IMAGE_INSTALL += " \ |
13 | ${CORE_DEV_IMAGE_EXTRA_INSTALL} \ | 18 | ${CORE_DEV_IMAGE_EXTRA_INSTALL} \ |
19 | ${CORE_DEV_IMAGE_CORE_UTILS} \ | ||
20 | ${CORE_DEV_IMAGE_EDITOR} \ | ||
14 | " | 21 | " |
15 | 22 | ||
16 | OCI_IMAGE_ENTRYPOINT = "" | 23 | OCI_IMAGE_ENTRYPOINT = "" |
@@ -19,4 +26,26 @@ OCI_IMAGE_ENTRYPOINT = "" | |||
19 | # the container. | 26 | # the container. |
20 | IMAGE_FEATURES += "dev-pkgs" | 27 | IMAGE_FEATURES += "dev-pkgs" |
21 | IMAGE_FEATURES += "tools-sdk" | 28 | IMAGE_FEATURES += "tools-sdk" |
22 | IMAGE_FEATURES += "package-management" \ No newline at end of file | 29 | IMAGE_FEATURES += "package-management" |
30 | |||
31 | # This default configuration of 10.0.2.2 is configured | ||
32 | # to contact a web server running against a bitbaked | ||
33 | # package-index | ||
34 | # | ||
35 | # % cd build/tmp/deploy | ||
36 | # % sudo python3 -m http.server 80 | ||
37 | # | ||
38 | DEVTOOLS_BASE_PKG_FEED_URL ?= "http://10.0.2.2/rpm" | ||
39 | |||
40 | |||
41 | # TODO: support more than rpm | ||
42 | ROOTFS_POSTPROCESS_COMMAND += "rootfs_pkg_feed_config ; " | ||
43 | rootfs_pkg_feed_config () { | ||
44 | if [ "${IMAGE_PKGTYPE}" = "rpm" ]; then | ||
45 | install -m 755 -d ${IMAGE_ROOTFS}/${sysconfdir}/yum.repos.d | ||
46 | cat <<EOF >>${IMAGE_ROOTFS}/${sysconfdir}/yum.repos.d/oe-packages.repo | ||
47 | [oe-packages] | ||
48 | baseurl="${DEVTOOLS_BASE_PKG_FEED_URL}" | ||
49 | EOF | ||
50 | fi | ||
51 | } | ||