mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-10-01 06:21:56 -09:00
package/skopeo: add target variant
Skopeo can be used to manipulate container images, and so can be useful on target devices that are going to be used as a host to run containers. So, add a target variant for skopeo. ... with a runtime test while at it. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Christian Stewart <christian@aperture.us> Cc: Yann E. MORIN <yann.morin@orange.com> Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
committed by
Julien Olivain
parent
c1add22462
commit
5c77357c58
@@ -2893,6 +2893,7 @@ menu "System tools"
|
|||||||
source "package/sdbusplus/Config.in"
|
source "package/sdbusplus/Config.in"
|
||||||
source "package/seatd/Config.in"
|
source "package/seatd/Config.in"
|
||||||
source "package/shadow/Config.in"
|
source "package/shadow/Config.in"
|
||||||
|
source "package/skopeo/Config.in"
|
||||||
source "package/smack/Config.in"
|
source "package/smack/Config.in"
|
||||||
source "package/start-stop-daemon/Config.in"
|
source "package/start-stop-daemon/Config.in"
|
||||||
source "package/supervisor/Config.in"
|
source "package/supervisor/Config.in"
|
||||||
|
|||||||
25
package/skopeo/Config.in
Normal file
25
package/skopeo/Config.in
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
config BR2_PACKAGE_SKOPEO
|
||||||
|
bool "skopeo"
|
||||||
|
depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||||
|
depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
|
||||||
|
depends on BR2_USE_MMU # btrfs-progs, libgpgme, lvm2
|
||||||
|
depends on BR2_PACKAGE_LIBGPG_ERROR_ARCH_SUPPORTS # libgpgme
|
||||||
|
depends on BR2_TOOLCHAIN_HAS_THREADS # btrfs-progs, lvm2
|
||||||
|
depends on !BR2_STATIC_LIBS # lvm2
|
||||||
|
select BR2_PACKAGE_HOST_GO
|
||||||
|
select BR2_PACKAGE_BTRFS_PROGS
|
||||||
|
select BR2_PACKAGE_LIBGPGME
|
||||||
|
select BR2_PACKAGE_LVM2
|
||||||
|
help
|
||||||
|
skopeo is a command line utility that performs various
|
||||||
|
operations on container images and image repositories.
|
||||||
|
|
||||||
|
https://github.com/containers/skopeo
|
||||||
|
|
||||||
|
comment "skopeo needs a toolchain w/ threads, sahred libs"
|
||||||
|
depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
|
||||||
|
depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
|
||||||
|
depends on BR2_USE_MMU
|
||||||
|
depends on BR2_PACKAGE_LIBGPG_ERROR_ARCH_SUPPORTS
|
||||||
|
depends on !BR2_TOOLCHAIN_HAS_THREADS \
|
||||||
|
|| BR2_STATIC_LIBS
|
||||||
@@ -11,13 +11,23 @@ SKOPEO_LICENSE = Apache-2.0
|
|||||||
SKOPEO_LICENSE_FILES = LICENSE
|
SKOPEO_LICENSE_FILES = LICENSE
|
||||||
SKOPEO_CPE_ID_VALID = YES
|
SKOPEO_CPE_ID_VALID = YES
|
||||||
|
|
||||||
|
SKOPEO_DEPENDENCIES = \
|
||||||
|
host-pkgconf \
|
||||||
|
btrfs-progs \
|
||||||
|
libgpgme \
|
||||||
|
lvm2
|
||||||
|
|
||||||
HOST_SKOPEO_DEPENDENCIES = \
|
HOST_SKOPEO_DEPENDENCIES = \
|
||||||
host-btrfs-progs \
|
host-btrfs-progs \
|
||||||
host-libgpgme \
|
host-libgpgme \
|
||||||
host-lvm2 \
|
host-lvm2 \
|
||||||
host-pkgconf
|
host-pkgconf
|
||||||
|
|
||||||
|
SKOPEO_GO_ENV = PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig
|
||||||
|
SKOPEO_BUILD_TARGETS = cmd/skopeo
|
||||||
|
|
||||||
HOST_SKOPEO_GO_ENV = PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig
|
HOST_SKOPEO_GO_ENV = PKG_CONFIG_PATH=$(HOST_DIR)/lib/pkgconfig
|
||||||
HOST_SKOPEO_BUILD_TARGETS = cmd/skopeo
|
HOST_SKOPEO_BUILD_TARGETS = cmd/skopeo
|
||||||
|
|
||||||
|
$(eval $(golang-package))
|
||||||
$(eval $(host-golang-package))
|
$(eval $(host-golang-package))
|
||||||
|
|||||||
41
support/testing/tests/package/test_skopeo.py
Normal file
41
support/testing/tests/package/test_skopeo.py
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import infra.basetest
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
class TestSkopeo(infra.basetest.BRTest):
|
||||||
|
config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
|
||||||
|
"""
|
||||||
|
BR2_PER_PACKAGE_DIRECTORIES=y
|
||||||
|
BR2_SYSTEM_DHCP="eth0"
|
||||||
|
BR2_PACKAGE_CA_CERTIFICATES=y
|
||||||
|
BR2_PACKAGE_SKOPEO=y
|
||||||
|
BR2_PACKAGE_HOST_GO_BIN=y
|
||||||
|
BR2_TARGET_ROOTFS_CPIO=y
|
||||||
|
# BR2_TARGET_ROOTFS_TAR is not set
|
||||||
|
"""
|
||||||
|
|
||||||
|
def test_run(self):
|
||||||
|
cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
|
||||||
|
self.emulator.boot(arch="armv5",
|
||||||
|
kernel="builtin",
|
||||||
|
options=["-initrd", cpio_file, "-nic", "user,model=rtl8139"])
|
||||||
|
self.emulator.login()
|
||||||
|
|
||||||
|
self.assertRunOk("skopeo --version", timeout=30)
|
||||||
|
|
||||||
|
# First, check we can reach the default registry: docker.io
|
||||||
|
output, _ = self.emulator.run(
|
||||||
|
"skopeo inspect docker://busybox:latest",
|
||||||
|
timeout=60,
|
||||||
|
)
|
||||||
|
bb_info = json.loads("".join(output))
|
||||||
|
self.assertEqual(bb_info["Name"], "docker.io/library/busybox")
|
||||||
|
|
||||||
|
# Now, check we can reach an arbitrary registry: quay.io
|
||||||
|
output, _ = self.emulator.run(
|
||||||
|
"skopeo inspect docker://quay.io/quay/busybox:latest",
|
||||||
|
timeout=60,
|
||||||
|
)
|
||||||
|
skopeo_info = json.loads("".join(output))
|
||||||
|
self.assertEqual(skopeo_info["Name"], "quay.io/quay/busybox")
|
||||||
Reference in New Issue
Block a user