commit: 89703c688868c9eb8cd6115cb42ff92f0b9668b8 Author: gcarq <egger.m <AT> protonmail <DOT> com> AuthorDate: Mon May 15 09:55:05 2023 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue May 23 00:22:09 2023 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=89703c68
mergeme: Update mtime if file is equal and introduce ignore-mtime Updates the mtime per default if the file is equal and adds a new feature flag called "ignore-mtime" to ignore mtime updates if the target file is equal. Signed-off-by: gcarq <egger.m <AT> protonmail.com> Closes: https://github.com/gentoo/portage/pull/991 Signed-off-by: Sam James <sam <AT> gentoo.org> lib/portage/const.py | 1 + lib/portage/dbapi/vartree.py | 8 ++++++++ man/make.conf.5 | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/lib/portage/const.py b/lib/portage/const.py index 10a208ceb..cb6796164 100644 --- a/lib/portage/const.py +++ b/lib/portage/const.py @@ -159,6 +159,7 @@ SUPPORTED_FEATURES = frozenset( "getbinpkg", "gpg-keepalive", "icecream", + "ignore-mtime", "installsources", "ipc-sandbox", "keeptemp", diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index 739b47f7f..441e74661 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -5422,6 +5422,7 @@ class dblink: srcroot = normalize_path(srcroot).rstrip(sep) + sep destroot = normalize_path(destroot).rstrip(sep) + sep calc_prelink = "prelink-checksums" in self.settings.features + ignore_mtime = "ignore-mtime" in self.settings.features protect_if_modified = ( "config-protect-if-modified" in self.settings.features @@ -5830,6 +5831,13 @@ class dblink: hardlink_candidates.append(mydest) zing = ">>>" else: + if not ignore_mtime: + mymtime = thismtime if thismtime is not None else mymtime + try: + os.utime(mydest, ns=(mymtime, mymtime)) + except OSError: + # utime can fail here with EPERM + pass zing = "===" try: diff --git a/man/make.conf.5 b/man/make.conf.5 index 85ee88c05..ed5b7d7fc 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -533,6 +533,12 @@ If your GPG is auto unlocked on login, you do not need this. .B icecream Enable portage support for the icecream package. .TP +.B ignore\-mtime +Do not update mtime if the target file is equal. This can be useful on some +filesystems to better utilize features like snapshots and data deduplication, +however this violates the preservation of file modification times as stipulated +in the PMS. +.TP .B installsources Install source code into /usr/src/debug/${CATEGORY}/${PF} (also see \fBsplitdebug\fR). This feature works only if debugedit is installed, CFLAGS