forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-registry-2.5.0.ebuild
52 lines (46 loc) · 1.59 KB
/
docker-registry-2.5.0.ebuild
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
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
EAPI=5
inherit golang-vcs-snapshot systemd user
KEYWORDS="~amd64"
EGO_PN="github.com/docker/distribution/..."
EGIT_COMMIT="v${PV}"
SRC_URI="https://${EGO_PN%/*}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
DESCRIPTION="Docker Registry 2.0"
HOMEPAGE="https://${EGO_PN%/*}"
LICENSE="Apache-2.0"
SLOT="0/${PVR}"
IUSE=""
DEPEND=">=dev-lang/go-1.5"
SVCNAME=registry
pkg_setup() {
enewgroup ${SVCNAME}
enewuser ${SVCNAME} -1 -1 /dev/null ${SVCNAME}
}
src_compile() {
GOPATH="${S}" GO15VENDOREXPERIMENT=1 \
go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}" || die
}
src_install() {
golang_install_pkgs
exeinto /usr/libexec/${PN}
doexe "${S}"/bin/*
insinto /etc/docker/registry
newins "${S}"/src/${EGO_PN%/*}/cmd/registry/config-example.yml config.yml.example
newinitd "${FILESDIR}/${SVCNAME}.initd" "${SVCNAME}"
newconfd "${FILESDIR}/${SVCNAME}.confd" "${SVCNAME}"
systemd_dounit "${FILESDIR}/${SVCNAME}.service"
keepdir /var/{lib,log}/${SVCNAME}
fowners ${SVCNAME}:${SVCNAME} /var/{lib,log}/${SVCNAME}
insinto /etc/logrotate.d
newins "${FILESDIR}/${SVCNAME}.logrotated" "${SVCNAME}"
}
golang_install_pkgs() {
insinto $(dirname "${EPREFIX}$(get_golibdir)/src/${EGO_PN%/*}")
rm -rf "${S}"/src/${EGO_PN%/*}/.git* \
"${S}"/{src,pkg/$(go env GOOS)_$(go env GOARCH)}/${EGO_PN%/*}/vendor
doins -r "${S}"/src/${EGO_PN%/*}
insinto $(dirname "${EPREFIX}$(get_golibdir)/pkg/$(go env GOOS)_$(go env GOARCH)/${EGO_PN%/*}")
doins -r "${S}"/pkg/$(go env GOOS)_$(go env GOARCH)/${EGO_PN%/*}{,.a}
}