summaryrefslogtreecommitdiff
blob: 63503fe4b2cf4904f0d577dfbe96aa7d41478131 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Copyright 2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
inherit go-module linux-info

DESCRIPTION="Work with remote container images registries"
HOMEPAGE="https://github.com/containers/skopeo"

if [[ ${PV} == 9999* ]]; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/containers/skopeo.git"
else
	SRC_URI="https://github.com/containers/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~amd64 ~arm64"
fi

# main
LICENSE="Apache-2.0"
# deps
LICENSE+=" BSD BSD-2 CC-BY-SA-4.0 ISC MIT"
SLOT="0"
IUSE="btrfs device-mapper rootless"

RDEPEND="
	app-containers/containers-common
	>=app-crypt/gpgme-1.5.5:=
	>=dev-libs/libassuan-2.4.3:=
	btrfs? ( >=sys-fs/btrfs-progs-4.0.1 )
	device-mapper? ( >=sys-fs/lvm2-2.02.145:= )
	rootless? ( sys-apps/shadow:= )
"

# TODO: Is this really needed? cause upstream doesnt mention it https://github.com/containers/skopeo/blob/main/install.md#building-from-source
# 	dev-libs/libgpg-error:=
DEPEND="${RDEPEND}"
BDEPEND="dev-go/go-md2man"

RESTRICT="test"
PATCHES=(
 "${FILESDIR}"/makefile-1.14.0.patch
)

pkg_setup() {
	use btrfs && CONFIG_CHECK+=" ~BTRFS_FS"
	use device-mapper && CONFIG_CHECK+=" ~MD"
	linux-info_pkg_setup
}

src_prepare() {
	default
	local file
	for file in btrfs_installed_tag btrfs_tag libdm_tag libsubid_tag; do
		[[ -f hack/"${file}".sh ]] || die
	done

	echo -e "#!/usr/bin/env bash\n echo" > hack/btrfs_installed_tag.sh || die
	cat <<-EOF > hack/btrfs_tag.sh || die
	#!/usr/bin/env bash
	$(usex btrfs echo 'echo exclude_graphdriver_btrfs btrfs_noversion')
	EOF

	cat <<-EOF > hack/libdm_tag.sh || die
	#!/usr/bin/env bash
	$(usex device-mapper echo "echo libdm_no_deferred_remove")
	EOF

	cat <<-EOF > hack/libsubid_tag.sh || die
	#!/usr/bin/env bash
	$(usex rootless "echo libsubid" echo)
	EOF
}

src_compile() {
	# export variables which 'make install' is also going to use
	export PREFIX="${EPREFIX}/usr" \
		   CONTAINERSCONFDIR="${EPREFIX}/etc/containers"
	# compile binary, docs, completions
	emake all completions
}