Skip to content

Commit

Permalink
package/sloci-image: new host package
Browse files Browse the repository at this point in the history
sloci-image is a simple CLI tool for packing rootfs into a single-layer
OCI image.

Signed-off-by: Sergio Prado <[email protected]>
Signed-off-by: Matthew Weber <[email protected]>
[Arnout: correctly set PREFIX, add Matt to DEVELOPERS, add additional
         patch]
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
  • Loading branch information
sergioprado authored and arnout committed Sep 11, 2021
1 parent a600671 commit e83974e
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 0 deletions.
2 changes: 2 additions & 0 deletions DEVELOPERS
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,7 @@ F: package/raptor/
F: package/rng-tools/
F: package/rsyslog/
F: package/setools/
F: package/sloci-image/
F: package/smcroute/
F: package/tclap/
F: package/tini/
Expand Down Expand Up @@ -2435,6 +2436,7 @@ F: package/curlpp/
F: package/daq/
F: package/libgdiplus/
F: package/pimd/
F: package/sloci-image/
F: package/snort/
F: package/stella/
F: package/tio/
Expand Down
1 change: 1 addition & 0 deletions package/Config.in.host
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ menu "Host utilities"
source "package/s6-rc/Config.in.host"
source "package/sam-ba/Config.in.host"
source "package/sdbusplus/Config.in.host"
source "package/sloci-image/Config.in.host"
source "package/squashfs/Config.in.host"
source "package/sunxi-tools/Config.in.host"
source "package/swig/Config.in.host"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
From 66c73c2ba3057634f19f37d3cfbbe752638c9f9f Mon Sep 17 00:00:00 2001
From: Matthew Weber <[email protected]>
Date: Fri, 27 Aug 2021 12:24:19 -0500
Subject: [PATCH] create OCI tar from the contents of working folder

When testing with containerd, it was found that the tarfile
created with sloci can't import because the contents are inside
a folder. Looking around online, it seems that the an oci tar
should container the blob/index.json/oci-layout in the . of the
tarfile.

Upstream: https://github.com/jirutka/sloci-image/pull/3

Refs:
https://snyk.io/blog/container-image-formats/
https://github.com/opencontainers/image-spec/blob/main/image-layout.md

Signed-off-by: Matthew Weber <[email protected]>
---
sloci-image | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sloci-image b/sloci-image
index 90dba26..7f3c775 100755
--- a/sloci-image
+++ b/sloci-image
@@ -425,6 +425,6 @@ if [ "$OUT_TYPE" = tar ]; then
file_name="$IMAGE_NAME-$CFG_REF_NAME-$CFG_ARCH"
file_name="$file_name${CFG_ARCH_VARIANT:+"-$CFG_ARCH_VARIANT"}-$CFG_OS.oci-image"

- tar ${DEBUG:+-v} -cf "$file_name.tar" "$IMAGE_NAME"
+ tar ${DEBUG:+-v} -cf "$file_name.tar" -C "$IMAGE_NAME" .
rm -Rf "$IMAGE_NAME"
fi
--
2.17.1

39 changes: 39 additions & 0 deletions package/sloci-image/0002-oci_arch-fix-arch-arm64-argument.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 67b16c65cdf0f654275802d6d12451a81a4d2796 Mon Sep 17 00:00:00 2001
From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>
Date: Sat, 11 Sep 2021 14:37:20 +0200
Subject: [PATCH] oci_arch: fix "--arch arm64" argument

The --arch argument presumably should take the appropriate GOARCH-type
string. The oci_arch() function does some conversion on it, which is
needed because without --arch the architecture is taken from "uname -m",
which yields something different than a GOARCH-type string.

However, oci_arch() converts arm* into arm, which is wrong for arm64.
Since arm64 is a proper GOARCH-type string, it shouldn't be converted at
all.

Upate the case statement to convert arm64 to arm64 (i.e., do nothing).
Since the arm64 match comes before arm*, it takes precedence.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Upstream: https://github.com/jirutka/sloci-image/pull/4
---
sloci-image | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sloci-image b/sloci-image
index 7f3c775..6844023 100755
--- a/sloci-image
+++ b/sloci-image
@@ -214,7 +214,7 @@ oci_arch() {
case "$1" in
x86_64) echo amd64;;
x86) echo 386;;
- aarch64) echo arm64;;
+ aarch64|arm64) echo arm64;;
arm*) echo arm;;
*) echo "$1";;
esac
--
2.31.1

7 changes: 7 additions & 0 deletions package/sloci-image/Config.in.host
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
config BR2_PACKAGE_HOST_SLOCI_IMAGE
bool "host sloci-image"
help
A simple CLI tool for packing rootfs into a single-layer OCI
image.

https://github.com/jirutka/sloci-image
5 changes: 5 additions & 0 deletions package/sloci-image/sloci-image.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Locally computed
sha256 56fbc335c193eccc3992f0a723c6dabe762f6d4854fc52059be074bdf5060d9e sloci-image-0.1.1.tar.gz

# Hash for license files:
sha256 8ea53673b084576813fc40cd63817c5a1619438942b5e6c30dac1d10707c27e4 LICENSE
19 changes: 19 additions & 0 deletions package/sloci-image/sloci-image.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
################################################################################
#
# sloci-image
#
################################################################################

SLOCI_IMAGE_VERSION = 0.1.1
SLOCI_IMAGE_SITE = $(call github,jirutka,sloci-image,v$(SLOCI_IMAGE_VERSION))

SLOCI_IMAGE_LICENSE = MIT
SLOCI_IMAGE_LICENSE_FILES = LICENSE

HOST_SLOCI_IMAGE_DEPENDENCIES = host-gawk

define HOST_SLOCI_IMAGE_INSTALL_CMDS
$(HOST_MAKE_ENV) $(MAKE) PREFIX=$(HOST_DIR) -C $(@D) install
endef

$(eval $(host-generic-package))

0 comments on commit e83974e

Please sign in to comment.