Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
build/bin/sage-spkg: Exit with error for some old-style script invoca…
Browse files Browse the repository at this point in the history
…tions
  • Loading branch information
Matthias Koeppe committed Sep 24, 2020
1 parent ac09b14 commit bf0c3dc
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions build/bin/sage-spkg
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ PKG_BASE=`echo "$PKG_NAME" | sed 's/-.*//'` # strip version number
# in upstream.
PKG_VER="${PKG_NAME#${PKG_BASE}}"
PKG_VER="${PKG_VER#-}"
if [ -n "$PKG_VER" ]; then
echo >&2 "Error: Selecting a different version of a package is no longer supported"
exit 1
fi
PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE"
LOCAL_PKG_VER=`cat $PKG_SCRIPTS/package-version.txt 2>/dev/null`
PKG_VER="$LOCAL_PKG_VER"
Expand Down Expand Up @@ -318,25 +322,19 @@ if [ $INFO -ne 0 ]; then
exec sage-spkg-info $PKG_BASE
fi

# If we haven't found the package yet, we must download it
if [ ! -f "$PKG_SRC" ]; then
if [ -n "$PKG_NAME_UPSTREAM" ]; then
# This is the new-style package way of downloading the tarball
if ! sage-download-file $SAGE_DOWNLOAD_FILE_OPTIONS "$PKG_NAME_UPSTREAM"; then
error_msg "Error downloading $PKG_NAME_UPSTREAM"
exit 1
fi
PKG_SRC="$SAGE_DISTFILES/$PKG_NAME_UPSTREAM"
else
echo >&2 "Error: Installing old-style SPKGs is no longer supported"
if [ -n "$PKG_NAME_UPSTREAM" ]; then
# Normal package
if ! sage-download-file $SAGE_DOWNLOAD_FILE_OPTIONS "$PKG_NAME_UPSTREAM"; then
error_msg "Error downloading $PKG_NAME_UPSTREAM"
exit 1
fi
fi
PKG_SRC="$SAGE_DISTFILES/$PKG_NAME_UPSTREAM"

# Do a final check that PKG_SRC is a file with an absolute path
cd /
if [ ! -f "$PKG_SRC" ]; then
echo >&2 "Error: spkg file '$PKG_SRC' not found."
if [ ! -d "$PKG_SRC" ]; then
echo >&2 "Error: spkg directory '$PKG_SRC' not found."
echo >&2 "This shouldn't happen, it is a bug in the sage-spkg script."
exit 1
fi
Expand Down

0 comments on commit bf0c3dc

Please sign in to comment.