Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
164 commits
Select commit Hold shift + click to select a range
b39fe00
app-admin/logrotate: Sync with Gentoo
Jun 22, 2026
4fe8308
app-alternatives/ninja: Sync with Gentoo
Jun 22, 2026
b2013c2
app-arch/libarchive: Sync with Gentoo
Jun 22, 2026
848eb93
app-containers/aardvark-dns: Sync with Gentoo
Jun 22, 2026
5a74151
app-containers/conmon: Sync with Gentoo
Jun 22, 2026
981397a
app-containers/containerd: Sync with Gentoo
Jun 22, 2026
4ba3ba4
app-containers/cri-tools: Sync with Gentoo
Jun 22, 2026
15ed021
app-containers/crun: Sync with Gentoo
Jun 22, 2026
4d20e88
app-containers/docker: Sync with Gentoo
Jun 22, 2026
4b73732
app-containers/docker-buildx: Sync with Gentoo
Jun 22, 2026
36a4548
app-containers/docker-cli: Sync with Gentoo
Jun 22, 2026
621f695
app-containers/netavark: Sync with Gentoo
Jun 22, 2026
ca9b4cb
app-containers/podman: Sync with Gentoo
Jun 22, 2026
edf295d
app-containers/runc: Sync with Gentoo
Jun 22, 2026
59b4d11
app-crypt/adcli: Sync with Gentoo
Jun 22, 2026
94eeb55
app-crypt/gnupg: Sync with Gentoo
Jun 22, 2026
b8238e0
app-crypt/gpgme: Sync with Gentoo
Jun 22, 2026
e105530
app-crypt/libmd: Sync with Gentoo
Jun 22, 2026
9ba1a85
app-crypt/mit-krb5: Sync with Gentoo
Jun 22, 2026
59984da
app-crypt/pinentry: Sync with Gentoo
Jun 22, 2026
91e71a5
app-crypt/tpm2-tss: Sync with Gentoo
Jun 22, 2026
3e463e5
app-emulation/qemu: Sync with Gentoo
Jun 22, 2026
96046dc
app-emulation/qemu-guest-agent: Sync with Gentoo
Jun 22, 2026
63b134e
app-emulation/virt-firmware: Sync with Gentoo
Jun 22, 2026
a5d5771
app-eselect/eselect-pinentry: Sync with Gentoo
Jun 22, 2026
2db2c9f
app-misc/jq: Sync with Gentoo
Jun 22, 2026
7c73c7d
app-misc/mime-types: Sync with Gentoo
Jun 22, 2026
4ba3e9a
app-portage/gentoolkit: Sync with Gentoo
Jun 22, 2026
c786c4b
app-portage/getuto: Sync with Gentoo
Jun 22, 2026
ba946ab
app-shells/bash: Sync with Gentoo
Jun 22, 2026
ab1b329
dev-build/autoconf: Sync with Gentoo
Jun 22, 2026
1a52283
dev-build/automake: Sync with Gentoo
Jun 22, 2026
718d40d
dev-build/cmake: Sync with Gentoo
Jun 22, 2026
84d5b2e
dev-build/meson: Sync with Gentoo
Jun 22, 2026
ab741a0
dev-db/etcd: Sync with Gentoo
Jun 22, 2026
6b12230
dev-db/sqlite: Sync with Gentoo
Jun 22, 2026
318749a
dev-debug/gdb: Sync with Gentoo
Jun 22, 2026
111f04a
dev-debug/strace: Sync with Gentoo
Jun 22, 2026
25cc836
dev-go/go-md2man: Sync with Gentoo
Jun 22, 2026
4f2a266
dev-lang/go: Sync with Gentoo
Jun 22, 2026
ce2feaf
dev-lang/perl: Sync with Gentoo
Jun 22, 2026
1a3b8cf
dev-lang/python: Sync with Gentoo
Jun 22, 2026
60d914b
dev-lang/rust: Sync with Gentoo
Jun 22, 2026
92616e1
dev-lang/rust-bin: Sync with Gentoo
Jun 22, 2026
ea61155
dev-lang/rust-common: Sync with Gentoo
Jun 22, 2026
b122a28
dev-lang/swig: Sync with Gentoo
Jun 22, 2026
8a92277
dev-lang/tcl: Sync with Gentoo
Jun 22, 2026
872ed43
dev-libs/expat: Sync with Gentoo
Jun 22, 2026
28c140f
dev-libs/gmp: Sync with Gentoo
Jun 22, 2026
6d0dd9e
dev-libs/jsoncpp: Sync with Gentoo
Jun 22, 2026
6f345d5
dev-libs/libgpg-error: Sync with Gentoo
Jun 22, 2026
0f66176
dev-libs/libksba: Sync with Gentoo
Jun 22, 2026
e33199c
dev-libs/libpwquality: Sync with Gentoo
Jun 22, 2026
5b9e824
dev-libs/libtasn1: Sync with Gentoo
Jun 22, 2026
f17a1a8
dev-libs/libtraceevent: Sync with Gentoo
Jun 22, 2026
09f42eb
dev-libs/libusb: Sync with Gentoo
Jun 22, 2026
c6e594a
dev-libs/libuv: Sync with Gentoo
Jun 22, 2026
e8241f8
dev-libs/libxml2: Sync with Gentoo
Jun 22, 2026
d73d7cf
dev-libs/opensc: Sync with Gentoo
Jun 22, 2026
a782ce8
dev-libs/openssl: Sync with Gentoo
Jun 22, 2026
9f2bbd0
dev-libs/protobuf: Sync with Gentoo
Jun 22, 2026
e4c5d8c
dev-python/cryptography: Sync with Gentoo
Jun 22, 2026
c04c459
dev-python/cython: Sync with Gentoo
Jun 22, 2026
438a8c0
dev-python/distlib: Sync with Gentoo
Jun 22, 2026
3361418
dev-python/docutils: Sync with Gentoo
Jun 22, 2026
bc10b27
dev-python/editables: Sync with Gentoo
Jun 22, 2026
0ddd665
dev-python/ensurepip-pip: Sync with Gentoo
Jun 22, 2026
1fc40d5
dev-python/hatchling: Sync with Gentoo
Jun 22, 2026
3587c15
dev-python/idna: Sync with Gentoo
Jun 22, 2026
5883552
dev-python/installer: Sync with Gentoo
Jun 22, 2026
1964697
dev-python/jaraco-functools: Sync with Gentoo
Jun 22, 2026
49b611d
dev-python/markdown-it-py: Sync with Gentoo
Jun 22, 2026
383083f
dev-python/more-itertools: Sync with Gentoo
Jun 22, 2026
74a9a21
dev-python/msgpack: Sync with Gentoo
Jun 22, 2026
e61bcba
dev-python/packaging: Sync with Gentoo
Jun 22, 2026
cf406a8
dev-python/pathspec: Sync with Gentoo
Jun 22, 2026
14bc3f8
dev-python/pip: Sync with Gentoo
Jun 22, 2026
69722f7
dev-python/platformdirs: Sync with Gentoo
Jun 22, 2026
cbb1ba7
dev-python/poetry-core: Sync with Gentoo
Jun 22, 2026
2972bd3
dev-python/requests: Sync with Gentoo
Jun 22, 2026
1b3110e
dev-python/snakeoil: Sync with Gentoo
Jun 22, 2026
189e9cd
dev-python/trove-classifiers: Sync with Gentoo
Jun 22, 2026
e80a9ee
dev-util/catalyst: Sync with Gentoo
Jun 22, 2026
2ebebb5
dev-util/maturin: Sync with Gentoo
Jun 22, 2026
249cb1a
dev-util/patchutils: Sync with Gentoo
Jun 22, 2026
b48b31d
dev-util/perf: Sync with Gentoo
Jun 22, 2026
ecd5ac3
dev-util/pkgcheck: Sync with Gentoo
Jun 22, 2026
53c6972
dev-util/xdelta: Sync with Gentoo
Jun 22, 2026
5e75b2b
dev-vcs/git: Sync with Gentoo
Jun 22, 2026
bcadd10
eclass/cmake: Sync with Gentoo
Jun 22, 2026
9971e71
eclass/dist-kernel-utils: Sync with Gentoo
Jun 22, 2026
9e817cd
eclass/distutils-r1: Sync with Gentoo
Jun 22, 2026
c0620d8
eclass/kernel-2: Sync with Gentoo
Jun 22, 2026
6a4f794
eclass/linux-mod: Sync with Gentoo
Jun 22, 2026
b0452b4
eclass/mount-boot: Sync with Gentoo
Jun 22, 2026
6a56e40
eclass/python-utils-r1: Sync with Gentoo
Jun 22, 2026
c618b94
eclass/secureboot: Sync with Gentoo
Jun 22, 2026
9443823
eclass/toolchain: Sync with Gentoo
Jun 22, 2026
22f670f
licenses: Sync with Gentoo
Jun 22, 2026
033ae53
media-libs/libpng: Sync with Gentoo
Jun 22, 2026
d2682fc
net-dns/bind: Sync with Gentoo
Jun 22, 2026
9a5a70d
net-dns/dnsmasq: Sync with Gentoo
Jun 22, 2026
32f1520
net-fs/samba: Sync with Gentoo
Jun 22, 2026
f63622c
net-libs/gnutls: Sync with Gentoo
Jun 22, 2026
e4ff258
net-libs/libslirp: Sync with Gentoo
Jun 22, 2026
295a429
net-libs/ngtcp2: Sync with Gentoo
Jun 22, 2026
7be3102
net-misc/chrony: Sync with Gentoo
Jun 22, 2026
5937a37
net-misc/curl: Sync with Gentoo
Jun 22, 2026
a0e87e2
net-misc/iperf: Sync with Gentoo
Jun 22, 2026
8785088
net-misc/iputils: Sync with Gentoo
Jun 22, 2026
87a56dc
net-misc/passt: Sync with Gentoo
Jun 22, 2026
1a84aaf
net-misc/rsync: Sync with Gentoo
Jun 22, 2026
aafa92c
net-misc/wget: Sync with Gentoo
Jun 22, 2026
485f097
profiles: Sync with Gentoo
Jun 22, 2026
431fe63
sec-policy/selinux-base: Sync with Gentoo
Jun 22, 2026
514755e
sec-policy/selinux-base-policy: Sync with Gentoo
Jun 22, 2026
9524fe8
sec-policy/selinux-container: Sync with Gentoo
Jun 22, 2026
32bd28e
sec-policy/selinux-dbus: Sync with Gentoo
Jun 22, 2026
ad45846
sec-policy/selinux-policykit: Sync with Gentoo
Jun 22, 2026
c7d4b76
sec-policy/selinux-sssd: Sync with Gentoo
Jun 22, 2026
680a241
sec-policy/selinux-unconfined: Sync with Gentoo
Jun 22, 2026
b79f005
sys-apps/acl: Sync with Gentoo
Jun 22, 2026
2be7e57
sys-apps/bubblewrap: Sync with Gentoo
Jun 22, 2026
749d9b0
sys-apps/checkpolicy: Sync with Gentoo
Jun 22, 2026
faba1d7
sys-apps/coreutils: Sync with Gentoo
Jun 22, 2026
c5903cf
sys-apps/ethtool: Sync with Gentoo
Jun 22, 2026
2812bd3
sys-apps/file: Sync with Gentoo
Jun 22, 2026
07d0c0a
sys-apps/gentoo-functions: Sync with Gentoo
Jun 22, 2026
7f47efc
sys-apps/i2c-tools: Sync with Gentoo
Jun 22, 2026
4b5b170
sys-apps/iproute2: Sync with Gentoo
Jun 22, 2026
5dedffe
sys-apps/kbd: Sync with Gentoo
Jun 22, 2026
826753e
sys-apps/less: Sync with Gentoo
Jun 22, 2026
6cbaedc
sys-apps/net-tools: Sync with Gentoo
Jun 22, 2026
0a5f601
sys-apps/nvme-cli: Sync with Gentoo
Jun 22, 2026
c695d48
sys-apps/pkgcore: Sync with Gentoo
Jun 22, 2026
5682fee
sys-apps/portage: Sync with Gentoo
Jun 22, 2026
92bc805
sys-apps/sed: Sync with Gentoo
Jun 22, 2026
a6e9b02
sys-apps/semodule-utils: Sync with Gentoo
Jun 22, 2026
0f34cdc
sys-apps/shadow: Sync with Gentoo
Jun 22, 2026
427ea78
sys-apps/systemd: Sync with Gentoo
Jun 22, 2026
57d5537
sys-apps/util-linux: Sync with Gentoo
Jun 22, 2026
9cc2c73
sys-auth/sssd: Sync with Gentoo
Jun 22, 2026
777ea4b
sys-devel/binutils: Sync with Gentoo
Jun 22, 2026
fe48bf8
sys-devel/crossdev: Sync with Gentoo
Jun 22, 2026
5afbab0
sys-devel/gcc: Sync with Gentoo
Jun 22, 2026
ef0a5fa
sys-fs/btrfs-progs: Sync with Gentoo
Jun 22, 2026
8af9c20
sys-fs/zfs: Sync with Gentoo
Jun 22, 2026
b38037b
sys-fs/zfs-kmod: Sync with Gentoo
Jun 22, 2026
225864f
sys-kernel/dracut: Sync with Gentoo
Jun 22, 2026
e9c1318
sys-kernel/linux-headers: Sync with Gentoo
Jun 22, 2026
b8afc05
sys-libs/binutils-libs: Sync with Gentoo
Jun 22, 2026
4fbfd54
sys-libs/glibc: Sync with Gentoo
Jun 22, 2026
044eb3c
sys-libs/libcap: Sync with Gentoo
Jun 22, 2026
ef8d3f9
sys-libs/libcap-ng: Sync with Gentoo
Jun 22, 2026
e2829e4
sys-libs/libnvme: Sync with Gentoo
Jun 22, 2026
f4004df
sys-libs/libselinux: Sync with Gentoo
Jun 22, 2026
981c7bb
sys-libs/libsepol: Sync with Gentoo
Jun 22, 2026
ded7f12
sys-libs/libunwind: Sync with Gentoo
Jun 22, 2026
cea1c9a
sys-libs/liburing: Sync with Gentoo
Jun 22, 2026
6d06f71
sys-libs/talloc: Sync with Gentoo
Jun 22, 2026
30b627c
sys-libs/tdb: Sync with Gentoo
Jun 22, 2026
f6cb3c4
sys-libs/timezone-data: Sync with Gentoo
Jun 22, 2026
d68189b
sys-process/audit: Sync with Gentoo
Jun 22, 2026
2b82ab6
x11-drivers/nvidia-drivers: Sync with Gentoo
Jun 22, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
https://bugs.gentoo.org/934983
https://github.com/logrotate/logrotate/commit/04b21743980c4e236ca5e8de18173fbd3848573b

