# Copyright 1999-2020 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 PYTHON_COMPAT=( python3_{6..9} ) inherit python-r1 readme.gentoo-r1 systemd MY_P="replicator-${PV/_/}" DESCRIPTION="Proxy cache for Gentoo packages" HOMEPAGE="https://github.com/xedakini/replicator" SRC_URI="https://github.com/xedakini/replicator/archive/v${PV/_/}.tar.gz -> ${P}.tar.gz" ## Maybe this should be GPL-2+; I don't see any statements preventing ## newer versions of the GPL. But the previous ebuild listed just GPL-2: LICENSE="GPL-2" SLOT="0" KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86" IUSE="" REQUIRED_USE="${PYTHON_REQUIRED_USE}" RDEPEND="${PYTHON_DEPS} sys-apps/portage[${PYTHON_USEDEP}] dev-python/aiohttp[${PYTHON_USEDEP}] " DEPEND="${RDEPEND}" S="${WORKDIR}/${MY_P}" # Tests downloads files as well as breaks, should be turned into local tests. RESTRICT="test" DISABLE_AUTOFORMATTING="yes" DOC_CONTENTS=" Before starting ${PN}, please follow the next few steps: - Modify /etc/conf.d/${PN} if required. - Run \`repcacheman\` to set up the cache. - Add http_proxy=\"http://serveraddress:8080\" to make.conf on the server as well as on the client machines. - Ideally, make sure each client's FETCHCOMMAND adds the X-unique-cache-name header to HTTP requests in each make.conf. One way: - bzcat /usr/share/doc/$P/fetcher.bz2 > /etc/portage/fetcher - chmod 755 /etc/portage/fetcher - Add the following to /etc/portage/make.conf: FETCHCOMMAND=\"/etc/portage/fetcher -O \\\"\\\${DISTDIR}/\\\${FILE}\\\" \\\"\\\${URI}\\\"\" RESUMECOMMAND=\"/etc/portage/fetcher -c -O \\\"\\\${DISTDIR}/\\\${FILE}\\\" \\\"\\\${URI}\\\"\" The example fetcher script contents could possibly be turned into a one liner if args were positional, using the shell expansion pattern to add the following wget argument: --header=\\\"X-unique-cache-name: \\\${FILE%.__download__}\\\" The bourne shell percent sign expansion is not currently supported by portage directly. Or maybe portage could be enhanced to do this by default someday, particularly if a proxy is involved. See also https://forums.gentoo.org/viewtopic-t-1101822-highlight-httpreplicator.html - Arrange to periodically run repcacheman on this server, to clean up the local /usr/portage/distfiles directory. - Arrange to periodically run something like the following on this server. 'eclean' is in app-portage/gentoolkit. ( export DISTDIR=/var/cache/http-replicator/ eclean -i distfiles ) - Even with FETCHCOMMAND fixing most cases, occasionally an older invalid version of a file may end up in the cache, causing checksum failures when portage tries to fetch it. To recover, either use eclean (above), manually delete the relevant file from the cache, or temporarily comment out the http_proxy setting. Commenting only requires access to client config, not server cache. - Make sure GENTOO_MIRRORS in /etc/portage/make.conf starts with several good HTTP mirrors. For more information please refer to the following forum thread: https://forums.gentoo.org/viewtopic-t-173226.html Starting with 4.x releases, the conf.d parameters have changed. " PATCHES=( "${FILESDIR}"/setsid-${PV}.patch ) src_test() { ./unit-test && die } src_install() { python_foreach_impl python_doscript http-replicator extras/repcacheman.py newbin "${FILESDIR}"/${PN}-3.0-callrepcacheman-0.1 repcacheman python_foreach_impl python_domodule replicator newinitd "${FILESDIR}"/${PN}-4.0_alpha2-r3.init http-replicator newconfd "${FILESDIR}"/${PN}-4.0_alpha2-r2.conf http-replicator systemd_dounit extras/http-replicator.service systemd_install_serviced "${FILESDIR}"/http-replicator.service.conf dodoc "${FILESDIR}"/fetcher dodoc README.md changelog.md readme.gentoo_create_doc } pkg_postinst() { readme.gentoo_print_elog }