diff options
author | gcarq <egger.m@protonmail.com> | 2023-05-15 11:55:05 +0200 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-05-23 01:22:09 +0100 |
commit | 89703c688868c9eb8cd6115cb42ff92f0b9668b8 (patch) | |
tree | 9bf0e2dcf2bc827078d22c2459146e9c6c177182 /lib | |
parent | mergeme: Put xattr comparison logic behind xattr feature flag (diff) | |
download | portage-89703c688868c9eb8cd6115cb42ff92f0b9668b8.tar.gz portage-89703c688868c9eb8cd6115cb42ff92f0b9668b8.tar.bz2 portage-89703c688868c9eb8cd6115cb42ff92f0b9668b8.zip |
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@protonmail.com>
Closes: https://github.com/gentoo/portage/pull/991
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/portage/const.py | 1 | ||||
-rw-r--r-- | lib/portage/dbapi/vartree.py | 8 |
2 files changed, 9 insertions, 0 deletions
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: |