app-emulation/containers-storage: Bump to version 1.13.1
[gentoo.git] / app-emulation / containers-storage / containers-storage-1.13.1.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 EGO_VENDOR=(
7         "github.com/pquerna/ffjson e517b90714f7c0eabe6d2e570a5886ae077d6db6"
8 )
9
10 inherit golang-vcs-snapshot
11
12 KEYWORDS="~amd64"
13 DESCRIPTION="containers/storage library"
14 HOMEPAGE="https://github.com/containers/storage"
15 LICENSE="Apache-2.0"
16 SLOT="0"
17 IUSE="btrfs +device-mapper ostree test"
18 EGO_PN="${HOMEPAGE#*//}"
19 EGIT_COMMIT="v${PV}"
20 SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz
21         ${EGO_VENDOR_URI}"
22 RDEPEND="
23         btrfs? ( sys-fs/btrfs-progs )
24         device-mapper? ( sys-fs/lvm2:= )
25         ostree? (
26                 dev-libs/glib:=
27                 dev-util/ostree:=
28         )"
29 DEPEND="${RDEPEND}
30         dev-go/go-md2man
31         test? (
32                 sys-fs/btrfs-progs
33                 sys-fs/lvm2
34                 sys-apps/util-linux
35         )"
36 RESTRICT="test? ( userpriv ) !test? ( test )"
37
38 src_unpack() {
39         golang-vcs-snapshot_src_unpack
40 }
41
42 src_prepare() {
43         default
44
45         [[ -f ${S}/src/${EGO_PN}/hack/btrfs_tag.sh ]] || die
46         use btrfs || { echo -e "#!/bin/sh\necho exclude_graphdriver_btrfs" > \
47                 "${S}/src/${EGO_PN}/hack/btrfs_tag.sh" || die; }
48
49         [[ -f ${S}/src/${EGO_PN}/hack/libdm_tag.sh ]] || die
50         use device-mapper || { echo -e "#!/bin/sh\necho btrfs_noversion exclude_graphdriver_devicemapper" > \
51                 "${S}/src/${EGO_PN}/hack/libdm_tag.sh" || die; }
52
53         [[ -f ${S}/src/${EGO_PN}/hack/ostree_tag.sh ]] || die
54         use ostree || { echo -e "#!/bin/sh\ntrue" > \
55                 "${S}/src/${EGO_PN}/hack/ostree_tag.sh" || die; }
56
57         sed -e 's:TestChrootUntarPath(:_\0:' \
58                 -i "${S}/src/${EGO_PN}/pkg/chrootarchive/archive_test.go" || die
59         sed -e 's:TestTarUntar(:_\0:' \
60                 -e 's:TestTarWithOptionsChownOptsAlwaysOverridesIdPair(:_\0:' \
61                 -e 's:TestTarWithOptions(:_\0:' \
62                 -i "${S}/src/${EGO_PN}/pkg/archive/archive_test.go" || die
63         sed -e 's:TestTarUntarWithXattr(:_\0:' \
64                 -e 's:TestTarWithBlockCharFifo(:_\0:' \
65                 -i "${S}/src/${EGO_PN}/pkg/archive/archive_unix_test.go" || die
66         sed -e 's:TestTarUntarWithXattr(:_\0:' \
67                 -i "${S}/src/${EGO_PN}/pkg/archive/archive_test.go" || die
68         sed -e 's:TestApplyLayer(:_\0:' \
69                 -i "${S}/src/${EGO_PN}/pkg/archive/changes_test.go" || die
70         sed -e 's:TestApplyLayerInvalidFilenames(:_\0:' \
71                 -e 's:TestApplyLayerInvalidHardlink(:_\0:' \
72                 -e 's:TestApplyLayerInvalidSymlink(:_\0:' \
73                 -e 's:TestApplyLayerWhiteouts(:_\0:' \
74                 -i "${S}/src/${EGO_PN}/pkg/archive/diff_test.go" || die
75         sed -e 's:TestCopyCaseE(:_\0:' \
76                 -e 's:TestCopyCaseEFSym(:_\0:' \
77                 -e 's:TestCopyCaseG(:_\0:' \
78                 -e 's:TestCopyCaseGFSym(:_\0:' \
79                 -e 's:TestCopyCaseH(:_\0:' \
80                 -e 's:TestCopyCaseHFSym(:_\0:' \
81                 -e 's:TestCopyCaseJ(:_\0:' \
82                 -e 's:TestCopyCaseJFSym(:_\0:' \
83                 -i "${S}/src/${EGO_PN}/pkg/archive/copy_unix_test.go" || die
84         sed -e 's:TestMount(:_\0:' \
85                 -i "${S}/src/${EGO_PN}/pkg/mount/mounter_linux_test.go" || die
86 }
87
88 src_compile() {
89         export -n GOCACHE XDG_CACHE_HOME #678856
90         mkdir -p "${S}/src/github.com/pquerna" || die
91         ln -s "${S}/src/${EGO_PN}/vendor/github.com/pquerna/ffjson" "${WORKDIR}/${P}/src/github.com/pquerna/ffjson" || die
92         mkdir -p "${S}/bin" || die
93         cd "${S}/bin" || die
94         GOPATH="${S}" GOBIN="${S}/bin" \
95                 go build -v -work -x ${EGO_BUILD_FLAGS} "${S}/src/github.com/pquerna/ffjson/ffjson.go" || die
96         GOPATH="${S}" GOBIN="${S}/bin" PATH="${S}/bin:${PATH}" \
97                 emake -C "${S}/src/${EGO_PN}" containers-storage docs
98 }
99
100 src_install() {
101         dobin "${S}/src/${EGO_PN}/${PN}"
102         while read -r -d ''; do
103                 mv "${REPLY}" "${REPLY%.1}" || die
104         done < <(find "${S}/src/${EGO_PN}/docs" -name '*.[[:digit:]].1' -print0)
105         find "${S}/src/${EGO_PN}/docs" -name '*.[[:digit:]]' -exec doman '{}' + || die
106 }
107
108 src_test() {
109         GOPATH="${S}" unshare -m emake -C "${S}/src/${EGO_PN}" FLAGS="-v -work -x" local-test-unit || die
110 }