[gnome-build-meta/valentindavid/oci] Build OCI images




commit 69bdef7c12304562340e95508333ca8757365787
Author: Valentin David <me valentindavid com>
Date:   Sun Oct 10 15:05:18 2021 +0200

    Build OCI images
    
    Part of #350

 .gitlab-ci.yml                                |  2 +-
 elements/oci/debug.bst                        | 40 +++++++++++++++++++++++++++
 elements/oci/layers/debug.bst                 | 11 ++++++++
 elements/oci/layers/platform-init-scripts.bst |  7 +++++
 elements/oci/layers/platform.bst              | 14 ++++++++++
 elements/oci/layers/sdk-init-scripts.bst      |  7 +++++
 elements/oci/layers/sdk.bst                   | 13 +++++++++
 elements/oci/layers/toolbox-init-scripts.bst  |  7 +++++
 elements/oci/layers/toolbox-stack.bst         | 21 ++++++++++++++
 elements/oci/layers/toolbox.bst               | 13 +++++++++
 elements/oci/platform.bst                     | 40 +++++++++++++++++++++++++++
 elements/oci/sdk.bst                          | 40 +++++++++++++++++++++++++++
 elements/oci/toolbox.bst                      | 40 +++++++++++++++++++++++++++
 project.conf                                  |  9 ++++++
 14 files changed, 263 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 271e35a6f..8d05d4de7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -39,7 +39,7 @@ default:
     optional: true
   interruptible: true
   script:
-  - TARGETS=(core.bst flatpak-runtimes.bst flatpak-platform-extensions.bst flatpak/platform-manifest.bst 
flatpak/sdk-manifest.bst)
+  - TARGETS=(core.bst flatpak-runtimes.bst flatpak-platform-extensions.bst flatpak/platform-manifest.bst 
flatpak/sdk-manifest.bst oci/debug.bst oci/platform.bst oci/sdk.bst oci/toolbox.bst)
 
   - |
     case "${ARCH}" in
