Skip to content

Commit

Permalink
tools: fix dep_updaters dir updates
Browse files Browse the repository at this point in the history
Replace directories instead of just copying to take removed files into
account.

PR-URL: #51294
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Marco Ippolito <[email protected]>
Reviewed-By: Rafael Gonzaga <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
targos authored and richardlau committed Mar 25, 2024
1 parent ed97b04 commit 3b3a297
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
3 changes: 1 addition & 2 deletions tools/dep_updaters/update-c-ares.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/dep_updaters/update-nghttp3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions tools/dep_updaters/update-ngtcp2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tools/dep_updaters/update-uvwasi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
8 changes: 8 additions & 0 deletions tools/dep_updaters/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

0 comments on commit 3b3a297

Please sign in to comment.