commit:     643ed593c89f5f81e01cd5371cd06ab41b7349a9
Author:     John Helmert III <jchelmert3 <AT> posteo <DOT> net>
AuthorDate: Sat Jan 30 05:26:18 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Thu Feb 11 08:56:03 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=643ed593

net-misc/apt-cacher-ng: bump to 3.5_p3

Rework so as to not install everything manually in src_install but rely
on the build system, clean up src_configure a bit, clean up
dependencies, drop useless IUSE=systemd and related dependency, drop
user.eclass and depend on acct-{user,group} packages, and update the
OpenRC init.d and conf.d files to fix a security bug. These files were
written by Michael Orlitzky (mjo).

Bug: https://bugs.gentoo.org/631878
Closes: https://bugs.gentoo.org/538214
Closes: https://bugs.gentoo.org/701220
Thanks-to: Michael Orlitzky <mjo <AT> gentoo.org>
Signed-off-by: John Helmert III <jchelmert3 <AT> posteo.net>
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 net-misc/apt-cacher-ng/Manifest                    |   2 +-
 .../apt-cacher-ng/apt-cacher-ng-3.5_p1-r1.ebuild   | 129 ---------------------
 net-misc/apt-cacher-ng/apt-cacher-ng-3.5_p3.ebuild |  97 ++++++++++++++++
 net-misc/apt-cacher-ng/files/confd-r2              |   9 ++
 net-misc/apt-cacher-ng/files/initd-r3              |  20 ++++
 5 files changed, 127 insertions(+), 130 deletions(-)

diff --git a/net-misc/apt-cacher-ng/Manifest b/net-misc/apt-cacher-ng/Manifest
index 5715fe065c4..8f5b3dcee4f 100644
--- a/net-misc/apt-cacher-ng/Manifest
+++ b/net-misc/apt-cacher-ng/Manifest
@@ -1,2 +1,2 @@
-DIST apt-cacher-ng_3.5-1.debian.tar.xz 49916 BLAKE2B 
c01c96e5cf46fa3b8c46145b34976f3c4a3b545819719a8de517fe53a91d6f65c460bee59d98de750912d7bb9e3416804a088bdf274d74352c35f757cdeb16ea
 SHA512 
8a543f94ef5e206be40070eb757c950ad6915cfbd6cacfadb5bd91070d14b4bb1c3c550823cd088c15335963587cc34d414518ae0013f6561996f855ccf97359
+DIST apt-cacher-ng_3.5-3.debian.tar.xz 49708 BLAKE2B 
85092374207a252dcb4ef7b95dc434f81f9b67791e20099dc058022a9a575130070c12827f3fd04640fcec3b44a444fb85d8cea6439d5eaeeb359f263fb05682
 SHA512 
f690ae69d38b8e9c73ef095e9779364c7c5ccd246b19e8f5ce2edde47861e44c0aedabc75bcf11f5b408e034e52190dc8ed1789b503284f8f68dc1f5e84e1712
 DIST apt-cacher-ng_3.5.orig.tar.xz 325260 BLAKE2B 
1cf19bd575d4e3d320f73771b31e98977417713d57ceaaccb8b6c0eff7bd5e02c99a0c197ddbc09d14d8f6a70799525dedfe1fbacb00357f65f0c8c4d540bcab
 SHA512 
0bbc78c128d353ec2504f4d898d0ffb339778e98ab9899d48c61c094b15cafd92e430f864c82b66049578f5dd3c9e74fc5c09883231faeddce453be64e6f8954

