[gnome-build-meta/valentindavid/snapd] Add snapd
- From: Valentin David <valentindavid src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-build-meta/valentindavid/snapd] Add snapd
- Date: Tue, 5 Oct 2021 19:00:11 +0000 (UTC)
commit 8aa3781f14a8f93961577fa0f7ba3a863ce23fb0
Author: Valentin David <me valentindavid com>
Date: Tue Oct 5 20:59:54 2021 +0200
Add snapd
elements/core-deps/snapd-glib.bst | 19 ++++++
elements/core/gnome-software.bst | 2 +
elements/freedesktop-sdk.bst | 4 +-
elements/vm/deps-devel.bst | 1 +
elements/vm/ostree-config.bst | 9 ++-
elements/vm/snapd.bst | 122 ++++++++++++++++++++++++++++++++++++++
files/snapd/fix-mount-dir.patch | 11 ++++
files/snapd/tmpfiles-snapd.conf | 2 +
files/vm/ostree-config/home.mount | 13 ++++
files/vm/ostree-config/root.mount | 13 ++++
junction.refs | 2 +-
11 files changed, 192 insertions(+), 6 deletions(-)
---
diff --git a/elements/core-deps/snapd-glib.bst b/elements/core-deps/snapd-glib.bst
new file mode 100644
index 000000000..5d74d14e6
--- /dev/null
+++ b/elements/core-deps/snapd-glib.bst
@@ -0,0 +1,19 @@
+kind: meson
+
+sources:
+- kind: tar
+ url: github_com:snapcore/snapd-glib/releases/download/1.59/snapd-glib-1.59.tar.xz
+
+build-depends:
+- sdk/gobject-introspection.bst
+- sdk/gtk-doc.bst
+- freedesktop-sdk.bst:public-stacks/buildsystem-meson.bst
+
+depends:
+- sdk/json-glib.bst
+- sdk/libsoup-2.4.bst
+- sdk/vala.bst
+
+variables:
+ meson-local: >-
+ -Dqt-bindings=false
diff --git a/elements/core/gnome-software.bst b/elements/core/gnome-software.bst
index ae9e8c4d2..a34f8d61e 100644
--- a/elements/core/gnome-software.bst
+++ b/elements/core/gnome-software.bst
@@ -16,6 +16,7 @@ depends:
- core-deps/gspell.bst
- core-deps/liboauth.bst
- core-deps/malcontent.bst
+- core-deps/snapd-glib.bst
- core-deps/xmlb.bst
- core/gnome-desktop.bst
- sdk/adwaita-icon-theme.bst
@@ -36,6 +37,7 @@ variables:
-Dflatpak=true
-Deos_updater=true
-Dpackagekit=false
+ -Dsnap=true
config:
configure-commands:
(<):
diff --git a/elements/freedesktop-sdk.bst b/elements/freedesktop-sdk.bst
index 28626d767..34c3b668a 100644
--- a/elements/freedesktop-sdk.bst
+++ b/elements/freedesktop-sdk.bst
@@ -2,8 +2,8 @@ kind: junction
sources:
- kind: git_tag
url: https://gitlab.com/freedesktop-sdk/freedesktop-sdk.git
- track: release/21.08
- track-tags: true
+ track: valentindavid/snapd-21.08
+ track-tags: false
config:
options:
target_arch: '%{arch}'
diff --git a/elements/vm/deps-devel.bst b/elements/vm/deps-devel.bst
index c02e207fb..2060e9ba9 100644
--- a/elements/vm/deps-devel.bst
+++ b/elements/vm/deps-devel.bst
@@ -10,4 +10,5 @@ depends:
- vm/initramfs.bst
- vm/lxc.bst
- vm/os-release-devel.bst
+- vm/snapd.bst
- vm/toolbox.bst
diff --git a/elements/vm/ostree-config.bst b/elements/vm/ostree-config.bst
index afdd3f8e9..70b18f62f 100644
--- a/elements/vm/ostree-config.bst
+++ b/elements/vm/ostree-config.bst
@@ -32,16 +32,19 @@ config:
mkdir %{install-root}/tmp
mkdir %{install-root}/dev
mkdir %{install-root}/proc
+ mkdir %{install-root}/home
+ mkdir %{install-root}/root
- |
mkdir -p "%{install-root}/sysroot"
ln -s sysroot/ostree "%{install-root}/ostree"
- ln -s var/home "%{install-root}/home"
- rm -rf "%{install-root}/root"
- ln -s var/roothome "%{install-root}/root"
ln -s run/media "%{install-root}/media"
+ ln -s var/lib/snapd/snap "%{install-root}/snap"
- |
install -Dm644 -t "%{install-root}/usr/lib/tmpfiles.d" ostree.conf
install -Dm644 *.gpg "%{install-root}/etc/pki/ostree/gnome.gpg"
install -Dm644 -t "%{install-root}/etc/ostree/remotes.d" gnome.conf
+
+ - |
+ install -Dm644 -t "%{install-root}/usr/lib/systemd/system" home.mount root.mount
diff --git a/elements/vm/snapd.bst b/elements/vm/snapd.bst
new file mode 100644
index 000000000..3ae472cb1
--- /dev/null
+++ b/elements/vm/snapd.bst
@@ -0,0 +1,122 @@
+kind: autotools
+
+sources:
+- kind: tar
+ url: https://github.com/snapcore/snapd/releases/download/2.52/snapd_2.52.vendor.tar.xz
+- kind: patch
+ path: files/snapd/fix-mount-dir.patch
+- kind: local
+ path: files/snapd/tmpfiles-snapd.conf
+
+build-depends:
+- freedesktop-sdk.bst:public-stacks/buildsystem-autotools.bst
+- freedesktop-sdk.bst:components/go.bst
+- freedesktop-sdk.bst:components/git-minimal.bst
+- freedesktop-sdk.bst:components/systemd.bst
+
+depends:
+- sdk/glib.bst
+- freedesktop-sdk.bst:components/apparmor.bst
+- freedesktop-sdk.bst:components/libseccomp.bst
+- freedesktop-sdk.bst:components/squashfs-tools.bst
+- freedesktop-sdk.bst:components/squashfs-tools.bst
+- freedesktop-sdk.bst:components/systemd-libs.bst
+- freedesktop-sdk.bst:components/xfsprogs.bst
+- freedesktop-sdk.bst:bootstrap-import.bst
+
+environment:
+ GOPATH: "%{build-root}"
+ GO111MODULE: 'off'
+
+variables:
+ mount-dir: '%{localstatedir}/lib/snapd/snap'
+ conf-local: >-
+ --enable-merged-usr
+ --enable-apparmor
+ --disable-selinux
+ --with-snap-mount-dir="%{mount-dir}"
+ --without-unit-tests
+ libexecdir: '%{indep-libdir}/snapd'
+ go-flags: |
+ -buildmode=pie \
+ -ldflags "-s -linkmode external -extldflags '$LDFLAGS'"
+ go-static-flags: |
+ -buildmode=pie \
+ -ldflags "-s -linkmode external -extldflags '$LDFLAGS -static'"
+
+config:
+ configure-commands:
+ - |
+ mkdir -p src/github.com/snapcore
+ ln -sr . src/github.com/snapcore/snapd
+
+ - |
+ ./mkversion.sh 2.52
+
+ - |
+ cd cmd
+ autoreconf -i -f
+
+ - |
+ cd cmd
+ ./configure %{conf-args}
+
+ build-commands:
+ - go build -o bins/snapd %{go-flags} github.com/snapcore/snapd/cmd/snapd
+ - go build -o bins/snap %{go-flags} github.com/snapcore/snapd/cmd/snap
+ - go build -o bins/snap-failure %{go-flags} github.com/snapcore/snapd/cmd/snap-failure
+ - go build -o bins/snap-seccomp %{go-flags} github.com/snapcore/snapd/cmd/snap-seccomp
+ - go build -o bins/snap-update-ns %{go-static-flags} github.com/snapcore/snapd/cmd/snap-update-ns
+ - |
+ go build -o bins/snap-exec %{go-static-flags} github.com/snapcore/snapd/cmd/snap-exec
+ - |
+ go build -o bins/snapctl %{go-static-flags} github.com/snapcore/snapd/cmd/snapctl
+
+ - |
+ make -C cmd
+
+ install-commands:
+ - |
+ install -Dm755 -t '%{install-root}%{libexecdir}' \
+ bins/snapd \
+ bins/snap \
+ bins/snap-failure \
+ bins/snap-seccomp \
+ bins/snap-update-ns \
+ bins/snap-exec \
+ bins/snapctl
+
+ - |
+ install -Dm755 -d '%{install-root}%{bindir}'
+ ln -sr '%{install-root}%{libexecdir}/snap' '%{install-root}%{bindir}/snap'
+
+ - |
+ make -C data -j1 install DESTDIR='%{install-root}' \
+ SYSTEMDSYSTEMUNITDIR="$(pkg-config --variable=systemdsystemunitdir systemd)" \
+ BINDIR="%{bindir}" \
+ LIBEXECDIR="%{indep-libdir}" \
+ SNAP_MOUNT_DIR="%{mount-dir}" \
+ SNAPD_ENVIRONMENT_FILE="%{sysconfdir}/default/snapd"
+
+ - |
+ make -C cmd -j1 install DESTDIR='%{install-root}'
+
+ - |
+ rm -rf '%{install-root}/var'
+
+ - |
+ dir="$(pkg-config --variable=tmpfilesdir systemd)"
+ install -Dm644 tmpfiles-snapd.conf "%{install-root}${dir}/snapd.conf"
+
+ - |
+ install -Dm644 -d "%{install-root}%{prefix}/src"
+
+ - |
+ install -Dm644 -t "%{install-root}%{datadir}/polkit-1/actions" data/polkit/io.snapcraft.snapd.policy
+
+public:
+ initial-script:
+ script: |
+ #!/bin/bash
+ sysroot="${1}"
+ chmod 4755 "${sysroot}%{indep-libdir}/snapd/snap-confine"
diff --git a/files/snapd/fix-mount-dir.patch b/files/snapd/fix-mount-dir.patch
new file mode 100644
index 000000000..1e2fa75ec
--- /dev/null
+++ b/files/snapd/fix-mount-dir.patch
@@ -0,0 +1,11 @@
+diff -ur snapd.old/dirs/dirs.go snapd/dirs/dirs.go
+--- snapd.old/dirs/dirs.go 2021-10-02 17:27:51.578196035 +0200
++++ snapd/dirs/dirs.go 2021-10-04 14:00:34.857702020 +0200
+@@ -305,6 +305,7 @@
+ "gentoo",
+ "manjaro",
+ "manjaro-arm",
++ "org.gnome.gnomeos",
+ }
+
+ isInsideBase, _ := isInsideBaseSnap()
diff --git a/files/snapd/tmpfiles-snapd.conf b/files/snapd/tmpfiles-snapd.conf
new file mode 100644
index 000000000..ad2db6af1
--- /dev/null
+++ b/files/snapd/tmpfiles-snapd.conf
@@ -0,0 +1,2 @@
+d /var/lib/snapd/apparmor/snap-confine 0755 root root -
+d /var/lib/snapd/void 0111 root root -
diff --git a/files/vm/ostree-config/home.mount b/files/vm/ostree-config/home.mount
new file mode 100644
index 000000000..06828b7e8
--- /dev/null
+++ b/files/vm/ostree-config/home.mount
@@ -0,0 +1,13 @@
+[Unit]
+Description=Bind mount of /home
+DefaultDependencies=no
+Before=local-fs.target snapd.service
+
+[Mount]
+What=/var/home
+Where=/home
+Type=none
+Options=bind
+
+[Install]
+WantedBy=local-fs.target
diff --git a/files/vm/ostree-config/root.mount b/files/vm/ostree-config/root.mount
new file mode 100644
index 000000000..033bd9199
--- /dev/null
+++ b/files/vm/ostree-config/root.mount
@@ -0,0 +1,13 @@
+[Unit]
+Description=Bind mount of /root
+DefaultDependencies=no
+Before=local-fs.target snapd.service
+
+[Mount]
+What=/var/roothome
+Where=/root
+Type=none
+Options=bind
+
+[Install]
+WantedBy=local-fs.target
diff --git a/junction.refs b/junction.refs
index 83d8430aa..a7a16ef84 100644
--- a/junction.refs
+++ b/junction.refs
@@ -1,4 +1,4 @@
projects:
gnome:
freedesktop-sdk.bst:
- - ref: freedesktop-sdk-21.08.4-0-g4f34c6f740f1ab420cf0cfe1af84c11af5c4e30c
+ - ref: freedesktop-sdk-21.08.4-29-gc31f586521bc1c447f305a9339659356aa213bad
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]