From 04b21743980c4e236ca5e8de18173fbd3848573b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Sat, 8 Jun 2024 17:59:40 +0200
Subject: [PATCH] test: avoid locale dependent errno string

String representations of errno values are locale dependent, thus avoid
using them.
---
test/test-0112.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/test-0112.sh b/test/test-0112.sh
index 812632b1..fa9eed65 100755
--- a/test/test-0112.sh
+++ b/test/test-0112.sh
@@ -23,7 +23,7 @@ test_reg.log.1.gz 1 zero
test_reg.log.2.gz 1 first
EOF

-grep "test_fifo.log.1 (read-only) for compression: Operation not supported" error.log >/dev/null
+grep "^error: unable to open .*/test_fifo\.log\.1 (read-only) for compression: " error.log >/dev/null
if [ $? != 0 ]; then
echo "No error printed, but there should be one."
exit 3

Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
https://github.com/logrotate/logrotate/issues/632
https://github.com/logrotate/logrotate/pull/633

From d2e090a9c0ba62aeab8c415aecf3067297f3eccc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
Date: Sat, 3 Aug 2024 19:07:38 +0200
Subject: [PATCH] Avoid opening log file for getting SELinux context

Currently setSecCtxByName() uses open_logfile() to get a file descriptor
to the current log file to retrieve its security context.
open_logfile() performs additional checks, like whether the file is a
regular file, which alter the control flow between systems with SELinux
enabled and disabled. This can be observed in the reported issue #632.
Use lgetfilecon_raw() instead to have the same behavior for SELinux
enabled and disabled systems and delay the checks for invalid log files
to code executed in both cases.

