mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 15:15:43 +01:00
check-generated-files.sh -u: don't update file timestamps
When running check-generated-files in update mode, all generated files were regenerated. As a consequence, ``` tests/scripts/check-generated-files.sh -u && make ``` always caused most of the code to be rebuilt. Now, if a file hasn't changed, preserve its original modification time (and other metadata), so the command above doesn't rebuild anything that has actually not changed. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
f749930ab8
commit
b5c4382bef
@ -65,24 +65,25 @@ check()
|
||||
fi
|
||||
|
||||
for FILE in "$@"; do
|
||||
cp "$FILE" "$FILE.bak"
|
||||
cp -p "$FILE" "$FILE.bak"
|
||||
done
|
||||
|
||||
"$SCRIPT"
|
||||
|
||||
# Compare the script output to the old files and remove backups
|
||||
for FILE in "$@"; do
|
||||
if ! diff "$FILE" "$FILE.bak" >/dev/null 2>&1; then
|
||||
if diff "$FILE" "$FILE.bak" >/dev/null 2>&1; then
|
||||
# Move the original file back so that $FILE's timestamp doesn't
|
||||
# change (avoids spurious rebuilds with make).
|
||||
mv "$FILE.bak" "$FILE"
|
||||
else
|
||||
echo "'$FILE' was either modified or deleted by '$SCRIPT'"
|
||||
if [ -z "$UPDATE" ]; then
|
||||
exit 1
|
||||
else
|
||||
rm "$FILE.bak"
|
||||
fi
|
||||
fi
|
||||
if [ -z "$UPDATE" ]; then
|
||||
mv "$FILE.bak" "$FILE"
|
||||
else
|
||||
rm "$FILE.bak"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$directory" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user