3
0
Fork 0
forked from mirrors/nixpkgs

set-source-date-epoch-to-latest.sh: ignore generated files

set-source-date-epoch-to-latest.sh to ignore files newer than "$NIX_BUILD_TOP/.." (unlike "$NIX_BUILD_TOP" it is root-owned and cannot be touched by nixbld1).
This commit is contained in:
volth 2017-08-13 09:28:05 +00:00 committed by Volth
parent ef026e02fc
commit b971f8de8e

View file

@ -4,8 +4,8 @@ updateSourceDateEpoch() {
# Get the last modification time of all regular files, sort them, # Get the last modification time of all regular files, sort them,
# and get the most recent. Maybe we should use # and get the most recent. Maybe we should use
# https://github.com/0-wiz-0/findnewest here. # https://github.com/0-wiz-0/findnewest here.
local -a res=($(find "$path" -type f -print0 | xargs -0 -r stat -c '%Y %n' | sort -n | tail -n1)) local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ %p\n' | sort -n | tail -n1))
local time="${res[0]}" local time="${res[0]//\.[0-9]*/}" # remove the fraction part
local newestFile="${res[1]}" local newestFile="${res[1]}"
# Update $SOURCE_DATE_EPOCH if the most recent file we found is newer. # Update $SOURCE_DATE_EPOCH if the most recent file we found is newer.