Skip to content

Commit

Permalink
Improve port upgrading experience (#1027)
Browse files Browse the repository at this point in the history
Only upgrade ports that are specified. Also, ask the user if they're sure they want to upgrade.

It should prevent accidentally deleting/rebuilding LLVM if it's out of date or if trying to upgrade a port it depends on.
  • Loading branch information
ekilmer authored Jul 11, 2023
1 parent eb15b60 commit 8b4c12e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ See [the vcpkg docs](https://github.com/microsoft/vcpkg/blob/master/docs/example

Installing additional dependencies will not update any existing dependencies by default. We do not update/upgrade by default because this could cause unexpected rebuilds that could potentially take hours (in the case of LLVM). To update dependencies, pass the `--upgrade-ports` option to the build script along with the respective options affecting vcpkg triplet selection (like `--release`).

You must specify the exact package/ports you want to upgrade. If the port does not exist, this will fail.

## Useful manual vcpkg commands

Sometimes it is useful to run vcpkg commands manually for testing a single package. Ideally, someone who wants to do this would read the [vcpkg documentation](https://github.com/microsoft/vcpkg/tree/master/docs), but below we list some commonly used commands. Inspecting the output of the build script will also show all of the vcpkg commands executed.
Expand Down
17 changes: 13 additions & 4 deletions build_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ while [[ $# -gt 0 ]] ; do
esac
shift
done
msg "Passing extra args to 'vcpkg install':"
msg "Passing extra args to vcpkg:"
msg " " "${VCPKG_ARGS[@]}"

function die_if_not_installed {
Expand Down Expand Up @@ -237,10 +237,19 @@ if [[ ${UPGRADE_PORTS} == "true" ]]; then
cd "${repo_dir}"
(
set -x
# shellcheck disable=SC2046
"${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" "${overlays[@]}" --no-dry-run --allow-unsupported
"${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" "${overlays[@]}" --allow-unsupported "${VCPKG_ARGS[@]}" || true

set +x
read -p "Are you sure? If so, enter 'y' " -n 1 -r
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]
then
set -x
"${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" "${overlays[@]}" --no-dry-run --allow-unsupported "${VCPKG_ARGS[@]}" || exit 1
fi
)
) || exit 1
)
exit 0
fi

deps=()
Expand Down

0 comments on commit 8b4c12e

Please sign in to comment.