From 16c742b34499b30819c387698e133c70cfaf0da2 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 10 Dec 2024 03:33:44 +0000 Subject: 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 --- recipes-extended/images/README.md | 26 +++++++++++++++++- 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. package-management is added to this image type, but by default there is no package feed configured (since it must be pointed at a build) - % root@qemuarm64-54:~# docker run -it zeddii/container-devtools bash + % root@qemuarm64-54:~# docker run -it zeddii/container-devtools bash bash-5.2# du -sh . 399M . bash-5.2# rpm -qa | wc -l @@ -141,6 +141,30 @@ is no package feed configured (since it must be pointed at a build) This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +By default this container has (for rpm) package management configured +to point to a feed being run against the local build on the host machine + +To create a package feed: + + % bitbake package-index + +To add a package to the package-index (example: vim-tiny) + + % bitbake vim-tiny + % bitbake vim-tiny --runall package_write_rpm + % bitbake package-index + +To run a local http server for the package feed: + + % cd build/tmp/deploy + % sudo python3 -m http.server 80 + +Run the dev container: + + % docker run -it zeddii/container-devtools bash + % dnf makecache + % dnf --nogpgcheck install vim-tiny + container-app-base: -------------------- 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 ?= "" include container-base.bb inherit core-image +CORE_DEV_IMAGE_EDITOR ?= "vim-tiny" +# base-utils is required for post-install scriptlets in most packages, +# coreutils or busybox can do the job +CORE_DEV_IMAGE_CORE_UTILS ?= "${VIRTUAL-RUNTIME_base-utils}" + IMAGE_INSTALL += " \ ${CORE_DEV_IMAGE_EXTRA_INSTALL} \ + ${CORE_DEV_IMAGE_CORE_UTILS} \ + ${CORE_DEV_IMAGE_EDITOR} \ " OCI_IMAGE_ENTRYPOINT = "" @@ -19,4 +26,26 @@ OCI_IMAGE_ENTRYPOINT = "" # the container. IMAGE_FEATURES += "dev-pkgs" IMAGE_FEATURES += "tools-sdk" -IMAGE_FEATURES += "package-management" \ No newline at end of file +IMAGE_FEATURES += "package-management" + +# This default configuration of 10.0.2.2 is configured +# to contact a web server running against a bitbaked +# package-index +# +# % cd build/tmp/deploy +# % sudo python3 -m http.server 80 +# +DEVTOOLS_BASE_PKG_FEED_URL ?= "http://10.0.2.2/rpm" + + +# TODO: support more than rpm +ROOTFS_POSTPROCESS_COMMAND += "rootfs_pkg_feed_config ; " +rootfs_pkg_feed_config () { + if [ "${IMAGE_PKGTYPE}" = "rpm" ]; then + install -m 755 -d ${IMAGE_ROOTFS}/${sysconfdir}/yum.repos.d +cat <>${IMAGE_ROOTFS}/${sysconfdir}/yum.repos.d/oe-packages.repo +[oe-packages] +baseurl="${DEVTOOLS_BASE_PKG_FEED_URL}" +EOF + fi +} -- cgit v1.2.3-54-g00ecf