Skip to content

Commit

Permalink
sagemathgh-37995: Remove interactive confirmation for installing expe…
Browse files Browse the repository at this point in the history
…rimental packages

<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

This removes some complexity and eliminates the pitfall that Sage is
waiting for confirmation from the user but the query is hidden in long
terminal output from other package installations.
With this PR we just exit with an error and tell users what to do.

Fixes sagemath#35670.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->

URL: sagemath#37995
Reported by: Matthias Köppe
Reviewer(s):
  • Loading branch information
Release Manager committed May 15, 2024
2 parents 32ed4a5 + 9e62617 commit 3f818c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 29 deletions.
30 changes: 4 additions & 26 deletions build/bin/sage-spkg
Original file line number Diff line number Diff line change
Expand Up @@ -363,32 +363,10 @@ WRAPPED_SCRIPTS="build install preinst pipinst postinst $INSTALLED_SCRIPTS"
warning_for_experimental_packages() { ############################
if [ x`cat "$PKG_SCRIPTS/type"` = x"experimental" ]; then
if [ $YES != 1 -a -n "$PKG_NAME_UPSTREAM" ]; then
# We use /dev/tty here because our output may be redirected
# to a logfile, or line-buffered.
write_to_tty <<EOF
=========================== WARNING ===========================
You are about to download and install the experimental package
$PKG_NAME. This probably won't work at all for you! There
is no guarantee that it will build correctly, or behave as
expected. Use at your own risk!
===============================================================
EOF
if [ $? -ne 0 ]; then
echo "Terminal not available for prompting. Use 'sage -i -y $PKG_BASE'"
echo "to install experimental packages in non-interactive mode."
YES=-1
fi
if [ $YES != -1 ]; then
read -p "Are you sure you want to continue [Y/n]? " answer < /dev/tty > /dev/tty 2>&1
else
answer=n
fi
case "$answer" in
n*|N*) exit 1;;
esac
# Confirm the user's input. (This gives important
# feedback to the user when output is redirected to a logfile.)
echo > /dev/tty "OK, installing $PKG_NAME now..."
echo "Error: The package $PKG_NAME is marked as experimental."
echo "Use 'sage -i -y $PKG_BASE' to force installation of this package"
echo "or use the configure option --enable-experimental-packages"
exit 1
fi
fi
} ############################## warning_for_experimental_packages
Expand Down
4 changes: 2 additions & 2 deletions build/pkgs/configure/checksums.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
tarball=configure-VERSION.tar.gz
sha1=dca19f73642b76f1f96b860bb6603499f586380d
sha256=843e060687a9a2360ea3e9499e5c20eb744fcfc2acd4b13c01444ecd961fd43e
sha1=f593a1829c212d3ca288997f1b9a628c031cdf6e
sha256=f112fc41dfa549b0eff89223f20cf6b97e4196aff23775fea1f7a9705b44604a
2 changes: 1 addition & 1 deletion build/pkgs/configure/package-version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
f5e78840b108412e1e26382910af993f874c6933
f42c9f7bce761282a09103dea32de38da9bf6e46

0 comments on commit 3f818c3

Please sign in to comment.