1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2025-01-22 02:14:39 -07:00

preserve installed file timestamps throughout kiss

install_files(): preserve the timestamps

This patch fixes packages which rely on using the timestamp of their
installed files to determine "newness", where if a file is newer, they
will automatically recompile it. This patch prevents those recompilations,
since the timestamps are now at their expected value. We only run `touch`
on non-symlink files, since if we run touch on symlinks, we can run into
file resolution errors, which will abort the installation of packages and
result in a dirty filesystem.

pkg_swap(): also preserve timestamps
This commit is contained in:
Ethan 2024-02-12 16:03:26 -06:00 committed by phoebos
parent 38e85240b8
commit 2feaf95261

6
kiss
View File

@ -1355,8 +1355,9 @@ pkg_swap() {
log "Swapping '$2' from '$_owns' to '$1'" log "Swapping '$2' from '$_owns' to '$1'"
# Convert the current owner to an alternative and rewrite its manifest # Convert the current owner to an alternative and rewrite its manifest
# file to reflect this. # file to reflect this. Also ensure that timestamps are preserved.
cp -Pf "$KISS_ROOT$2" "$sys_ch/$_owns>${_fnr#*>}" cp -Pf "$KISS_ROOT$2" "$sys_ch/$_owns>${_fnr#*>}"
! [ -h "$KISS_ROOT$2" ] && touch -r "$KISS_ROOT$2" "$sys_ch/$_owns>${_fnr#*>}"
pkg_manifest_replace "$_owns" "$2" "/$cho_db/$_owns>${_fnr#*>}" pkg_manifest_replace "$_owns" "$2" "/$cho_db/$_owns>${_fnr#*>}"
fi fi
@ -1438,6 +1439,9 @@ pkg_install_files() {
# temporary name created above. # temporary name created above.
cp -fP "$2$file" "$__tmp" && cp -fP "$2$file" "$__tmp" &&
# Ensure timestamps are preserved.
if ! [ -h "$2$file" ]; then touch -r "$2$file" "$__tmp"; fi &&
# Atomically move the temporary file to its final # Atomically move the temporary file to its final
# destination. The running processes will either get # destination. The running processes will either get
# the old file or the new one. # the old file or the new one.