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: Get rid of USE_LOCAL_SCRIPTS (it was always yes)…
Browse files Browse the repository at this point in the history
…; prepare for script packages
  • Loading branch information
mkoeppe committed Sep 24, 2020
1 parent f0f03c9 commit 46e5f68
Showing 1 changed file with 15 additions and 44 deletions.
59 changes: 15 additions & 44 deletions build/bin/sage-spkg
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,6 @@ fi
PKG_NAME="$PKG_SRC"
PKG_BASE=`echo "$PKG_NAME" | sed 's/-.*//'` # strip version number

# USE_LOCAL_SCRIPTS is a flag that if non-empty will cause
# this script to try to install the package using local metadata
# i.e. use upstream tarballs (vs spkgs) and scripts located in build/pkgs/$PKG_BASE
# the value of this flag is set in the next codeblock
USE_LOCAL_SCRIPTS=

# PKG_SRC should look like "package-VERSION" or just "package".
# If VERSION matches the version in build/pkgs or there is no version
# specified, use the local scripts; otherwise we try to find a package
Expand All @@ -281,7 +275,6 @@ if [ -z "$PKG_VER" ]; then
else
PKG_NAME="${PKG_BASE}-${PKG_VER}"
fi
USE_LOCAL_SCRIPTS=yes
PKG_BASE_VER=`echo $PKG_VER | sed 's/\.p[0-9][0-9]*$//'`
PKG_NAME_UPSTREAM=`lookup_param tarball "$PKG_SCRIPTS/checksums.ini" | sed "s/VERSION/$PKG_BASE_VER/"`
echo "Found local metadata for $PKG_NAME"
Expand Down Expand Up @@ -318,7 +311,7 @@ EOF
fi
fi

if [ $INFO -ne 0 -a "$USE_LOCAL_SCRIPTS" = yes ]; then
if [ $INFO -ne 0 ]; then
exec sage-spkg-info $PKG_BASE
fi

Expand Down Expand Up @@ -362,20 +355,6 @@ if [ -n "$SAGE_INSTALL_FETCH_ONLY" ]; then
exit 0
fi

##################################################################
# Handle --info
##################################################################

if [ $INFO -ne 0 -a -z "$USE_LOCAL_SCRIPTS" ]; then
cat "$PKG_SCRIPTS/SPKG.txt"
sage-uncompress-spkg "$PKG_SRC" "$PKG_NAME/SPKG.txt"
if [ $? -ne 0 ]; then
error_msg "Error: no file SPKG.txt in $PKG_NAME"
exit 1
fi
exit 0
fi

##################################################################
# Setup directories
##################################################################
Expand Down Expand Up @@ -431,11 +410,11 @@ if [ -e "$PKG_NAME" ]; then
fi

##################################################################
# Extract the package
# Normal packages: Extract the package
##################################################################

if [ "$USE_LOCAL_SCRIPTS" = yes ]; then
# New-style package
if [ -f "$PKG_SCRIPTS"/checksums.ini ]; then
# Normal package
echo "Setting up build directory for $PKG_NAME"
cp -RLp "$PKG_SCRIPTS" "$PKG_NAME"
cd "$PKG_NAME" || exit $?
Expand All @@ -445,19 +424,18 @@ if [ "$USE_LOCAL_SCRIPTS" = yes ]; then
error_msg "Error: failed to extract $PKG_SRC"
exit 1
fi
else
echo >&2 "Error: Installing old-style SPKGs is no longer supported."
exit 1
fi

echo "Finished extraction"

cd src
if ! sage-apply-patches; then
error_msg "Error applying patches"
exit 1
echo "Finished extraction"
cd src
if ! sage-apply-patches; then
error_msg "Error applying patches"
exit 1
fi
cd ..
else
# Script package: Build out of the source tree without copying
cd "$PKG_SCRIPTS"
fi
cd ..

##################################################################
# The package has been extracted, prepare for installation
Expand Down Expand Up @@ -539,14 +517,7 @@ for script in $WRAPPED_SCRIPTS; do
script="spkg-$script"

if [ -f "$script.in" ]; then
if [ "$USE_LOCAL_SCRIPTS" = "yes" ]; then
write_script_wrapper "$(pwd)/$script" "$script_dir"
else
if [ ! -x "$script" ]; then
echo >&2 "WARNING: $script is not executable, making it executable"
chmod +x "$script"
fi
fi
write_script_wrapper "$(pwd)/$script" "$script_dir"
fi
done

Expand Down

0 comments on commit 46e5f68

Please sign in to comment.