Closes: #632
---
logrotate.c | 89 ++++++++++++++++++++++++++++++-----------------------
1 file changed, 51 insertions(+), 38 deletions(-)

diff --git a/logrotate.c b/logrotate.c
index ba779950..c62e7c78 100644
--- a/logrotate.c
+++ b/logrotate.c
@@ -361,27 +361,9 @@ static int movefd(int oldfd, int newfd)
return rc;
}

-static int setSecCtx(int fdSrc, const char *src, char **pPrevCtx)
-{
#ifdef WITH_SELINUX
- char *srcCtx;
- *pPrevCtx = NULL;
-
- if (!selinux_enabled)
- /* pretend success */
- return 0;
-
- /* read security context of fdSrc */
- if (fgetfilecon_raw(fdSrc, &srcCtx) < 0) {
- if (errno == ENOTSUP)
- /* pretend success */
- return 0;
-
- message(MESS_ERROR, "getting file context %s: %s\n", src,
- strerror(errno));
- return selinux_enforce;
- }
-
+static int setSecCtx(char *srcCtx, char **pPrevCtx)
+{
/* save default security context for restoreSecCtx() */
if (getfscreatecon_raw(pPrevCtx) < 0) {
message(MESS_ERROR, "getting default context: %s\n", strerror(errno));
@@ -401,37 +383,68 @@ static int setSecCtx(int fdSrc, const char *src, char **pPrevCtx)

message(MESS_DEBUG, "set default create context to %s\n", srcCtx);
freecon(srcCtx);
+
+ return 0;
+}
+#endif /* WITH_SELINUX */
+
+static int setSecCtxByFd(int fdSrc, const char *src, char **pPrevCtx)
+{
+#ifdef WITH_SELINUX
+ char *srcCtx;
+ *pPrevCtx = NULL;
+
+ if (!selinux_enabled)
+ /* pretend success */
+ return 0;
+
+ /* read security context of fdSrc */
+ if (fgetfilecon_raw(fdSrc, &srcCtx) < 0) {
+ if (errno == ENOTSUP)
+ /* pretend success */
+ return 0;
+
+ message(MESS_ERROR, "getting file context %s: %s\n", src,
+ strerror(errno));
+ return selinux_enforce;
+ }
+
+ return setSecCtx(srcCtx, pPrevCtx);
#else
(void) fdSrc;
(void) src;
(void) pPrevCtx;
-#endif
return 0;
+#endif /* WITH_SELINUX */
}

-static int setSecCtxByName(const char *src, const struct logInfo *log, char **pPrevCtx)
+static int setSecCtxByName(const char *src, char **pPrevCtx)
{
- int hasErrors = 0;
#ifdef WITH_SELINUX
- int fd;
+ char *srcCtx;
+ *pPrevCtx = NULL;

if (!selinux_enabled)
/* pretend success */
return 0;

- fd = open_logfile(src, log, 0);
- if (fd < 0) {
- message(MESS_ERROR, "error opening %s: %s\n", src, strerror(errno));
- return 1;
+ /* read security context of src */
+ if (lgetfilecon_raw(src, &srcCtx) < 0) {
+ if (errno == ENOTSUP)
+ /* pretend success */
+ return 0;
+
+ message(MESS_ERROR, "getting file context %s: %s\n", src,
+ strerror(errno));
+ return selinux_enforce;
}
- hasErrors = setSecCtx(fd, src, pPrevCtx);
- close(fd);
+
+ return setSecCtx(srcCtx, pPrevCtx);
#else
(void) src;
- (void) log;
(void) pPrevCtx;
-#endif
- return hasErrors;
+ return 0;
+#endif /* WITH_SELINUX */
}

static void restoreSecCtx(char **pPrevCtx)
@@ -874,7 +887,7 @@ static int compressLogFile(const char *name, const struct logInfo *log, const st
return 1;
}

- if (setSecCtx(inFile, name, &prevCtx) != 0) {
+ if (setSecCtxByFd(inFile, name, &prevCtx) != 0) {
/* error msg already printed */
close(inFile);
return 1;
@@ -1307,7 +1320,7 @@ static int copyTruncate(const char *currLog, const char *saveLog, const struct s
if (!skip_copy) {
char *prevCtx;

- if (setSecCtx(fdcurr, currLog, &prevCtx) != 0) {
+ if (setSecCtxByFd(fdcurr, currLog, &prevCtx) != 0) {
/* error msg already printed */
goto fail;
}
@@ -1905,7 +1918,7 @@ static int prerotateSingleLog(const struct logInfo *log, unsigned logNum,
message(MESS_DEBUG, "dateext suffix '%s'\n", dext_str);
message(MESS_DEBUG, "glob pattern '%s'\n", dext_pattern);

- if (setSecCtxByName(log->files[logNum], log, &prev_context) != 0) {
+ if (setSecCtxByName(log->files[logNum], &prev_context) != 0) {
/* error msg already printed */
return 1;
}
@@ -2186,7 +2199,7 @@ static int rotateSingleLog(const struct logInfo *log, unsigned logNum,
if (!hasErrors) {

if (!(log->flags & (LOG_FLAG_COPYTRUNCATE | LOG_FLAG_COPY))) {
- if (setSecCtxByName(log->files[logNum], log, &savedContext) != 0) {
+ if (setSecCtxByName(log->files[logNum], &savedContext) != 0) {
/* error msg already printed */
return 1;
}
@@ -2730,7 +2743,7 @@ static int writeState(const char *stateFilename)

/* get attributes, to assign them to the new state file */

- if (setSecCtx(fdcurr, stateFilename, &prevCtx) != 0) {
+ if (setSecCtxByFd(fdcurr, stateFilename, &prevCtx) != 0) {
/* error msg already printed */
free(tmpFilename);
close(fdcurr);

Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit systemd tmpfiles

DESCRIPTION="Rotates, compresses, and mails system logs"
HOMEPAGE="https://github.com/logrotate/logrotate"

if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/logrotate/logrotate"
inherit autotools git-r3
else
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/cgzones.asc
inherit verify-sig

SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.xz"
SRC_URI+=" verify-sig? ( https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.xz.asc )"

KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"

BDEPEND="verify-sig? ( sec-keys/openpgp-keys-cgzones )"
fi

LICENSE="GPL-2"
SLOT="0"
IUSE="acl +cron selinux"

DEPEND="
>=dev-libs/popt-1.5
acl? ( virtual/acl )
selinux? ( sys-libs/libselinux )
"
RDEPEND="
${DEPEND}
cron? ( virtual/cron )
selinux? ( sec-policy/selinux-logrotate )
"

STATEFILE="${EPREFIX}/var/lib/misc/logrotate.status"
OLDSTATEFILE="${EPREFIX}/var/lib/logrotate.status"

PATCHES=(
"${FILESDIR}"/${PN}-3.15.0-ignore-hidden.patch
"${FILESDIR}"/${P}-tests-locale.patch
"${FILESDIR}"/${P}-tests-selinux.patch
)

move_old_state_file() {
elog "logrotate state file is now located at ${STATEFILE}"
elog "See bug #357275"
if [[ -e "${OLDSTATEFILE}" ]] ; then
elog "Moving your current state file to new location: ${STATEFILE}"
mv -n "${OLDSTATEFILE}" "${STATEFILE}" || die
fi
}

install_cron_file() {
exeinto /etc/cron.daily
newexe "${S}"/examples/logrotate.cron "${PN}"
}

src_prepare() {
default

sed -i -e 's#/usr/sbin/logrotate#/usr/bin/logrotate#' examples/logrotate.{cron,service} || die

[[ ${PV} == 9999 ]] && eautoreconf
}

src_configure() {
econf \
$(use_with acl) \
$(use_with selinux) \
--with-state-file-path="${STATEFILE}"
}

src_install() {
dobin logrotate
doman logrotate.8
dodoc ChangeLog.md

insinto /etc
doins "${FILESDIR}"/logrotate.conf

use cron && install_cron_file

systemd_dounit examples/logrotate.{service,timer}
newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}.conf

keepdir /etc/logrotate.d
}

pkg_postinst() {
elog
elog "The ${PN} binary is now installed under /usr/bin. Please"
elog "update your links"
elog

move_old_state_file

tmpfiles_process ${PN}.conf

if [[ -z ${REPLACING_VERSIONS} ]] ; then
elog "If you wish to have logrotate e-mail you updates, please"
elog "emerge virtual/mailx and configure logrotate in"
elog "/etc/logrotate.conf appropriately"
elog
elog "Additionally, /etc/logrotate.conf may need to be modified"
elog "for your particular needs. See man logrotate for details."
fi
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
# Copyright 1999-2025 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/cgzones.asc
inherit systemd tmpfiles verify-sig
inherit systemd tmpfiles

DESCRIPTION="Rotates, compresses, and mails system logs"
HOMEPAGE="https://github.com/logrotate/logrotate"
SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.xz"
SRC_URI+=" verify-sig? ( https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.xz.asc )"

if [[ ${PV} == 9999 ]] ; then
EGIT_REPO_URI="https://github.com/logrotate/logrotate"
inherit autotools git-r3
else
VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/cgzones.asc
inherit verify-sig

SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.xz"
SRC_URI+=" verify-sig? ( https://github.com/${PN}/${PN}/releases/download/${PV}/${P}.tar.xz.asc )"

KEYWORDS="~alpha amd64 arm arm64 ~hppa ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"

BDEPEND="verify-sig? ( sec-keys/openpgp-keys-cgzones )"
fi

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~m68k ~mips ppc ppc64 ~riscv ~s390 ~sparc x86"
IUSE="acl +cron selinux"

DEPEND="
Expand All @@ -26,7 +37,6 @@ RDEPEND="
cron? ( virtual/cron )
selinux? ( sec-policy/selinux-logrotate )
"
BDEPEND="verify-sig? ( sec-keys/openpgp-keys-cgzones )"

STATEFILE="${EPREFIX}/var/lib/misc/logrotate.status"
OLDSTATEFILE="${EPREFIX}/var/lib/logrotate.status"
Expand All @@ -53,6 +63,8 @@ src_prepare() {
default

sed -i -e 's#/usr/sbin/logrotate#/usr/bin/logrotate#' examples/logrotate.{cron,service} || die

[[ ${PV} == 9999 ]] && eautoreconf
}

src_configure() {
Expand Down
Loading