From e0b6112766e17ca2a4c72698d866afea6a3693db Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 8 Jun 2020 00:17:34 -0700 Subject: [PATCH] build/bin/sage-spkg, src/bin/sage: Remove support for installing old-style SPKGs --- build/bin/sage-spkg | 202 ++------------------------ src/bin/sage | 52 +------ src/doc/en/reference/repl/options.rst | 3 - 3 files changed, 16 insertions(+), 241 deletions(-) diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index e4ce1b2812b..f65510945e7 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -73,12 +73,10 @@ export LC_ALL=C usage() { cat < +Usage: sage -i -If is a URL, download and install it. If it is a file -name, install it. Otherwise, search Sage's list of packages (see -'sage --package list') for a matching package, and if a match is -found, install it. +Search Sage's list of packages (see 'sage --package list') for a +matching package, and if a match is found, install it. Options: -s: do not delete the temporary build directory @@ -249,32 +247,13 @@ done # Figure out the package filename, download it if needed. ################################################################## # One should be able to install a package using -# sage -i where can be any of the -# following values: -# -# 1a. /path/to/-x.y.z.spkg, i.e. the package is found somewhere -# in your file system and you're giving an absolute path. -# 1b. relative/path/to/-x.y.z.spkg, the same with a relative -# path. -# 2a. -x.y.z, i.e. the name of the package plus the package's -# version numbers. -# 2b. -x.y.z.spkg, i.e. the name of the package in addition to -# the version numbers and the ".spkg" extension. -# 3. , i.e. the name of the package without a version number. -# 4. /-x.y.z.spkg, i.e. the full URL where the package -# is hosted. Any local packages matching are ignored. -# -# In cases 2a, 2b and 3 we first look locally inside spkg/* for a -# matching package. Otherwise, we try to download it. In all cases, -# we reduce to case 1a. -# -# See #7544 and #12602. -# +# sage -i PKG_SRC="$1" # Does PKG_SRC contain a slash? if echo "$PKG_SRC" | grep / >/dev/null; then - PKG_HAS_PATH=yes + echo >&2 "Error: Installing old-style SPKGs is no longer supported" + exit 1 fi # PKG_NAME is the last path component without .spkg # This already reduces case 2b to case 2a. @@ -374,154 +353,8 @@ if [ ! -f "$PKG_SRC" ]; then fi PKG_SRC="$SAGE_DISTFILES/$PKG_NAME_UPSTREAM" else - # Handle all the legacy cruft. This branch can be deleted once - # we get rid of old-style spkgs - if [ $YES = -1 ]; then - # User provided -n option, so don't even try to download the package" - echo "Old-style packages disabled by use of '-n' option" - exit 1 - fi - if [ $INFO -eq 0 ]; then - echo "Attempting to download package $PKG_NAME" - else - echo "Attempting to get on-line info for package $PKG_NAME" - fi - - # Reduce everything to case 4: full URL. - if [ -n "$PKG_HAS_PATH" ]; then - PKG_URL="$PKG_SRC" - else - # Handle cases 2a and 3, where the package name is something - # like "foo" or "foo-1.2.3". - MIRROR=$(sage-download-file --print-fastest-mirror)/spkg - if [ $? -ne 0 ]; then - error_msg "Error downloading list of packages" - exit 1 - fi - for repo in optional experimental huge; do - # Download the list of packages. - echo ">>> Checking online list of $repo packages." - # File inside DOT_SAGE should be writable - repolist="${DOT_SAGE}/${repo}.list" - sage-download-file --quiet "$MIRROR/$repo/list" $repolist - if [ $? -ne 0 ]; then - rm -f $repolist - error_msg "Error downloading $MIRROR/$repo/list" - exit 1 - fi - - # The contrived sed commands print out either ${PKG_NAME} if - # it appears as a complete line or some string starting with - # ${PKG_NAME}- whichever occurs first. - # Tested with GNU sed, BSD sed (on OS X) and Solaris sed. - pkg=`sed -n -f <( echo "/^${PKG_NAME}\$/{p;q;}" && echo "/^${PKG_NAME}-/{p;q;}" ) $repolist` - rm -f $repolist - if [ -n "$pkg" ]; then - echo ">>> Found $pkg" - PKG_NAME=$pkg - - # If INFO is set, try downloading only the .txt file - if [ $INFO -eq 1 ]; then - PKG_URL="$MIRROR/$repo/$pkg.txt" - sage-download-file --quiet "$PKG_URL" && exit 0 - # If the download failed (for whatever reason), - # fall through and use the .spkg file. - else - if [ $YES != 1 ]; then - # Warn and ask the user if downloading an - # experimental package. - # Add a deprecation note for other packages, - # since old-style packages are deprecated. - if [ $repo = experimental ]; then - write_to_tty < /dev/tty 2>&1 - else - answer=n - fi - case "$answer" in - n*|N*) exit 1;; - esac - else - # Deprecated since Sage 6.9, Trac #19158 - write_to_tty < /dev/tty 2>&1 - elif [ $YES = -1 ]; then - answer=n - else - answer=y - fi - case "$answer" in - n*|N*) exit 1;; - esac - fi - # 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..." - fi - fi - PKG_URL="$MIRROR/$repo/$pkg.spkg" - break - fi - done - - if [ -z "$PKG_URL" ]; then - echo >&2 "Error: could not find a package matching $PKG_NAME" - echo >&2 " Try 'sage --package list' to see the available packages" - echo >&2 " $(sage-package apropos $PKG_NAME)" - exit 1 - fi - fi - - # Trac #5852: check write permissions - mkdir -p "$SAGE_DISTFILES" - if [ ! -w "$SAGE_DISTFILES" ]; then - error_msg "Error: no write access to packages directory $SAGE_PACKAGES" - exit 1 - fi - cd "$SAGE_DISTFILES" || exit $? - - # Download to a temporary file (such that we don't end up with a - # corrupted .spkg file). - PKG_TMP="${PKG_URL##*/}.tmp" - echo ">>> Trying to download $PKG_URL" - sage-download-file "$PKG_URL" "$PKG_TMP" - if [ $? -ne 0 ]; then - # Delete failed download - rm -f "$PKG_TMP" - error_msg "Error downloading $PKG_URL" - exit 1 - fi - - PKG_SRC="`pwd`/${PKG_URL##*/}" - mv -f "$PKG_TMP" "$PKG_SRC" + echo >&2 "Error: Installing old-style SPKGs is no longer supported" + exit 1 fi fi @@ -634,21 +467,8 @@ if [ "$USE_LOCAL_SCRIPTS" = yes ]; then exit 1 fi else - # Old-style package (deprecated) - echo "Extracting package $PKG_SRC" - ls -l "$PKG_SRC" - - sage-uncompress-spkg "$PKG_SRC" - if [ $? -ne 0 ]; then - error_msg "Error: failed to extract $PKG_SRC" - exit 1 - fi - - cd "$PKG_NAME" - if [ $? -ne 0 ]; then - error_msg "Error: after extracting, the directory '$PKG_NAME' does not exist" - exit 1 - fi + echo >&2 "Error: Installing old-style SPKGs is no longer supported." + exit 1 fi echo "Finished extraction" @@ -1047,4 +867,4 @@ fi touch "$SAGE_LOCAL/lib/sage-force-relocate.txt" -echo "Finished installing $PKG_NAME.spkg" +echo "Finished installing $PKG_NAME" diff --git a/src/bin/sage b/src/bin/sage index d7c009fb402..58e4f602470 100755 --- a/src/bin/sage +++ b/src/bin/sage @@ -166,10 +166,6 @@ usage_advanced() { echo " build correctly; use at your own risk" echo " -n -- reply no to prompts about experimental" echo " and old-style packages" - echo " -p [opts] [packages]-- install the given Sage packages, without dependency" - echo " checking and with support for old-style spkgs." - echo " Options are -c, -d and -s with the same meaning as" - echo " for the -i command" echo " -info [packages] -- print the SPKG.txt or SPKG.rst of the given packages," echo " and some additional information." echo " --location -- if needed, fix paths to make Sage relocatable" @@ -385,7 +381,7 @@ if [ "$1" = '-i' ]; then # See https://trac.sagemath.org/ticket/25078 if ! echo "$ALL_TARGETS" | grep "^${PKG}$" >/dev/null; then echo >&2 "Error: package '$PKG' not found" - echo >&2 "Note: if it is an old-style package, use -p instead of -i to install it" + echo >&2 "Note: if it is an old-style package, installing these is no longer supported" exit 1 fi $MAKE SAGE_SPKG="sage-spkg $INSTALL_OPTIONS" "$PKG" @@ -942,41 +938,6 @@ if [ "$1" = '--location' ]; then exit 0 fi - -install() { - maybe_sage_location - - for PKG in "$@" - do - # Check for options - case "$PKG" in - -*) - INSTALL_OPTIONS="$INSTALL_OPTIONS $PKG" - continue;; - esac - - PKG_NAME=`echo "$PKG" | sed -e "s/\.spkg$//"` - PKG_NAME=`basename "$PKG_NAME"` - - sage-logger \ - "sage-spkg $INSTALL_OPTIONS '$PKG'" "$SAGE_LOGS/$PKG_NAME.log" - # Do not try to install further packages if one failed - if [ $? -ne 0 ]; then - exit 1 - fi - done - # Display a message if we actually installed something (using this - # file, generated by sage-spkg, is a bit of a hack though) - if [ -f "$SAGE_LOCAL/lib/sage-force-relocate.txt" ]; then - echo - echo "Warning: it might be needed to update the Sage library before" - echo "installed packages work: you should run 'make' from \$SAGE_ROOT" - echo "before running Sage." - fi - exit 0 -} - - if [ "$1" = '-package' -o "$1" = "--package" ]; then shift exec sage-package $@ @@ -1003,12 +964,8 @@ if [ "$1" = '-installed' -o "$1" = "--installed" ]; then fi if [ "$1" = '-p' ]; then - shift - # If there are no further arguments, display usage help. - if [ $# -eq 0 ]; then - exec sage-spkg - fi - install "$@" + echo "Error: Installing old-style SPKGs is no longer supported." + exit 1 fi if [ "$1" = '-info' -o "$1" = '--info' ]; then @@ -1110,7 +1067,8 @@ fi if [ $# -ge 1 ]; then T=`echo "$1" | sed -e "s/.*\.//"` if [ "$T" = "spkg" ]; then - install "$@" + echo "Error: Installing old-style SPKGs is no longer supported." + exit 1 fi sage_setup unset TERM # See Trac #12263 diff --git a/src/doc/en/reference/repl/options.rst b/src/doc/en/reference/repl/options.rst index 3bc37ca1961..89214741c55 100644 --- a/src/doc/en/reference/repl/options.rst +++ b/src/doc/en/reference/repl/options.rst @@ -211,9 +211,6 @@ Command-line options for Sage .. rubric:: Making Sage packages or distributions -- ``--pkg dir`` -- create the Sage package ``dir.spkg`` from the - directory ``dir`` -- ``--pkg_nc dir`` -- as ``--pkg``, but do not compress the package - ``--merge`` -- run Sage's automatic merge and test script - ``--sdist`` -- build a source distribution of Sage