2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
4 |
EAPI=8
|
5 |
|
EGIT_COMMIT="75e3c12579d391b81d871fd1cded6cf0d043550a"
|
6 |
5 |
|
7 |
|
inherit shell-completion flag-o-matic go-module tmpfiles
|
|
6 |
inherit go-module tmpfiles linux-info
|
8 |
7 |
|
9 |
|
DESCRIPTION="Library and podman tool for running OCI-based containers in Pods"
|
|
8 |
DESCRIPTION="A tool for managing OCI containers and pods with Docker-compatible CLI"
|
10 |
9 |
HOMEPAGE="https://github.com/containers/podman/ https://podman.io/"
|
11 |
|
MY_PN=podman
|
12 |
|
MY_P=${MY_PN}-${PV}
|
13 |
|
SRC_URI="https://github.com/containers/podman/archive/v${PV}.tar.gz -> ${MY_P}.tar.gz"
|
|
10 |
if [[ ${PV} == *9999* ]]; then
|
|
11 |
inherit git-r3
|
|
12 |
EGIT_REPO_URI="https://github.com/containers/podman.git"
|
|
13 |
else
|
|
14 |
SRC_URI="https://github.com/containers/podman/archive/v${PV}.tar.gz -> ${P}.tar.gz"
|
|
15 |
KEYWORDS="~amd64 ~arm64 ~riscv"
|
|
16 |
fi
|
14 |
17 |
LICENSE="Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 ISC MIT MPL-2.0"
|
15 |
18 |
SLOT="0"
|
16 |
|
|
17 |
|
KEYWORDS="~amd64 ~arm64 ~riscv"
|
18 |
|
IUSE="apparmor btrfs cgroup-hybrid +fuse +init +rootless selinux"
|
|
19 |
IUSE="apparmor btrfs cgroup-hybrid wrapper +fuse +init +rootless +seccomp selinux systemd"
|
19 |
20 |
RESTRICT="test"
|
20 |
21 |
|
21 |
|
COMMON_DEPEND="
|
|
22 |
RDEPEND="
|
22 |
23 |
app-crypt/gpgme:=
|
23 |
|
>=app-containers/containers-common-0.56.0
|
24 |
24 |
>=app-containers/conmon-2.0.0
|
25 |
|
cgroup-hybrid? ( >=app-containers/runc-1.0.0_rc6 )
|
26 |
|
!cgroup-hybrid? ( app-containers/crun )
|
|
25 |
>=app-containers/containers-common-0.56.0
|
27 |
26 |
dev-libs/libassuan:=
|
28 |
27 |
dev-libs/libgpg-error:=
|
29 |
28 |
sys-apps/shadow:=
|
30 |
|
sys-fs/lvm2
|
31 |
|
sys-libs/libseccomp:=
|
32 |
29 |
|
33 |
30 |
apparmor? ( sys-libs/libapparmor )
|
34 |
31 |
btrfs? ( sys-fs/btrfs-progs )
|
|
32 |
cgroup-hybrid? ( >=app-containers/runc-1.0.0_rc6 )
|
|
33 |
!cgroup-hybrid? ( app-containers/crun )
|
|
34 |
wrapper? ( !app-containers/docker-cli )
|
|
35 |
fuse? ( sys-fs/fuse-overlayfs )
|
35 |
36 |
init? ( app-containers/catatonit )
|
36 |
37 |
rootless? ( app-containers/slirp4netns )
|
37 |
|
selinux? ( sys-libs/libselinux:= )
|
|
38 |
seccomp? ( sys-libs/libseccomp:= )
|
|
39 |
selinux? ( sec-policy/selinux-podman sys-libs/libselinux:= )
|
|
40 |
systemd? ( sys-apps/systemd:= )
|
|
41 |
"
|
|
42 |
DEPEND="${RDEPEND}"
|
|
43 |
BDEPEND="
|
|
44 |
dev-go/go-md2man
|
38 |
45 |
"
|
39 |
|
DEPEND="
|
40 |
|
${COMMON_DEPEND}
|
41 |
|
dev-go/go-md2man"
|
42 |
|
RDEPEND="${COMMON_DEPEND}
|
43 |
|
fuse? ( sys-fs/fuse-overlayfs )
|
44 |
|
selinux? ( sec-policy/selinux-podman )"
|
45 |
|
|
46 |
|
S=${WORKDIR}/${MY_P}
|
47 |
46 |
|
48 |
|
src_prepare() {
|
49 |
|
default
|
|
47 |
PATCHES=(
|
|
48 |
"${FILESDIR}/seccomp-toggle-4.7.0.patch"
|
|
49 |
)
|
50 |
50 |
|
51 |
|
# Disable installation of python modules here, since those are
|
52 |
|
# installed by separate ebuilds.
|
53 |
|
local makefile_sed_args=(
|
54 |
|
-e '/^GIT_.*/d'
|
55 |
|
-e 's/$(GO) build/$(GO) build -v -work -x/'
|
56 |
|
-e 's/^\(install:.*\) install\.python$/\1/'
|
57 |
|
-e 's|^pkg/varlink/iopodman.go: .gopathok pkg/varlink/io.podman.varlink$|pkg/varlink/iopodman.go: pkg/varlink/io.podman.varlink|'
|
58 |
|
)
|
|
51 |
CONFIG_CHECK="
|
|
52 |
~USER_NS
|
|
53 |
"
|
59 |
54 |
|
60 |
|
has_version -b '>=dev-lang/go-1.13.9' || makefile_sed_args+=(-e 's:GO111MODULE=off:GO111MODULE=on:')
|
|
55 |
pkg_setup() {
|
|
56 |
use btrfs && CONFIG_CHECK+=" ~BTRFS_FS"
|
|
57 |
linux-info_pkg_setup
|
|
58 |
}
|
61 |
59 |
|
62 |
|
sed "${makefile_sed_args[@]}" -i Makefile || die
|
|
60 |
src_prepare() {
|
|
61 |
default
|
|
62 |
local file
|
|
63 |
for file in apparmor_tag btrfs_installed_tag btrfs_tag selinux_tag systemd_tag; do
|
|
64 |
[[ -f hack/"${file}".sh ]] || die
|
|
65 |
done
|
|
66 |
|
|
67 |
local feature
|
|
68 |
for feature in apparmor selinux systemd; do
|
|
69 |
cat <<-EOF > hack/"${feature}"_tag.sh || die
|
|
70 |
#!/usr/bin/env bash
|
|
71 |
$(usex ${feature} "echo ${feature}" echo)
|
|
72 |
EOF
|
|
73 |
done
|
|
74 |
|
|
75 |
echo -e "#!/usr/bin/env bash\n echo" > hack/btrfs_installed_tag.sh || die
|
|
76 |
cat <<-EOF > hack/btrfs_tag.sh || die
|
|
77 |
#!/usr/bin/env bash
|
|
78 |
$(usex btrfs echo 'echo exclude_graphdriver_btrfs btrfs_noversion')
|
|
79 |
EOF
|
63 |
80 |
}
|
64 |
81 |
|
65 |
82 |
src_compile() {
|
66 |
|
local git_commit=${EGIT_COMMIT}
|
67 |
|
|
68 |
|
# Filter unsupported linker flags
|
69 |
|
filter-flags '-Wl,*'
|
70 |
|
|
71 |
|
[[ -f hack/apparmor_tag.sh ]] || die
|
72 |
|
if use apparmor; then
|
73 |
|
echo -e "#!/bin/sh\necho apparmor" > hack/apparmor_tag.sh || die
|
74 |
|
else
|
75 |
|
echo -e "#!/bin/sh\ntrue" > hack/apparmor_tag.sh || die
|
76 |
|
fi
|
77 |
|
|
78 |
|
[[ -f hack/btrfs_installed_tag.sh ]] || die
|
79 |
|
if use btrfs; then
|
80 |
|
echo -e "#!/bin/sh\ntrue" > hack/btrfs_installed_tag.sh || die
|
81 |
|
else
|
82 |
|
echo -e "#!/bin/sh\necho exclude_graphdriver_btrfs" > \
|
83 |
|
hack/btrfs_installed_tag.sh || die
|
84 |
|
fi
|
85 |
|
|
86 |
|
[[ -f hack/selinux_tag.sh ]] || die
|
87 |
|
if use selinux; then
|
88 |
|
echo -e "#!/bin/sh\necho selinux" > hack/selinux_tag.sh || die
|
89 |
|
else
|
90 |
|
echo -e "#!/bin/sh\ntrue" > hack/selinux_tag.sh || die
|
91 |
|
fi
|
92 |
|
|
93 |
|
# Avoid this error when generating pkg/varlink/iopodman.go:
|
94 |
|
# cannot find package "github.com/varlink/go/varlink/idl"
|
95 |
|
mkdir -p _output || die
|
96 |
|
ln -snf ../vendor _output/src || die
|
97 |
|
GO111MODULE=off GOPATH=${PWD}/_output go generate ./pkg/varlink/... || die
|
98 |
|
rm _output/src || die
|
99 |
|
|
100 |
|
export -n GOCACHE GOPATH XDG_CACHE_HOME
|
101 |
|
GOBIN="${S}/bin" \
|
102 |
|
emake all \
|
103 |
|
PREFIX="${EPREFIX}/usr" \
|
104 |
|
GIT_BRANCH=master \
|
105 |
|
GIT_BRANCH_CLEAN=master \
|
106 |
|
COMMIT_NO="${git_commit}" \
|
107 |
|
GIT_COMMIT="${git_commit}"
|
|
83 |
export PREFIX="${EPREFIX}/usr"
|
|
84 |
emake BUILDFLAGS="-v -work -x" GOMD2MAN="go-md2man" BUILD_SECCOMP="$(usex seccomp)" all $(usev wrapper docker-docs)
|
108 |
85 |
}
|
109 |
86 |
|
110 |
87 |
src_install() {
|
111 |
|
emake DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install
|
|
88 |
emake DESTDIR="${D}" install install.completions $(usev wrapper install.docker-full)
|
112 |
89 |
|
113 |
90 |
insinto /etc/cni/net.d
|
114 |
91 |
doins cni/87-podman-bridge.conflist
|
... | ... | |
119 |
96 |
insinto /etc/logrotate.d
|
120 |
97 |
newins "${FILESDIR}/podman.logrotated" podman
|
121 |
98 |
|
122 |
|
dobashcomp completions/bash/*
|
123 |
|
dozshcomp completions/zsh/*
|
124 |
|
dofishcomp completions/fish/*
|
125 |
|
|
126 |
99 |
keepdir /var/lib/containers
|
127 |
100 |
}
|
128 |
101 |
|
... | ... | |
134 |
107 |
}
|
135 |
108 |
|
136 |
109 |
pkg_postinst() {
|
137 |
|
tmpfiles_process podman.conf
|
|
110 |
tmpfiles_process podman.conf $(usev wrapper podman-docker.conf)
|
138 |
111 |
|
139 |
112 |
local want_newline=false
|
140 |
113 |
if [[ ${PODMAN_ROOTLESS_UPGRADE} == true ]] ; then
|