-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
snapcraft.yaml: add minimal snapcraft.yaml with custom build
This adds a minimal snapcraft.yaml and a custom build plugin. The snapcraft.yaml only puts the bits into the snapd snap for now. This means we can start testing the core18/snapd interplay. The plugin will just reuse the deb building (which we have to maintain anyway). The plugin should probably be cleaned up and pushed upstream as this seems to be useful for projects that already have a (complicated) deb based build setup. One issue with the current snapcraft is that it does not deal with a source dir called "snap" well. We have code located there but snapcraft will ignore this dir when pulling code or when setting up the build tree: https://bugs.launchpad.net/bugs/1772584
- Loading branch information
Showing
2 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (C) 2018 Canonical Ltd | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 3 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import glob | ||
import os | ||
|
||
import snapcraft | ||
|
||
# cowboy baby, see https://bugs.launchpad.net/snapcraft/+bug/1772584 | ||
def patch_snapcraft(): | ||
import snapcraft.internal.common | ||
# very hacky but gets the job done for now, right now | ||
# SNAPCRAFT_FILES is only used to know what to exclude | ||
snapcraft.internal.common.SNAPCRAFT_FILES.remove("snap") | ||
patch_snapcraft() | ||
|
||
|
||
|
||
class XBuildDeb(snapcraft.BasePlugin): | ||
|
||
def build(self): | ||
self.run(["sudo", "apt-get", "build-dep", "-y", "./"]) | ||
# XXX: get this from "debian/gbp.conf:postexport" | ||
self.run(["./get-deps.sh"]) | ||
# run the real build | ||
self.run(["dpkg-buildpackage", "--no-sign"]) | ||
# and "install" into the right place | ||
snapd_deb = glob.glob("../snapd_*.deb")[0] | ||
self.run(["dpkg-deb", "-x", os.path.abspath(snapd_deb), self.installdir]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: snapd | ||
summary: Daemon and tooling that enable snap packages | ||
description: | | ||
Install, configure, refresh and remove snap packages. Snaps are | ||
'universal' packages that work across many different Linux systems, | ||
enabling secure distribution of the latest apps and utilities for | ||
cloud, servers, desktops and the internet of things. | ||
This is the CLI for snapd, a background service that takes care of | ||
snaps on the system. Start with 'snap list' to see installed snaps. | ||
version: set-by-version-script-thxbye | ||
version-script: | | ||
# extract the version from the debian/changelog | ||
dpkg-parsechangelog -Sversion | ||
grade: devel | ||
|
||
parts: | ||
snapd: | ||
# FIXME: this should probably go upstream | ||
plugin: x-builddeb | ||
source: . | ||
|
||
# Note that this snap is unusual in that it has no "apps" section. | ||
# | ||
# It is started via re-exec on classic systems and via special | ||
# handling in the core18 snap on Ubuntu Core Systems. | ||
# | ||
# Because snapd itself manages snaps it must currently run totally | ||
# unconfined (even devmode is not enough). | ||
# | ||
# See the comments from jdstrand in | ||
# https://forum.snapcraft.io/t/5547/10 |