tools: fix dep_updaters dir updates

Replace directories instead of just copying to take removed files into
account.

PR-URL: https://github.com/nodejs/node/pull/51294
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
Michaël Zasso 2023-12-29 16:10:58 +01:00 committed by GitHub
parent f6a83cdb6f
commit 07f3df4453
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 14 additions and 8 deletions

View File

@ -63,8 +63,7 @@ cp "$DEPS_DIR/cares/cares.gyp" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$WORKSPACE/cares"
echo "Replacing existing c-ares"
rm -rf "$DEPS_DIR/cares"
mv "$WORKSPACE/cares" "$DEPS_DIR/"
replace_dir "$DEPS_DIR/cares" "$WORKSPACE/cares"
# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need

View File

@ -59,7 +59,7 @@ autoreconf -i
./configure --prefix="$PWD/build" --enable-lib-only
cp -R lib/* "$DEPS_DIR/ngtcp2/nghttp3/lib/"
replace_dir "$DEPS_DIR/ngtcp2/nghttp3/lib" "lib"
# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need

View File

@ -63,9 +63,8 @@ autoreconf -i
./configure --prefix="$PWD/build" --enable-lib-only
cp -R lib/* "$DEPS_DIR/ngtcp2/ngtcp2/lib/"
cp -R crypto/* "$DEPS_DIR/ngtcp2/ngtcp2/crypto/"
replace_dir "$DEPS_DIR/ngtcp2/ngtcp2/lib" "lib"
replace_dir "$DEPS_DIR/ngtcp2/ngtcp2/crypto" "crypto"
# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need

View File

@ -68,8 +68,8 @@ mv "$WORKSPACE/"*.gyp "$WORKSPACE/"*.gn "$WORKSPACE/"*.gni "$DEPS_DIR/uvwasi/"
cd "$DEPS_DIR/uvwasi/"
echo "Copying new files to deps folder"
cp -r "$UVWASI_ZIP/include" "$DEPS_DIR/uvwasi/"
cp -r "$UVWASI_ZIP/src" "$DEPS_DIR/uvwasi/"
replace_dir "$DEPS_DIR/uvwasi/include" "$UVWASI_ZIP/include"
replace_dir "$DEPS_DIR/uvwasi/src" "$UVWASI_ZIP/src"
cp "$UVWASI_ZIP/LICENSE" "$DEPS_DIR/uvwasi/"
rm -rf "$UVWASI_ZIP"

View File

@ -77,3 +77,11 @@ log_and_verify_sha256sum() {
fi
fi
}
# This function replaces the directory of a dependency with the new one.
replace_dir() {
old_dir="$1"
new_dir="$2"
rm -rf "$old_dir"
mv "$new_dir" "$old_dir"
}