summaryrefslogtreecommitdiff
blob: 773fa15bb205284105d559d5fe2de1e55c1ab998 (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
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit golang-vcs-snapshot systemd

EGIT_COMMIT="b5ca020cfbe998e5af3457fda087444cf5116496"
EGO_PN="github.com/docker/distribution"

DESCRIPTION="Docker Registry 2.0"
HOMEPAGE="https://github.com/docker/distribution"
SRC_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"

LICENSE="Apache-2.0 BSD BSD-2 CC-BY-SA-4.0 MIT ZLIB"
SLOT="0"
KEYWORDS="amd64 ~arm64"

DEPEND="
	acct-group/registry
	acct-user/registry
"
RDEPEND="${DEPEND}"

SVCNAME="registry"

src_prepare() {
	default
	pushd src/${EGO_PN} || die
	eapply "${FILESDIR}"/${PN}-2.7.0-notification-metrics.patch
	sed -e "s/git describe.*/echo ${PV})/" \
		-e "s/git rev-parse.*/echo ${EGIT_COMMIT})/" \
		-e "s/-s -w/-w/" \
		-i Makefile || die
	popd || die
}

src_compile() {
	export -n GOCACHE XDG_CACHE_HOME #681072
	GOPATH="${S}" GO_BUILD_FLAGS="-v" emake -C src/${EGO_PN} binaries
}

src_install() {
	exeinto /usr/libexec/${PN}
	doexe src/${EGO_PN}/bin/*
	insinto /etc/docker/registry
	newins 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/log/${SVCNAME}
	fowners ${SVCNAME}:${SVCNAME} /var/log/${SVCNAME}
	insinto /etc/logrotate.d
	newins "${FILESDIR}/${SVCNAME}.logrotated" "${SVCNAME}"
}