diff options
author | Mark Rousskov <mark.simulacrum@gmail.com> | 2022-12-21 09:24:43 -0500 |
---|---|---|
committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2022-12-21 09:29:00 -0500 |
commit | 0ed563d4180e4e4431efe7bc02207c7fa5486764 (patch) | |
tree | 90568e8260574fdc46542d61037bc7ec31c36f56 | |
parent | a2e6c29543e63aed91017413e39fbdb22c666c8d (diff) | |
download | rust-installer-0ed563d4180e4e4431efe7bc02207c7fa5486764.tar.gz |
Fix --without-components with subsetted components
It's not entirely clear what changed in 1.66, but rust-lang/rust#105755
shows that we are failing to run the install script with --without if
there are subsetted component names.
This changes the behavior of the filtering to require an *exact* match
rather than a partial match, which seems like the better way to go. It's
not very clear to me that the previous behavior was actually a good
idea.
-rw-r--r-- | install-template.sh | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/install-template.sh b/install-template.sh index e68be89..7790541 100644 --- a/install-template.sh +++ b/install-template.sh @@ -921,9 +921,27 @@ fi if [ -n "$CFG_WITHOUT" ]; then without_components="$(echo "$CFG_WITHOUT" | sed "s/,/ /g")" - for without_component in $without_components; do - components="$(echo "$components" | sed "s/$without_component//" | sed "s/$without_component//")" + + # This does **not** check that all components in without_components are + # actually present in the list of available components. + # + # Currently that's considered good as it makes it easier to be compatible + # with multiple Rust versions (which may change the exact list of + # components) when writing install scripts. + new_comp="" + for component in $components; do + found=false + for my_component in $without_components; do + if [ "$component" = "$my_component" ]; then + found=true + fi + done + if [ "$found" = false ]; then + # If we didn't find the component in without, then add it to new list. + new_comp="$new_comp $component" + fi done + components="$new_comp" fi if [ -z "$components" ]; then |