diff --git a/net-misc/apt-cacher-ng/apt-cacher-ng-3.5_p1-r1.ebuild 
b/net-misc/apt-cacher-ng/apt-cacher-ng-3.5_p1-r1.ebuild
deleted file mode 100644
index 362e497b3c1..00000000000
--- a/net-misc/apt-cacher-ng/apt-cacher-ng-3.5_p1-r1.ebuild
+++ /dev/null
@@ -1,129 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-inherit cmake user
-
-DESCRIPTION="Yet another caching HTTP proxy for Debian/Ubuntu software 
packages"
-HOMEPAGE="
-       https://www.unix-ag.uni-kl.de/~bloch/acng/
-       https://packages.qa.debian.org/a/apt-cacher-ng.html
-"
-LICENSE="BSD-4 ZLIB public-domain"
-SLOT="0"
-SRC_URI="
-       mirror://debian/pool/main/a/${PN}/${PN}_${PV/_*}.orig.tar.xz
-       mirror://debian/pool/main/a/${PN}/${PN}_${PV/_p/-}.debian.tar.xz
-"
-
-KEYWORDS="~amd64 ~x86"
-IUSE="doc fuse systemd tcpd"
-
-COMMON_DEPEND="
-       app-arch/bzip2
-       app-arch/xz-utils
-       dev-libs/libevent:=
-       dev-libs/openssl:0=
-       sys-libs/zlib
-       systemd? (
-               sys-apps/systemd
-       )
-"
-BDEPEND="
-       ${COMMON_DEPEND}
-       virtual/pkgconfig
-"
-RDEPEND="
-       ${COMMON_DEPEND}
-       dev-lang/perl
-       fuse? ( sys-fs/fuse )
-       tcpd? ( sys-apps/tcp-wrappers )
-"
-PATCHES=(
-       "${FILESDIR}"/${PN}-3.3.1-flags.patch
-       "${FILESDIR}"/${PN}-3.5-perl-syntax.patch
-       "${WORKDIR}"/debian/patches/debian-changes
-)
-S=${WORKDIR}/${P/_*}
-
-pkg_setup() {
-       # add new user & group for daemon
-       enewgroup ${PN}
-       enewuser ${PN} -1 -1 -1 ${PN}
-}
-
-src_configure() {
-       local mycmakeargs=()
-       if use fuse; then
-               mycmakeargs+=( "-DHAVE_FUSE_25=yes" )
-       else
-               mycmakeargs+=( "-DHAVE_FUSE_25=no" )
-       fi
-       if use tcpd; then
-               mycmakeargs+=( "-DHAVE_LIBWRAP=yes" )
-       else
-               mycmakeargs+=( "-DHAVE_LIBWRAP=no" )
-       fi
-       if tc-ld-is-gold; then
-               mycmakeargs+=( "-DUSE_GOLD=yes" )
-       else
-               mycmakeargs+=( "-DUSE_GOLD=no" )
-       fi
-
-       cmake_src_configure
-
-       sed -i -e '/LogDir/s|/var/tmp|/var/log/'"${PN}"'|g' 
"${BUILD_DIR}"/conf/acng.conf || die
-}
-
-src_install() {
-       pushd "${BUILD_DIR}" || die
-       dosbin ${PN} acngtool
-       dolib.so libsupacng.so
-       if use fuse; then
-               dobin acngfs
-       fi
-       popd || die
-
-       newinitd "${FILESDIR}"/initd-r2 ${PN}
-       newconfd "${FILESDIR}"/confd-r1 ${PN}
-
-       insinto /etc/logrotate.d
-       newins "${FILESDIR}"/logrotate ${PN}
-
-       doman doc/man/${PN}*
-       if use fuse; then
-               doman doc/man/acngfs*
-       fi
-
-       # Documentation
-       dodoc doc/README TODO VERSION INSTALL ChangeLog
-       if use doc; then
-               dodoc doc/*.pdf
-
-               docinto html
-               dodoc doc/html/*
-
-               find conf -name '*.gz' -exec gzip -d {} \; || die
-               docinto examples/conf
-               dodoc conf/*
-       fi
-
-       newdoc "${WORKDIR}"/debian/changelog debian.changelog
-
-       # perl daily cron script
-       dosbin scripts/expire-caller.pl
-       insinto /etc/cron.daily
-       newins "${FILESDIR}"/cron.daily ${PN}
-
-       # default configuration
-       insinto /etc/${PN}
-       newins "${BUILD_DIR}"/conf/acng.conf ${PN}.conf
-       doins $( echo conf/* | sed 's|conf/acng.conf.in||g' )
-
-       keepdir /var/log/${PN}
-       # Some directories must exists
-       keepdir /var/log/${PN}
-       fowners -R ${PN}:${PN} \
-               /etc/${PN} \
-               /var/log/${PN}
-}

diff --git a/net-misc/apt-cacher-ng/apt-cacher-ng-3.5_p3.ebuild 
b/net-misc/apt-cacher-ng/apt-cacher-ng-3.5_p3.ebuild
new file mode 100644
index 00000000000..56294639238
--- /dev/null
+++ b/net-misc/apt-cacher-ng/apt-cacher-ng-3.5_p3.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+DESCRIPTION="Yet another caching HTTP proxy for Debian/Ubuntu software 
packages"
+HOMEPAGE="https://www.unix-ag.uni-kl.de/~bloch/acng/
+       https://packages.qa.debian.org/a/apt-cacher-ng.html";
+SRC_URI="mirror://debian/pool/main/a/${PN}/${PN}_${PV/_*}.orig.tar.xz
+       mirror://debian/pool/main/a/${PN}/${PN}_${PV/_p/-}.debian.tar.xz"
+
+LICENSE="BSD-4 ZLIB public-domain"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="doc fuse tcpd"
+
+DEPEND="acct-user/apt-cacher-ng
+       acct-group/apt-cacher-ng
+       app-arch/bzip2
+       dev-libs/libevent:=
+       dev-libs/openssl:0=
+       sys-libs/zlib
+       fuse? ( sys-fs/fuse:0 )
+       tcpd? ( sys-apps/tcp-wrappers )"
+BDEPEND="virtual/pkgconfig"
+RDEPEND="${DEPEND}
+       dev-lang/perl"
+
+PATCHES=(
+       "${FILESDIR}/${PN}-3.3.1-flags.patch"
+       "${FILESDIR}/${PN}-3.5-perl-syntax.patch"
+       "${WORKDIR}/debian/patches/debian-changes"
+)
+
+S="${WORKDIR}/${P/_*}"
+
+src_prepare() {
+       # Fixup systemd/CMakeLists.txt cmake version requirement
+       sed -ie "s/2.6/3.1/" systemd/CMakeLists.txt || die
+
+       # Make sure we install everything the same way it used to be after
+       # switching from mostly custom src_install to relying on build system
+       # installation
+       sed -e "/install/s/LIBDIR/CFGDIR/" \
+               -e "/install.*acng\.conf/s/)$/ RENAME ${PN}.conf)/" \
+               -e "/file/s/)$/ \"*hooks\" \"backends_debian\")/" -i 
conf/CMakeLists.txt || die
+       sed -ie "/INSTALL.*acngtool/s/LIBDIR/CMAKE_INSTALL_SBINDIR/" 
source/CMakeLists.txt || die
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               "-DHAVE_FUSE_25=$(usex fuse)"
+               "-DHAVE_LIBWRAP=$(usex tcpd)"
+               # Unconditionally install systemd service file
+               "-DSDINSTALL=1"
+       )
+
+       if tc-ld-is-gold; then
+               mycmakeargs+=( "-DUSE_GOLD=yes" )
+       else
+               mycmakeargs+=( "-DUSE_GOLD=no" )
+       fi
+
+       cmake_src_configure
+
+       sed -ie '/LogDir/s|/var/tmp|/var/log/'"${PN}"'|g' 
"${BUILD_DIR}"/conf/acng.conf || die
+}
+
+src_install() {
+       newinitd "${FILESDIR}/initd-r3" "${PN}"
+       newconfd "${FILESDIR}/confd-r2" "${PN}"
+
+       insinto /etc/logrotate.d
+       newins "${FILESDIR}/logrotate" "${PN}"
+
+       insinto /etc/cron.daily
+       newins "${FILESDIR}/cron.daily" "${PN}"
+
+       # USE=fuse installs acngfs, don't install manpage without the bin
+       if use !fuse; then
+               rm doc/man/acngfs.8 || die
+       fi
+
+       if use !doc; then
+               rm -r doc/html || die
+       fi
+
+       dosbin scripts/expire-caller.pl
+
+       keepdir "/var/log/${PN}"
+       fowners -R ${PN}:${PN} "/var/log/${PN}"
+
+       cmake_src_install
+}

diff --git a/net-misc/apt-cacher-ng/files/confd-r2 
b/net-misc/apt-cacher-ng/files/confd-r2
new file mode 100644
index 00000000000..2e2f5c99dd4
--- /dev/null
+++ b/net-misc/apt-cacher-ng/files/confd-r2
@@ -0,0 +1,9 @@
+# Additional options that are passed to the Daemon.
+APT_CACHER_NG_ARGS="-c /etc/apt-cacher-ng"
+
+# Specify the network services that correspond to the "BindAddress"
+# setting in your apt-cacher-ng.conf. For example, if you bind to
+# 127.0.0.1, then this should be set to "net.lo" which provides the
+# loopback interface. The default BindAddress listens on all available
+# interfaces, for which it suffices to have only one (net.lo) up.
+rc_need="net.lo"

diff --git a/net-misc/apt-cacher-ng/files/initd-r3 
b/net-misc/apt-cacher-ng/files/initd-r3
new file mode 100644
index 00000000000..665b0e46bca
--- /dev/null
+++ b/net-misc/apt-cacher-ng/files/initd-r3
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+CACHEDIR="/var/cache/${RC_SVCNAME}"
+SOCKETDIR="/run/apt-cacher-ng"
+SOCKETFILE="${SOCKETDIR}/${RC_SVCNAME}.socket"
+
+command="/usr/sbin/apt-cacher-ng"
+command_args="SocketPath=${SOCKETFILE} foreground=1 ${APT_CACHER_NG_ARGS}"
+command_background="true"
+command_user="apt-cacher-ng:apt-cacher-ng"
+pidfile="/run/${RC_SVCNAME}.pid"
+retry="15"
+
+start_pre() {
+       for d in "${SOCKETDIR}" "${CACHEDIR}"; do
+               checkpath --directory --mode 0755 --owner "${command_user}" 
"${d}"
+       done
+}

Reply via email to