Skip to content

Commit cd29dc0

Browse files
committed
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 <[email protected]>
1 parent 07e9ff3 commit cd29dc0

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

lib/portage/const.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
"getbinpkg",
160160
"gpg-keepalive",
161161
"icecream",
162+
"ignore-mtime",
162163
"installsources",
163164
"ipc-sandbox",
164165
"keeptemp",

lib/portage/dbapi/vartree.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5422,6 +5422,7 @@ def mergeme(
54225422
srcroot = normalize_path(srcroot).rstrip(sep) + sep
54235423
destroot = normalize_path(destroot).rstrip(sep) + sep
54245424
calc_prelink = "prelink-checksums" in self.settings.features
5425+
ignore_mtime = "ignore-mtime" in self.settings.features
54255426

54265427
protect_if_modified = (
54275428
"config-protect-if-modified" in self.settings.features
@@ -5830,6 +5831,13 @@ def mergeme(
58305831
hardlink_candidates.append(mydest)
58315832
zing = ">>>"
58325833
else:
5834+
if not ignore_mtime:
5835+
mymtime = thismtime if thismtime is not None else mymtime
5836+
try:
5837+
os.utime(mydest, ns=(mymtime, mymtime))
5838+
except OSError:
5839+
# utime can fail here with EPERM
5840+
pass
58335841
zing = "==="
58345842

58355843
try:

man/make.conf.5

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,10 @@ If your GPG is auto unlocked on login, you do not need this.
533533
.B icecream
534534
Enable portage support for the icecream package.
535535
.TP
536+
.B ignore\-mtime
537+
Do not update mtime if the target file is equal. This can be useful on some
538+
filesystems to better utilize features like snapshots and data duplication.
539+
.TP
536540
.B installsources
537541
Install source code into /usr/src/debug/${CATEGORY}/${PF} (also see
538542
\fBsplitdebug\fR). This feature works only if debugedit is installed, CFLAGS

0 commit comments

Comments
 (0)