The store listing carries the crate's MIT OR GPL-2.0-only expression, and both texts ride along in the snap under /usr/share/doc/pkh: the MIT grant requires the notice to accompany copies, and GPL-2 requires the license text with distribution.
116 lines
4.4 KiB
YAML
116 lines
4.4 KiB
YAML
name: pkh
|
|
base: core24
|
|
summary: pkh is a packaging helper for Debian/Ubuntu packages
|
|
description: |
|
|
pkh aims at wrapping the different debian tools and workflows
|
|
into one tool, that would have the same interface for everything,
|
|
while being smarter at integrating all workflows.
|
|
|
|
This snap uses classic confinement and carries the packaging
|
|
toolchain it drives (dpkg-dev, git, mmdebstrap, lintian, quilt, ...)
|
|
so it behaves the same on any Debian/Ubuntu host.
|
|
license: MIT OR GPL-2.0-only
|
|
adopt-info: pkh-part
|
|
|
|
confinement: classic
|
|
|
|
apps:
|
|
pkh:
|
|
command: bin/pkh
|
|
|
|
parts:
|
|
pkh-part:
|
|
plugin: rust
|
|
source: .
|
|
override-pull: |
|
|
craftctl default
|
|
# Release metadata comes from the crate, not the git state: a build
|
|
# of any commit must produce the version the crate declares.
|
|
craftctl set version="$(awk -F'"' '/^version =/{print $2; exit}' Cargo.toml)"
|
|
craftctl set grade="stable"
|
|
build-packages:
|
|
- build-essential
|
|
- file
|
|
- patchelf
|
|
- pkg-config
|
|
- libssl-dev
|
|
- libgpg-error-dev
|
|
- libgpgme-dev
|
|
# Host-side tools pkh execs directly. Tools that only run *inside*
|
|
# the build chroot (dose-builddebcheck, dpkg-cross) are provisioned
|
|
# there by pkh itself and must not be staged; likewise qemu-user-static
|
|
# is host binfmt configuration, not a bundled file.
|
|
#
|
|
# The apt and dpkg state-owning tools are deliberately excluded below:
|
|
# they must be the host's (classic mode makes them visible), since a
|
|
# core24 apt/dpkg managing a newer host's package database is exactly
|
|
# the version skew classic snaps must avoid. The source-package tools
|
|
# (dpkg-buildpackage, dpkg-source, ...) are bundled instead.
|
|
stage-packages:
|
|
- libgpgme11t64
|
|
- git
|
|
- curl
|
|
- gnupg
|
|
- gpgv
|
|
- dpkg-dev
|
|
- quilt
|
|
- pristine-tar
|
|
- mmdebstrap
|
|
- lintian
|
|
- fakeroot
|
|
- util-linux
|
|
# mount/umount moved to their own package (split from util-linux)
|
|
- mount
|
|
- schroot
|
|
- openssh-client
|
|
- tar
|
|
- xz-utils
|
|
- bzip2
|
|
stage:
|
|
- -usr/bin/apt
|
|
- -usr/bin/apt-cache
|
|
- -usr/bin/apt-cdrom
|
|
- -usr/bin/apt-config
|
|
- -usr/bin/apt-get
|
|
- -usr/bin/apt-key
|
|
- -usr/bin/apt-mark
|
|
- -usr/lib/*/libapt-*
|
|
- -usr/lib/*/libicuio*
|
|
- -usr/lib/*/libicutest*
|
|
- -usr/lib/*/libicutu*
|
|
- -usr/lib/*/libicui18n*
|
|
# update-alternatives does not run at staging time: expose the sysv
|
|
# fakeroot under the plain name dpkg-buildpackage and pkh exec.
|
|
override-prime: |
|
|
craftctl default
|
|
ln -sfn fakeroot-sysv "${CRAFT_PRIME}/usr/bin/fakeroot"
|
|
# Ship the license texts with the binary: the MIT grant requires
|
|
# the notice to accompany copies, and GPL-2 requires the license
|
|
# text alongside distribution.
|
|
mkdir -p "${CRAFT_PRIME}/usr/share/doc/pkh"
|
|
cp "${CRAFT_PART_SRC}/LICENSE-MIT" "${CRAFT_PART_SRC}/LICENSE-GPL" \
|
|
"${CRAFT_PRIME}/usr/share/doc/pkh/"
|
|
# Classic-confined ELFs default to the host loader, which pins the
|
|
# snap to hosts shipping at least the build environment's glibc,
|
|
# and cannot see the libraries deduplicated against the base.
|
|
# Point every bundled ELF at the core24 loader and give it an
|
|
# rpath resolving base libraries from the mounted base and
|
|
# snap-local libraries from $ORIGIN — the classic linter's
|
|
# guidance, and what Canonical's own classic snaps do. DT_RPATH
|
|
# (--force-rpath) is required over the default DT_RUNPATH: the
|
|
# host ld.so.cache would otherwise resolve sonames to host
|
|
# libraries first, mixing host libm/libresolv with base libc.
|
|
# DT_RPATH also propagates transitively, covering dependencies of
|
|
# dependencies (libgpgme -> libassuan). Host tools spawned later
|
|
# (host apt-get, ...) run with a pristine environment since no
|
|
# LD_LIBRARY_PATH is exported.
|
|
find "${CRAFT_PRIME}" -type f -exec sh -c '
|
|
for f do
|
|
[ "$(od -An -N4 -tx1 "$f" | tr -d " \n")" = "7f454c46" ] || continue
|
|
patchelf --set-interpreter \
|
|
/snap/core24/current/lib64/ld-linux-x86-64.so.2 "$f" 2>/dev/null || true
|
|
patchelf --force-rpath --set-rpath \
|
|
"/snap/core24/current/lib/x86_64-linux-gnu:/snap/core24/current/usr/lib/x86_64-linux-gnu:\$ORIGIN:\$ORIGIN/../lib/x86_64-linux-gnu:\$ORIGIN/../usr/lib/x86_64-linux-gnu" \
|
|
"$f" 2>/dev/null || true
|
|
done' sh {} +
|