diff --git a/elements/oci/debug.bst b/elements/oci/debug.bst
new file mode 100644
index 000000000..8e129b7ff
--- /dev/null
+++ b/elements/oci/debug.bst
@@ -0,0 +1,40 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:oci/oci-builder.bst
+- oci/sdk.bst
+- oci/layers/debug.bst
+- oci/layers/sdk-init-scripts.bst
+
+config:
+  layout:
+  - element: oci/oci-builder.bst
+    destination: /
+  - element: oci/layers/debug.bst
+    destination: /layer
+  - element: oci/sdk.bst
+    destination: /parent
+  - element: oci/layers/sdk-init-scripts.bst
+    destination: /
+
+  commands:
+  - |
+    if [ -d /initial_scripts ]; then
+      for i in /initial_scripts/*; do
+        "${i}" /layer
+      done
+    fi
+
+  - |
+    cd "%{install-root}"
+    build-oci <<EOF
+    mode: oci
+    gzip: False
+    images:
+    - os: linux
+      architecture: "%{go-arch}"
+      parent:
+        image: /parent
+      layer: /layer
+      comment: "Import debuginfo files from GNOME SDK"
+    EOF
diff --git a/elements/oci/layers/debug.bst b/elements/oci/layers/debug.bst
new file mode 100644
index 000000000..98f40e065
--- /dev/null
+++ b/elements/oci/layers/debug.bst
@@ -0,0 +1,11 @@
+kind: compose
+
+build-depends:
+- sdk.bst
+- sdk/os-release.bst
+
+config:
+  exclude:
+  - locale
+  - extra
+  - vm-only
diff --git a/elements/oci/layers/platform-init-scripts.bst b/elements/oci/layers/platform-init-scripts.bst
new file mode 100644
index 000000000..2b9ff801f
--- /dev/null
+++ b/elements/oci/layers/platform-init-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- sdk-platform.bst
+
+config:
+  path: /initial_scripts
diff --git a/elements/oci/layers/platform.bst b/elements/oci/layers/platform.bst
new file mode 100644
index 000000000..38acf8f12
--- /dev/null
+++ b/elements/oci/layers/platform.bst
@@ -0,0 +1,14 @@
+kind: compose
+
+build-depends:
+- sdk-platform.bst
+- sdk/os-release.bst
+
+config:
+  exclude:
+  - debug
+  - devel
+  - doc
+  - locale
+  - extra
+  - vm-only
diff --git a/elements/oci/layers/sdk-init-scripts.bst b/elements/oci/layers/sdk-init-scripts.bst
new file mode 100644
index 000000000..7e54b44f5
--- /dev/null
+++ b/elements/oci/layers/sdk-init-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- sdk.bst
+
+config:
+  path: /initial_scripts
diff --git a/elements/oci/layers/sdk.bst b/elements/oci/layers/sdk.bst
new file mode 100644
index 000000000..82e6da50b
--- /dev/null
+++ b/elements/oci/layers/sdk.bst
@@ -0,0 +1,13 @@
+kind: compose
+
+build-depends:
+- sdk.bst
+- sdk/os-release.bst
+
+config:
+  exclude:
+  - debug
+  - locale
+  - extra
+  - static-blocklist
+  - vm-only
diff --git a/elements/oci/layers/toolbox-init-scripts.bst b/elements/oci/layers/toolbox-init-scripts.bst
new file mode 100644
index 000000000..64f1cc19e
--- /dev/null
+++ b/elements/oci/layers/toolbox-init-scripts.bst
@@ -0,0 +1,7 @@
+kind: collect_initial_scripts
+
+build-depends:
+- oci/layers/toolbox-stack.bst
+
+config:
+  path: /initial_scripts
diff --git a/elements/oci/layers/toolbox-stack.bst b/elements/oci/layers/toolbox-stack.bst
new file mode 100644
index 000000000..94ac8a27d
--- /dev/null
+++ b/elements/oci/layers/toolbox-stack.bst
@@ -0,0 +1,21 @@
+kind: stack
+
+depends:
+- sdk.bst
+- sdk/os-release.bst
+- freedesktop-sdk.bst:components/sudo.bst
+- freedesktop-sdk.bst:components/shadow.bst
+
+public:
+  bst:
+    integration-commands:
+    - groupadd root -r -g 0
+    - useradd root -rm -u 0 -g 0 -d /root
+    - groupadd -r wheel
+    - |
+      cat <<EOF >>/etc/sudoers
+      %wheel ALL=(ALL) NOPASSWD: ALL
+      EOF
+    - mkdir -p /media
+    - mkdir -p /home
+    - touch /etc/machine-id
diff --git a/elements/oci/layers/toolbox.bst b/elements/oci/layers/toolbox.bst
new file mode 100644
index 000000000..e0e9673aa
--- /dev/null
+++ b/elements/oci/layers/toolbox.bst
@@ -0,0 +1,13 @@
+kind: compose
+
+build-depends:
+- oci/layers/toolbox-stack.bst
+
+config:
+  exclude:
+  - debug
+  - doc
+  - locale
+  - extra
+  - static-blocklist
+  - vm-only
diff --git a/elements/oci/platform.bst b/elements/oci/platform.bst
new file mode 100644
index 000000000..6a0891d7f
--- /dev/null
+++ b/elements/oci/platform.bst
@@ -0,0 +1,40 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:oci/oci-builder.bst
+- freedesktop-sdk.bst:oci/platform-oci.bst
+- oci/layers/platform.bst
+- oci/layers/platform-init-scripts.bst
+
+config:
+  layout:
+  - element: oci/oci-builder.bst
+    destination: /
+  - element: oci/layers/platform.bst
+    destination: /layer
+  - element: oci/platform-oci.bst
+    destination: /parent
+  - element: oci/layers/platform-init-scripts.bst
+    destination: /
+
+  commands:
+  - |
+    if [ -d /initial_scripts ]; then
+      for i in /initial_scripts/*; do
+        "${i}" /layer
+      done
+    fi
+
+  - |
+    cd "%{install-root}"
+    build-oci <<EOF
+    mode: oci
+    gzip: False
+    images:
+    - os: linux
+      architecture: "%{go-arch}"
+      parent:
+        image: /parent
+      layer: /layer
+      comment: "Import platform layer from GNOME SDK"
+    EOF
diff --git a/elements/oci/sdk.bst b/elements/oci/sdk.bst
new file mode 100644
index 000000000..809d22a3a
--- /dev/null
+++ b/elements/oci/sdk.bst
@@ -0,0 +1,40 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:oci/oci-builder.bst
+- oci/platform.bst
+- oci/layers/sdk.bst
+- oci/layers/sdk-init-scripts.bst
+
+config:
+  layout:
+  - element: oci/oci-builder.bst
+    destination: /
+  - element: oci/layers/sdk.bst
+    destination: /layer
+  - element: oci/platform.bst
+    destination: /parent
+  - element: oci/layers/sdk-init-scripts.bst
+    destination: /
+
+  commands:
+  - |
+    if [ -d /initial_scripts ]; then
+      for i in /initial_scripts/*; do
+        "${i}" /layer
+      done
+    fi
+
+  - |
+    cd "%{install-root}"
+    build-oci <<EOF
+    mode: oci
+    gzip: False
+    images:
+    - os: linux
+      architecture: "%{go-arch}"
+      parent:
+        image: /parent
+      layer: /layer
+      comment: "Import SDK layer from GNOME SDK"
+    EOF
diff --git a/elements/oci/toolbox.bst b/elements/oci/toolbox.bst
new file mode 100644
index 000000000..1b87adb38
--- /dev/null
+++ b/elements/oci/toolbox.bst
@@ -0,0 +1,40 @@
+kind: script
+
+build-depends:
+- freedesktop-sdk.bst:oci/oci-builder.bst
+- oci/sdk.bst
+- oci/layers/toolbox.bst
+- oci/layers/sdk-init-scripts.bst
+
+config:
+  layout:
+  - element: oci/oci-builder.bst
+    destination: /
+  - element: oci/layers/toolbox.bst
+    destination: /layer
+  - element: oci/sdk.bst
+    destination: /parent
+  - element: oci/layers/sdk-init-scripts.bst
+    destination: /
+
+  commands:
+  - |
+    if [ -d /initial_scripts ]; then
+      for i in /initial_scripts/*; do
+        "${i}" /layer
+      done
+    fi
+
+  - |
+    cd "%{install-root}"
+    build-oci <<EOF
+    mode: oci
+    gzip: False
+    images:
+    - os: linux
+      architecture: "%{go-arch}"
+      parent:
+        image: /parent
+      layer: /layer
+      comment: "Convert GNOME SDK to a toolbox image"
+    EOF
diff --git a/project.conf b/project.conf
index 1cbebfc3b..cfc6935e0 100644
--- a/project.conf
+++ b/project.conf
@@ -335,12 +335,21 @@ variables:
   local_flags: ''
 
   (?):
+  - arch == "x86_64":
+      go-arch: "amd64"
   - arch == "i686":
       gcc_arch: "i386"
+      go-arch: "386"
+  - arch == "aarch64":
+      go-arch: "arm64"
   - arch == "arm":
       abi: "gnueabihf"
+      go-arch: "arm"
   - arch == "ppc64le":
       gcc_arch: "powerpc64le"
+      go-arch: "ppc64le"
+  - arch == "riscv64":
+      go-arch: "riscv64"
 
 plugins:
 - origin: pip


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]