From a6459cb69f705101f66ee8adb7ca1b543c6fc291 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 24 Sep 2020 13:57:34 -0700 Subject: [PATCH 01/13] build/bin/sage-spkg: For script packages, do not poison the proxy variables --- build/bin/sage-spkg | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index b540c8e866f..e40e5434872 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -578,11 +578,14 @@ echo "****************************************************" ################################################################## # Poison the proxy variable to forbid downloads in spkg-install +# for normal packages ################################################################## -export http_proxy=http://192.0.2.0:5187/ -export https_proxy=$http_proxy -export ftp_proxy=$http_proxy -export rsync_proxy=$http_proxy +if [ -f checksums.ini ]; then + export http_proxy=http://192.0.2.0:5187/ + export https_proxy=$http_proxy + export ftp_proxy=$http_proxy + export rsync_proxy=$http_proxy +fi ################################################################## # We need to run sage-rebase.sh for each package installed, but it From c207a876f2904708d5a56bd35ef5e32300c84d81 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 24 Sep 2020 15:30:56 -0700 Subject: [PATCH 02/13] build/bin/sage-spkg: Exit with error for some old-style script invocations --- build/bin/sage-spkg | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index e40e5434872..dbc27e5d5c9 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -302,6 +302,10 @@ export SAGE_SPKG_WHEELS="$SAGE_INST_LOCAL/var/lib/sage/wheels" # 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" @@ -349,25 +353,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 From d9475906561f0ad9d8c3d96f029763a3887917e8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 24 Sep 2020 15:32:09 -0700 Subject: [PATCH 03/13] build/bin/sage-spkg: Remove error message when checksums.ini does not exist (script package) --- build/bin/sage-spkg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index dbc27e5d5c9..813a0d4b11d 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -315,7 +315,10 @@ else PKG_NAME="${PKG_BASE}-${PKG_VER}" fi 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/"` +if [ -f "$PKG_SCRIPTS/checksums.ini" ]; then + # Normal package + PKG_NAME_UPSTREAM=`lookup_param tarball "$PKG_SCRIPTS/checksums.ini" | sed "s/VERSION/$PKG_BASE_VER/"` +fi # Warning for experimental packages if [ x`cat "$PKG_SCRIPTS/type"` = x"experimental" -a $INFO = 0 ]; then From 699c23acb25918d3017f240a1da9286f0136ee04 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Nov 2023 20:01:51 -0800 Subject: [PATCH 04/13] build/bin/sage-spkg: Fix up for normal and script packages --- build/bin/sage-spkg | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index 813a0d4b11d..04621d61dc1 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -302,13 +302,13 @@ export SAGE_SPKG_WHEELS="$SAGE_INST_LOCAL/var/lib/sage/wheels" # 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" +if [ -n "$PKG_VER" -a "$PKG_VER" != "$LOCAL_PKG_VER" ]; then + echo >&2 "Error: Selecting a different version of a package is no longer supported" + exit 1 +fi if [ -z "$PKG_VER" ]; then PKG_NAME="${PKG_BASE}" else @@ -362,15 +362,15 @@ if [ -n "$PKG_NAME_UPSTREAM" ]; then error_msg "Error downloading $PKG_NAME_UPSTREAM" exit 1 fi -fi -PKG_SRC="$SAGE_DISTFILES/$PKG_NAME_UPSTREAM" + PKG_SRC="$SAGE_DISTFILES/$PKG_NAME_UPSTREAM" -# Do a final check that PKG_SRC is a file with an absolute path -cd / -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 + # 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." + echo >&2 "This shouldn't happen, it is a bug in the sage-spkg script." + exit 1 + fi fi # Go back to SAGE_ROOT where we have less chance of completely messing @@ -453,6 +453,9 @@ cp -RLp "$PKG_SCRIPTS" "$PKG_NAME" cd "$PKG_NAME" || exit $? case "$PKG_SRC" in + "") + # Not a normal or wheel package + ;; *.whl) # (Platform-independent) wheel # Do not extract, do not create a src directory, @@ -581,7 +584,8 @@ echo "****************************************************" # Poison the proxy variable to forbid downloads in spkg-install # for normal packages ################################################################## -if [ -f checksums.ini ]; then +if [ -n "$PKG_NAME_UPSTREAM" ]; then + # Normal package export http_proxy=http://192.0.2.0:5187/ export https_proxy=$http_proxy export ftp_proxy=$http_proxy From 6be9ba045dd2654cb32c82c836425fce3b0f9af8 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 24 Sep 2020 16:17:08 -0700 Subject: [PATCH 05/13] build/bin/sage-spkg: Handle script packages without package-version.txt --- build/bin/sage-spkg | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index 04621d61dc1..081a500d63b 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -297,13 +297,11 @@ export SAGE_SPKG_SCRIPTS="$SAGE_INST_LOCAL/var/lib/sage/scripts" export SAGE_SPKG_WHEELS="$SAGE_INST_LOCAL/var/lib/sage/wheels" # 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 -# in upstream. +# VERSION, if provided, must match the version in build/pkgs. PKG_VER="${PKG_NAME#${PKG_BASE}}" PKG_VER="${PKG_VER#-}" PKG_SCRIPTS="$SAGE_ROOT/build/pkgs/$PKG_BASE" -LOCAL_PKG_VER=`cat $PKG_SCRIPTS/package-version.txt 2>/dev/null` +LOCAL_PKG_VER=`cat $PKG_SCRIPTS/package-version.txt 2>/dev/null || echo none` PKG_VER="$LOCAL_PKG_VER" if [ -n "$PKG_VER" -a "$PKG_VER" != "$LOCAL_PKG_VER" ]; then echo >&2 "Error: Selecting a different version of a package is no longer supported" From c69a62bf9978fedd6ba950e1d805a261a7df48de Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Nov 2023 20:54:13 -0800 Subject: [PATCH 06/13] m4/sage_spkg_collect.m4: Update documentation on package source types --- m4/sage_spkg_collect.m4 | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index d52dc6205ee..0ceb34a76eb 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -38,18 +38,15 @@ # of which is the names of the dependencies of as read # from the build//dependencies file. # -# - SAGE_NORMAL_PACKAGES - lists the names of packages that are installed -# by the "normal" method (using the sage-spkg program to download and -# extract the source tarball, and run the relevant scripts from -# build//spkg-*. +# - SAGE_NORMAL_PACKAGES - lists the names of packages that are of source type +# "normal" or "wheel". # -# - SAGE_PIP_PACKAGES - lists the names of packages with the "pip" type +# - SAGE_PIP_PACKAGES - lists the names of packages with the "pip" source type, # which are installed by directly invoking the pip command. # # - SAGE_SCRIPT_PACKAGES - lists the names of packages with the "script" -# type which are installed by running a custom script, which may -# download additional source files. -# +# source type, which are installed by running a custom script, which may +# download additional source files, and the "dummy" source type. dnl ========================================================================== dnl define PKG_CHECK_VAR for old pkg-config < 0.28; see Trac #29001 From e833622b61bacc8b3f1703f520338bb17b2f199a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Nov 2023 22:22:46 -0800 Subject: [PATCH 07/13] build/bin/sage-spkg: More WIP for script packages --- build/bin/sage-spkg | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index 081a500d63b..121efa4f057 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -314,7 +314,7 @@ else fi PKG_BASE_VER=`echo $PKG_VER | sed 's/\.p[0-9][0-9]*$//'` if [ -f "$PKG_SCRIPTS/checksums.ini" ]; then - # Normal package + # Normal/wheel package PKG_NAME_UPSTREAM=`lookup_param tarball "$PKG_SCRIPTS/checksums.ini" | sed "s/VERSION/$PKG_BASE_VER/"` fi @@ -355,7 +355,7 @@ if [ $INFO -ne 0 ]; then fi if [ -n "$PKG_NAME_UPSTREAM" ]; then - # Normal package + # Normal or wheel package if ! sage-download-file $SAGE_DOWNLOAD_FILE_OPTIONS "$PKG_NAME_UPSTREAM"; then error_msg "Error downloading $PKG_NAME_UPSTREAM" exit 1 @@ -377,7 +377,7 @@ cd "$SAGE_ROOT" || exit $? # If SAGE_SPKG_COPY_UPSTREAM is set, it should be the name of a directory # to which all upstream files are copied. This is used in sage-sdist. -if [ -n "$SAGE_SPKG_COPY_UPSTREAM" ]; then +if [ -n "$SAGE_SPKG_COPY_UPSTREAM" -a -n "$PKG_NAME_UPSTREAM" ]; then mkdir -p "$SAGE_SPKG_COPY_UPSTREAM" && cp -p "$PKG_SRC" "$SAGE_SPKG_COPY_UPSTREAM" if [ $? -ne 0 ]; then error_msg "Error copying upstream tarball to directory '$SAGE_SPKG_COPY_UPSTREAM'" @@ -447,13 +447,26 @@ fi ################################################################## echo "Setting up build directory for $PKG_NAME" -cp -RLp "$PKG_SCRIPTS" "$PKG_NAME" -cd "$PKG_NAME" || exit $? - -case "$PKG_SRC" in - "") - # Not a normal or wheel package - ;; +if [ -z "$PKG_NAME_UPSTREAM" ]; then + # Not a normal or wheel package. + # Transplant the 'src' symlink, copy scripts. + mkdir -p "$PKG_NAME" + if [ -d "$PKG_SCRIPTS"/src ]; then + ln -s $(cd "$PKG_SCRIPTS"/src && pwd -P) "$PKG_NAME"/src + fi + for a in build install check preinst postinst; do # replace by use of $WRAPPED_SCRIPTS later + if [ -r "$PKG_SCRIPTS"/spkg-$a.in ]; then + cp "$PKG_SCRIPTS"/spkg-$a.in "$PKG_NAME"/ + elif [ -x "$PKG_SCRIPTS"/spkg-$a ]; then + cp "$PKG_SCRIPTS"/spkg-$a "$PKG_NAME"/ + fi + done + cd "$PKG_NAME" || exit $? +else + # Normal or wheel package, copy whole directory, resolving symlinks + cp -RLp "$PKG_SCRIPTS" "$PKG_NAME" + cd "$PKG_NAME" || exit $? + case "$PKG_SRC" in *.whl) # (Platform-independent) wheel # Do not extract, do not create a src directory, @@ -477,7 +490,8 @@ case "$PKG_SRC" in fi cd .. ;; -esac + esac +fi ################################################################## # The package has been extracted, prepare for installation @@ -583,7 +597,7 @@ echo "****************************************************" # for normal packages ################################################################## if [ -n "$PKG_NAME_UPSTREAM" ]; then - # Normal package + # Normal/wheel package export http_proxy=http://192.0.2.0:5187/ export https_proxy=$http_proxy export ftp_proxy=$http_proxy From 89b2012e7ab8ddbca16e12a408bd72323b4044b3 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Nov 2023 22:40:03 -0800 Subject: [PATCH 08/13] build/pkgs/sage*: Use spkg-install.in instead of spkg-install --- build/pkgs/sage_conf/spkg-install | 20 ------------- build/pkgs/sage_conf/spkg-install.in | 9 ++++++ build/pkgs/sage_docbuild/spkg-install | 20 ------------- build/pkgs/sage_docbuild/spkg-install.in | 9 ++++++ build/pkgs/sage_setup/spkg-install | 20 ------------- build/pkgs/sage_setup/spkg-install.in | 9 ++++++ build/pkgs/sage_sws2rst/spkg-install | 20 ------------- build/pkgs/sage_sws2rst/spkg-install.in | 9 ++++++ .../sagelib/{spkg-install => spkg-install.in} | 12 -------- .../{spkg-install => spkg-install.in} | 11 ------- build/pkgs/sagemath_categories/spkg-install | 1 - .../pkgs/sagemath_categories/spkg-install.in | 1 + .../spkg-install.in} | 11 ------- build/pkgs/sagemath_environment/spkg-install | 1 - .../pkgs/sagemath_environment/spkg-install.in | 1 + .../spkg-install.in} | 11 ------- .../spkg-install.in} | 11 ------- .../{spkg-install => spkg-install.in} | 11 ------- build/pkgs/sagemath_repl/spkg-install | 1 - build/pkgs/sagemath_repl/spkg-install.in | 1 + build/pkgs/sagemath_sirocco/spkg-install | 29 ------------------- build/pkgs/sagemath_sirocco/spkg-install.in | 18 ++++++++++++ build/pkgs/sagemath_tdlib/spkg-install | 29 ------------------- build/pkgs/sagemath_tdlib/spkg-install.in | 18 ++++++++++++ 24 files changed, 75 insertions(+), 208 deletions(-) delete mode 100755 build/pkgs/sage_conf/spkg-install create mode 100644 build/pkgs/sage_conf/spkg-install.in delete mode 100755 build/pkgs/sage_docbuild/spkg-install create mode 100644 build/pkgs/sage_docbuild/spkg-install.in delete mode 100755 build/pkgs/sage_setup/spkg-install create mode 100644 build/pkgs/sage_setup/spkg-install.in delete mode 100755 build/pkgs/sage_sws2rst/spkg-install create mode 100644 build/pkgs/sage_sws2rst/spkg-install.in rename build/pkgs/sagelib/{spkg-install => spkg-install.in} (91%) mode change 100755 => 100644 rename build/pkgs/sagemath_bliss/{spkg-install => spkg-install.in} (59%) mode change 100755 => 100644 delete mode 120000 build/pkgs/sagemath_categories/spkg-install create mode 120000 build/pkgs/sagemath_categories/spkg-install.in rename build/pkgs/{sagemath_mcqd/spkg-install => sagemath_coxeter3/spkg-install.in} (59%) mode change 100755 => 100644 delete mode 120000 build/pkgs/sagemath_environment/spkg-install create mode 120000 build/pkgs/sagemath_environment/spkg-install.in rename build/pkgs/{sagemath_meataxe/spkg-install => sagemath_mcqd/spkg-install.in} (59%) mode change 100755 => 100644 rename build/pkgs/{sagemath_coxeter3/spkg-install => sagemath_meataxe/spkg-install.in} (59%) mode change 100755 => 100644 rename build/pkgs/sagemath_objects/{spkg-install => spkg-install.in} (59%) mode change 100755 => 100644 delete mode 120000 build/pkgs/sagemath_repl/spkg-install create mode 120000 build/pkgs/sagemath_repl/spkg-install.in delete mode 100755 build/pkgs/sagemath_sirocco/spkg-install create mode 100644 build/pkgs/sagemath_sirocco/spkg-install.in delete mode 100755 build/pkgs/sagemath_tdlib/spkg-install create mode 100644 build/pkgs/sagemath_tdlib/spkg-install.in diff --git a/build/pkgs/sage_conf/spkg-install b/build/pkgs/sage_conf/spkg-install deleted file mode 100755 index a180fb36542..00000000000 --- a/build/pkgs/sage_conf/spkg-install +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src -if [ "$SAGE_EDITABLE" = yes ]; then - sdh_pip_editable_install . - if [ "$SAGE_WHEELS" = yes ]; then - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - sdh_pip_install . -fi diff --git a/build/pkgs/sage_conf/spkg-install.in b/build/pkgs/sage_conf/spkg-install.in new file mode 100644 index 00000000000..4479c541b1c --- /dev/null +++ b/build/pkgs/sage_conf/spkg-install.in @@ -0,0 +1,9 @@ +cd src +if [ "$SAGE_EDITABLE" = yes ]; then + sdh_pip_editable_install . + if [ "$SAGE_WHEELS" = yes ]; then + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + sdh_pip_install . +fi diff --git a/build/pkgs/sage_docbuild/spkg-install b/build/pkgs/sage_docbuild/spkg-install deleted file mode 100755 index cce58b40e22..00000000000 --- a/build/pkgs/sage_docbuild/spkg-install +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src -if [ "$SAGE_EDITABLE" = yes ]; then - sdh_pip_editable_install . - if [ "$SAGE_WHEELS" = yes ]; then - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - sdh_pip_install . -fi diff --git a/build/pkgs/sage_docbuild/spkg-install.in b/build/pkgs/sage_docbuild/spkg-install.in new file mode 100644 index 00000000000..4479c541b1c --- /dev/null +++ b/build/pkgs/sage_docbuild/spkg-install.in @@ -0,0 +1,9 @@ +cd src +if [ "$SAGE_EDITABLE" = yes ]; then + sdh_pip_editable_install . + if [ "$SAGE_WHEELS" = yes ]; then + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + sdh_pip_install . +fi diff --git a/build/pkgs/sage_setup/spkg-install b/build/pkgs/sage_setup/spkg-install deleted file mode 100755 index cce58b40e22..00000000000 --- a/build/pkgs/sage_setup/spkg-install +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src -if [ "$SAGE_EDITABLE" = yes ]; then - sdh_pip_editable_install . - if [ "$SAGE_WHEELS" = yes ]; then - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - sdh_pip_install . -fi diff --git a/build/pkgs/sage_setup/spkg-install.in b/build/pkgs/sage_setup/spkg-install.in new file mode 100644 index 00000000000..4479c541b1c --- /dev/null +++ b/build/pkgs/sage_setup/spkg-install.in @@ -0,0 +1,9 @@ +cd src +if [ "$SAGE_EDITABLE" = yes ]; then + sdh_pip_editable_install . + if [ "$SAGE_WHEELS" = yes ]; then + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + sdh_pip_install . +fi diff --git a/build/pkgs/sage_sws2rst/spkg-install b/build/pkgs/sage_sws2rst/spkg-install deleted file mode 100755 index a180fb36542..00000000000 --- a/build/pkgs/sage_sws2rst/spkg-install +++ /dev/null @@ -1,20 +0,0 @@ -#! /usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src -if [ "$SAGE_EDITABLE" = yes ]; then - sdh_pip_editable_install . - if [ "$SAGE_WHEELS" = yes ]; then - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - sdh_pip_install . -fi diff --git a/build/pkgs/sage_sws2rst/spkg-install.in b/build/pkgs/sage_sws2rst/spkg-install.in new file mode 100644 index 00000000000..4479c541b1c --- /dev/null +++ b/build/pkgs/sage_sws2rst/spkg-install.in @@ -0,0 +1,9 @@ +cd src +if [ "$SAGE_EDITABLE" = yes ]; then + sdh_pip_editable_install . + if [ "$SAGE_WHEELS" = yes ]; then + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + sdh_pip_install . +fi diff --git a/build/pkgs/sagelib/spkg-install b/build/pkgs/sagelib/spkg-install.in old mode 100755 new mode 100644 similarity index 91% rename from build/pkgs/sagelib/spkg-install rename to build/pkgs/sagelib/spkg-install.in index 730829b3101..7ddfda29b05 --- a/build/pkgs/sagelib/spkg-install +++ b/build/pkgs/sagelib/spkg-install.in @@ -1,15 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi - if [ "$SAGE_EDITABLE" = yes ]; then cd "$SAGE_SRC" else diff --git a/build/pkgs/sagemath_bliss/spkg-install b/build/pkgs/sagemath_bliss/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_bliss/spkg-install rename to build/pkgs/sagemath_bliss/spkg-install.in index 7ce202f09ae..ccd53947ab0 --- a/build/pkgs/sagemath_bliss/spkg-install +++ b/build/pkgs/sagemath_bliss/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_categories/spkg-install b/build/pkgs/sagemath_categories/spkg-install deleted file mode 120000 index e60fac9ffa1..00000000000 --- a/build/pkgs/sagemath_categories/spkg-install +++ /dev/null @@ -1 +0,0 @@ -../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_categories/spkg-install.in b/build/pkgs/sagemath_categories/spkg-install.in new file mode 120000 index 00000000000..d83cc631c9a --- /dev/null +++ b/build/pkgs/sagemath_categories/spkg-install.in @@ -0,0 +1 @@ +../sagemath_objects/spkg-install.in \ No newline at end of file diff --git a/build/pkgs/sagemath_mcqd/spkg-install b/build/pkgs/sagemath_coxeter3/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_mcqd/spkg-install rename to build/pkgs/sagemath_coxeter3/spkg-install.in index 7ce202f09ae..ccd53947ab0 --- a/build/pkgs/sagemath_mcqd/spkg-install +++ b/build/pkgs/sagemath_coxeter3/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_environment/spkg-install b/build/pkgs/sagemath_environment/spkg-install deleted file mode 120000 index e60fac9ffa1..00000000000 --- a/build/pkgs/sagemath_environment/spkg-install +++ /dev/null @@ -1 +0,0 @@ -../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_environment/spkg-install.in b/build/pkgs/sagemath_environment/spkg-install.in new file mode 120000 index 00000000000..d83cc631c9a --- /dev/null +++ b/build/pkgs/sagemath_environment/spkg-install.in @@ -0,0 +1 @@ +../sagemath_objects/spkg-install.in \ No newline at end of file diff --git a/build/pkgs/sagemath_meataxe/spkg-install b/build/pkgs/sagemath_mcqd/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_meataxe/spkg-install rename to build/pkgs/sagemath_mcqd/spkg-install.in index 7ce202f09ae..ccd53947ab0 --- a/build/pkgs/sagemath_meataxe/spkg-install +++ b/build/pkgs/sagemath_mcqd/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_coxeter3/spkg-install b/build/pkgs/sagemath_meataxe/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_coxeter3/spkg-install rename to build/pkgs/sagemath_meataxe/spkg-install.in index 7ce202f09ae..ccd53947ab0 --- a/build/pkgs/sagemath_coxeter3/spkg-install +++ b/build/pkgs/sagemath_meataxe/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_objects/spkg-install b/build/pkgs/sagemath_objects/spkg-install.in old mode 100755 new mode 100644 similarity index 59% rename from build/pkgs/sagemath_objects/spkg-install rename to build/pkgs/sagemath_objects/spkg-install.in index 18ceb18724d..62cb1b73b22 --- a/build/pkgs/sagemath_objects/spkg-install +++ b/build/pkgs/sagemath_objects/spkg-install.in @@ -1,14 +1,3 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi cd src export PIP_NO_INDEX=true diff --git a/build/pkgs/sagemath_repl/spkg-install b/build/pkgs/sagemath_repl/spkg-install deleted file mode 120000 index e60fac9ffa1..00000000000 --- a/build/pkgs/sagemath_repl/spkg-install +++ /dev/null @@ -1 +0,0 @@ -../sagemath_objects/spkg-install \ No newline at end of file diff --git a/build/pkgs/sagemath_repl/spkg-install.in b/build/pkgs/sagemath_repl/spkg-install.in new file mode 120000 index 00000000000..d83cc631c9a --- /dev/null +++ b/build/pkgs/sagemath_repl/spkg-install.in @@ -0,0 +1 @@ +../sagemath_objects/spkg-install.in \ No newline at end of file diff --git a/build/pkgs/sagemath_sirocco/spkg-install b/build/pkgs/sagemath_sirocco/spkg-install deleted file mode 100755 index 7ce202f09ae..00000000000 --- a/build/pkgs/sagemath_sirocco/spkg-install +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src - -export PIP_NO_INDEX=true -export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" - -if [ "$SAGE_EDITABLE" = yes ]; then - # SAGE_ROOT/src/setup.py installs everything, nothing to do... - if [ "$SAGE_WHEELS" = yes ]; then - # ... except we build the wheel if requested - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - if [ "$SAGE_WHEELS" = yes ]; then - # Modularized install via wheels - sdh_pip_install . - # else nothing to do in legacy direct installation. - fi -fi diff --git a/build/pkgs/sagemath_sirocco/spkg-install.in b/build/pkgs/sagemath_sirocco/spkg-install.in new file mode 100644 index 00000000000..ccd53947ab0 --- /dev/null +++ b/build/pkgs/sagemath_sirocco/spkg-install.in @@ -0,0 +1,18 @@ +cd src + +export PIP_NO_INDEX=true +export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" + +if [ "$SAGE_EDITABLE" = yes ]; then + # SAGE_ROOT/src/setup.py installs everything, nothing to do... + if [ "$SAGE_WHEELS" = yes ]; then + # ... except we build the wheel if requested + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + if [ "$SAGE_WHEELS" = yes ]; then + # Modularized install via wheels + sdh_pip_install . + # else nothing to do in legacy direct installation. + fi +fi diff --git a/build/pkgs/sagemath_tdlib/spkg-install b/build/pkgs/sagemath_tdlib/spkg-install deleted file mode 100755 index 7ce202f09ae..00000000000 --- a/build/pkgs/sagemath_tdlib/spkg-install +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env bash -# From sage-spkg. -# For type=script packages, the build rule in build/make/Makefile sources -# sage-env but not sage-dist-helpers. -lib="$SAGE_ROOT/build/bin/sage-dist-helpers" -source "$lib" -if [ $? -ne 0 ]; then - echo >&2 "Error: failed to source $lib" - echo >&2 "Is $SAGE_ROOT the correct SAGE_ROOT?" - exit 1 -fi -cd src - -export PIP_NO_INDEX=true -export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" - -if [ "$SAGE_EDITABLE" = yes ]; then - # SAGE_ROOT/src/setup.py installs everything, nothing to do... - if [ "$SAGE_WHEELS" = yes ]; then - # ... except we build the wheel if requested - sdh_setup_bdist_wheel && sdh_store_wheel . - fi -else - if [ "$SAGE_WHEELS" = yes ]; then - # Modularized install via wheels - sdh_pip_install . - # else nothing to do in legacy direct installation. - fi -fi diff --git a/build/pkgs/sagemath_tdlib/spkg-install.in b/build/pkgs/sagemath_tdlib/spkg-install.in new file mode 100644 index 00000000000..ccd53947ab0 --- /dev/null +++ b/build/pkgs/sagemath_tdlib/spkg-install.in @@ -0,0 +1,18 @@ +cd src + +export PIP_NO_INDEX=true +export PIP_FIND_LINKS="file://$SAGE_SPKG_WHEELS" + +if [ "$SAGE_EDITABLE" = yes ]; then + # SAGE_ROOT/src/setup.py installs everything, nothing to do... + if [ "$SAGE_WHEELS" = yes ]; then + # ... except we build the wheel if requested + sdh_setup_bdist_wheel && sdh_store_wheel . + fi +else + if [ "$SAGE_WHEELS" = yes ]; then + # Modularized install via wheels + sdh_pip_install . + # else nothing to do in legacy direct installation. + fi +fi From 737247bde85c1b4ea35ce2c83d032040361477f7 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Nov 2023 22:55:43 -0800 Subject: [PATCH 09/13] build/bin/sage-spkg: No warnings for experimental script packages --- build/bin/sage-spkg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/bin/sage-spkg b/build/bin/sage-spkg index 121efa4f057..f384bdebbd9 100755 --- a/build/bin/sage-spkg +++ b/build/bin/sage-spkg @@ -320,7 +320,7 @@ fi # Warning for experimental packages if [ x`cat "$PKG_SCRIPTS/type"` = x"experimental" -a $INFO = 0 ]; then - if [ $YES != 1 ]; 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 < Date: Tue, 21 Nov 2023 22:58:29 -0800 Subject: [PATCH 10/13] bootstrap: Script packages can now have spkg-install.in too --- bootstrap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bootstrap b/bootstrap index 6e408265d84..5070b5df44a 100755 --- a/bootstrap +++ b/bootstrap @@ -92,7 +92,7 @@ EOF if test -f "$DIR/requirements.txt"; then SPKG_SOURCE=pip elif test ! -f "$DIR/checksums.ini"; then - if test -f "$DIR/spkg-install"; then + if test -f "$DIR/spkg-install" -o -f "$DIR/spkg-install.in"; then SPKG_SOURCE=script else # a dummy package From b380fc8d8b9c04816c694e1a6f699cbb254b3a55 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 21 Nov 2023 23:07:30 -0800 Subject: [PATCH 11/13] src/doc/en/developer: Update on spkg-install scripts of script packages --- src/doc/en/developer/packaging.rst | 17 +++++++---------- src/doc/en/installation/source.rst | 2 +- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/doc/en/developer/packaging.rst b/src/doc/en/developer/packaging.rst index 9f8bd2528ef..0fd58782264 100644 --- a/src/doc/en/developer/packaging.rst +++ b/src/doc/en/developer/packaging.rst @@ -117,8 +117,8 @@ the following source types: - the file ``package-version.txt`` is optional; - - installing the package runs the installation script ``spkg-install`` - (see :ref:`section-spkg-install`); + - installing the package runs the installation script ``spkg-install`` or + ``spkg-install.in`` (see :ref:`section-spkg-install`); - Sage records the version number of the package installed using a file in ``$SAGE_LOCAL/var/lib/sage/installed/`` and will rerun the installation @@ -134,8 +134,8 @@ the following source types: To summarize: the package source type is determined as follows: if there is a file ``requirements.txt``, it is a ``pip`` package. If not, then if there is a ``checksums.ini`` file, it is ``normal`` or ``wheel``. -Otherwise, if it has an ``spkg-install`` script, it is a ``script`` package, -and if it does not, then it is a ``dummy`` package. +Otherwise, if it has an ``spkg-install`` or ``spkg-install.in`` script, +it is a ``script`` package, and if it does not, then it is a ``dummy`` package. .. _section-directory-structure: @@ -358,13 +358,10 @@ at build time, which should to the appropriate system-specific Install scripts of script packages ---------------------------------- -A script package has a single install script named ``spkg-install``. +For script packages, it is also possible to use an install script named ``spkg-install``. It needs to be an executable shell script; it is not subject to the templating -described in the previous section. - -Sage runs ``spkg-install`` from the directory ``$SAGE_ROOT/build/pkgs/`` -in the environment obtained by sourcing the files ``src/bin/sage-env``, -``build/bin/sage-build-env-config``, and ``build/bin/sage-build-env``. +described in the previous section and will be executed directly from +the build directory. .. _section-sdh-helpers: diff --git a/src/doc/en/installation/source.rst b/src/doc/en/installation/source.rst index b16fd8e7295..6afae82731e 100644 --- a/src/doc/en/installation/source.rst +++ b/src/doc/en/installation/source.rst @@ -1016,7 +1016,7 @@ Environment variables dealing with specific Sage packages: - :envvar:`PARI_CONFIGURE` - use this to pass extra parameters to PARI's ``Configure`` script, for example to specify graphics support (which is disabled by default). See the file - :file:`build/pkgs/pari/spkg-install` for more information. + :file:`build/pkgs/pari/spkg-install.in` for more information. - :envvar:`SAGE_TUNE_PARI` - if yes, enable PARI self-tuning. Note that this can be time-consuming. If you set this variable to "yes", you From e6b3a00a7b1372a5100ab5cfa7242cf86d606f93 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 22 Nov 2023 14:03:00 -0800 Subject: [PATCH 12/13] build/make/Makefile.in: Install and uninstall script packages like normal packages --- build/make/Makefile.in | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/build/make/Makefile.in b/build/make/Makefile.in index 6031ae7fa2a..10a45a8e453 100644 --- a/build/make/Makefile.in +++ b/build/make/Makefile.in @@ -725,7 +725,7 @@ $(1)-$(4)-no-deps: echo "Error: The installation tree $(4) has been disabled" 2>&1; \ echo "$$($(4)_DISABLED_MESSAGE)" 2>&1; \ exit 1; \ - elif [ -x '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' ]; then \ + elif [ -x '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install' -o -r '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install.in' ]; then \ rm -rf '$$($(4))/var/lib/sage/scripts/$(1)'; \ cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \ . '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \ @@ -740,9 +740,9 @@ $(1)-$(4)-no-deps: SAGE_SPKG_SCRIPTS=$$($(4))/var/lib/sage/scripts \ SAGE_INST_LOCAL=$$($(4)) \ SAGE_CHECK=$$(SAGE_CHECK_$(1)) \ - sage-logger -p '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-install && if [ $$$$SAGE_CHECK != no -a -x $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check ]; then $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check; fi' '$$(SAGE_LOGS)/$(1)-$(2).log' && \ - rm -f "$$($(4))/$(SPKG_INST_RELDIR)/$(1)"-* && \ - touch "$$($(4))/$(SPKG_INST_RELDIR)/$(1)-$(2)"; \ + sage-logger -p 'SAGE_CHECK=$$(SAGE_CHECK_$(1)) PATH=$$(SAGE_SRC)/bin:$$($(4))/bin:$$$$PATH $$(SAGE_SPKG) $$(SAGE_SPKG_OPTIONS) \ + $(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-existing) \ + $(1)-$(2) $$($(4))' '$$(SAGE_LOGS)/$(1)-$(2).log'; \ else ( \ echo; \ echo "Note: $(1) is a dummy package that the Sage distribution uses"; \ @@ -781,14 +781,10 @@ $(1)-$(4)-check: $(1)-check: $(1)-$(4)-check $(1)-$(4)-uninstall: - -$(AM_V_at)cd '$$(SAGE_ROOT)/build/pkgs/$(1)' && \ - . '$$(SAGE_ROOT)/src/bin/sage-src-env-config' && \ - . '$$(SAGE_ROOT)/src/bin/sage-env-config' && \ - . '$$(SAGE_ROOT)/src/bin/sage-env' && \ - . '$$(SAGE_ROOT)/build/bin/sage-build-env-config' && \ - . '$$(SAGE_ROOT)/build/bin/sage-build-env' && \ - '$$(SAGE_ROOT)/build/pkgs/$(1)/spkg-uninstall' - -rm -f "$$($(4))/$(SPKG_INST_RELDIR)/$(1)"-* + if [ -d '$$($(4))' ]; then \ + sage-spkg-uninstall $(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-files) \ + $(1) '$$($(4))'; \ + fi $(1)-uninstall: $(1)-$(4)-uninstall From c008841787a4c8f92cd58d59a1eef08c4f4c1ffc Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 22 Nov 2023 14:03:33 -0800 Subject: [PATCH 13/13] build/pkgs/r/spkg-uninstall: Outdated, remove --- build/pkgs/r/spkg-uninstall | 7 ------- 1 file changed, 7 deletions(-) delete mode 100755 build/pkgs/r/spkg-uninstall diff --git a/build/pkgs/r/spkg-uninstall b/build/pkgs/r/spkg-uninstall deleted file mode 100755 index 32892b79a91..00000000000 --- a/build/pkgs/r/spkg-uninstall +++ /dev/null @@ -1,7 +0,0 @@ -#! /usr/bin/env bash -# Remove old install -rm -rf "$SAGE_LOCAL"/lib/r -rm -rf "$SAGE_LOCAL"/lib/R -rm -rf "$SAGE_LOCAL"/lib/R.old -rm -rf "$SAGE_LOCAL"/lib/libRblas.* "$SAGE_LOCAL"/lib/libRlapack.* "$SAGE_LOCAL"/lib/libR.* -rm -f "$SAGE_LOCAL"/bin/R*