Skip to content

Commit 1965d3a

Browse files
ekilmerHenrich Lauko
authored andcommitted
Improve port upgrading experience (#1027)
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.
1 parent dbc72e0 commit 1965d3a

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ See [the vcpkg docs](https://github.com/microsoft/vcpkg/blob/master/docs/example
128128

129129
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`).
130130

131+
You must specify the exact package/ports you want to upgrade. If the port does not exist, this will fail.
132+
131133
## Useful manual vcpkg commands
132134

133135
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.

build_dependencies.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ while [[ $# -gt 0 ]] ; do
8282
esac
8383
shift
8484
done
85-
msg "Passing extra args to 'vcpkg install':"
85+
msg "Passing extra args to vcpkg:"
8686
msg " " "${VCPKG_ARGS[@]}"
8787

8888
function die_if_not_installed {
@@ -237,10 +237,19 @@ if [[ ${UPGRADE_PORTS} == "true" ]]; then
237237
cd "${repo_dir}"
238238
(
239239
set -x
240-
# shellcheck disable=SC2046
241-
"${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" "${overlays[@]}" --no-dry-run --allow-unsupported
240+
"${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" "${overlays[@]}" --allow-unsupported "${VCPKG_ARGS[@]}" || true
241+
242+
set +x
243+
read -p "Are you sure? If so, enter 'y' " -n 1 -r
244+
echo ""
245+
if [[ $REPLY =~ ^[Yy]$ ]]
246+
then
247+
set -x
248+
"${vcpkg_dir}/vcpkg" upgrade "${extra_vcpkg_args[@]}" "${overlays[@]}" --no-dry-run --allow-unsupported "${VCPKG_ARGS[@]}" || exit 1
249+
fi
242250
)
243-
) || exit 1
251+
)
252+
exit 0
244253
fi
245254

246255
deps=()

0 commit comments

Comments
 (0)