Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snapcraft.yaml: use build-base and adopt-info, rm builddeb plugin #7904

Merged
merged 6 commits into from Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion HACKING.md
Expand Up @@ -234,7 +234,7 @@ To get started from a pristine tree you want to do this:
./mkversion.sh
cd cmd/
autoreconf -i -f
./configure --prefix=/usr --libexecdir=/usr/lib/snapd --enable-nvidia-multiarch --with-host-arch-triplet=$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
./configure --prefix=/usr --libexecdir=/usr/lib/snapd --enable-nvidia-multiarch --with-host-arch-triplet="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
```

This will drop makefiles and let you build stuff. You may find the `make hack`
Expand Down
67 changes: 46 additions & 21 deletions snapcraft.yaml → build-aux/snap/snapcraft.yaml
@@ -1,21 +1,20 @@
name: snapd
# TODO: enable this when the store is ready
# type: 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.

Start with 'snap list' to see installed snaps.
version: set-by-version-script-thxbye
version-script: |
./mkversion.sh --output-only
#FIXME: enable once snapcraft understands this
#type: snapd
grade: stable
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.

passthrough:
license: GPL-3.0
Start with 'snap list' to see installed snaps.
adopt-info: snapd
# build-base is needed here for snapcraft to build this snap as with "modern"
# snapcraft
build-base: core
grade: stable
license: GPL-3.0

# Note that this snap is unusual in that it has no "apps" section.
#
Expand All @@ -29,9 +28,36 @@ passthrough:
# https://forum.snapcraft.io/t/5547/10
parts:
snapd:
# FIXME: this should probably go upstream
plugin: x-builddeb
plugin: nil
source: .
build-snaps: [go/1.10/stable]
override-pull: |
snapcraftctl pull
# install build dependencies
export DEBIAN_FRONTEND=noninteractive
export DEBCONF_NONINTERACTIVE_SEEN=true
sudo apt-get build-dep -y ./
./get-deps.sh --skip-unused-check
# set version after installing dependencies so we have all the tools here
snapcraftctl set-version $(./mkversion.sh --output-only)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
snapcraftctl set-version $(./mkversion.sh --output-only)
snapcraftctl set-version "$(./mkversion.sh --output-only)"

Happy to see follow ups or if you are feeling lucky, commit this suggestion and wait for green.

override-build: |
# unset the LD_FLAGS and LD_LIBRARY_PATH vars that snapcraft sets for us
# as those will point to the $SNAPCRAFT_STAGE which on re-builds will
# contain things like libc and friends that confuse the debian package
# build system
# TODO: should we unset $PATH to not include $SNAPCRAFT_STAGE too?
unset LD_FLAGS
unset LD_LIBRARY_PATH
# if we are root, disable tests
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saying why we disable tests would be more useful. I see what the code does but am not the wiser.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure I'll add this in a followup

if [ "$(id -u)" = "0" ]; then
DEB_BUILD_OPTIONS=nocheck
export DEB_BUILD_OPTIONS
fi
# run the real build (but just build the binary package, and don't
# bother compressing it too much)
dpkg-buildpackage -b -Zgzip -zfast
dpkg-deb -x $(pwd)/../snapd_*.deb $SNAPCRAFT_PART_INSTALL

# xdelta is used to enable delta downloads (even if the host does not have it)
xdelta3:
plugin: nil
Expand Down Expand Up @@ -83,20 +109,19 @@ parts:
fontconfig-xenial:
plugin: nil
source: https://github.com/snapcore/fc-cache-static-builder.git
build: |
override-build: |
./build-from-security.py xenial
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cp -a fc-cache-xenial $SNAPCRAFT_PART_INSTALL/bin/fc-cache-v6
stage:
prime:
- bin/fc-cache-v6
# the version in Ubuntu 18.04 (cache v7)
fontconfig-bionic:
plugin: nil
source: https://github.com/snapcore/fc-cache-static-builder.git
build: |
override-build: |
./build-from-security.py bionic
mkdir -p $SNAPCRAFT_PART_INSTALL/bin
cp -a fc-cache-bionic $SNAPCRAFT_PART_INSTALL/bin/fc-cache-v7
stage:
prime:
- bin/fc-cache-v7

64 changes: 0 additions & 64 deletions parts/plugins/x_builddeb.py

This file was deleted.

29 changes: 16 additions & 13 deletions tests/main/snapd-snap/task.yaml
Expand Up @@ -6,34 +6,37 @@ systems: [ubuntu-16.04-64]
# Start early as it takes a long time.
priority: 100

prepare: |
echo "Install snapcraft from candidate"
snap install snapcraft --candidate --classic

restore: |
cd "$PROJECT_PATH"
echo "Cleanup build artifacts"
not command -v snapcraft >/dev/null || snapcraft clean
not command -v snapcraft >/dev/null || snapcraft clean --destructive-mode
echo "Cleanup the installed snapcraft"
apt autoremove -y snapcraft
snap remove snapcraft
echo "Cleanup the build snapd snap"
rm -f snapd_*.snap
rm -f snapd_spread-test.snap

execute: |
echo "Installing snapscraft"
apt install -y snapcraft
# shellcheck disable=SC2164
cd "$PROJECT_PATH"
snapcraft
echo "Build the snap natively (with --destructive-mode)"
snapcraft snap --destructive-mode --output=snapd_spread-test.snap

echo "Ensure we have the fc-cache binaries"
unsquashfs -ll snapd_*.snap | MATCH bin/fc-cache-v6
unsquashfs -ll snapd_*.snap | MATCH bin/fc-cache-v7
unsquashfs -ll snapd_spread-test.snap | MATCH bin/fc-cache-v6
unsquashfs -ll snapd_spread-test.snap | MATCH bin/fc-cache-v7

echo "Ensure we have xdelta3"
unsquashfs -ll snapd_*.snap | MATCH bin/xdelta3
unsquashfs -ll snapd_spread-test.snap | MATCH bin/xdelta3

echo "Ensure we have mksquashfs (and the dependencies)"
unsquashfs -ll snapd_*.snap | MATCH bin/mksquashfs
unsquashfs -ll snapd_*.snap | MATCH liblzma.so.5
unsquashfs -ll snapd_spread-test.snap | MATCH bin/mksquashfs
unsquashfs -ll snapd_spread-test.snap | MATCH liblzma.so.5

echo "Ensure we have ld.so.conf"
unsquashfs -ll snapd_*.snap | MATCH etc/ld.so.conf
unsquashfs -ll snapd_spread-test.snap | MATCH etc/ld.so.conf
echo "Ensure we have libc"
unsquashfs -ll snapd_*.snap | MATCH libc.so
unsquashfs -ll snapd_spread-test.snap | MATCH libc.so