From dfa672544bb71b34c8e719028764a74167179324 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 20 Nov 2021 22:27:34 -0800 Subject: [PATCH 1/4] configure.ac, m4/: Eliminate use of variable SAGE_SPKG_INST --- configure.ac | 4 +--- m4/sage_spkg_collect.m4 | 6 +++--- m4/sage_spkg_configure.m4 | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 699d2aaaaf1..351f48752cd 100644 --- a/configure.ac +++ b/configure.ac @@ -89,7 +89,6 @@ else SAGE_VENV_AUTO=no fi SAGE_SRC="$SAGE_ROOT/src" -SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed" AC_ARG_WITH([sage-venv], [AS_HELP_STRING([--with-sage-venv={auto (default),yes,no,SAGE_VENV}], @@ -488,7 +487,7 @@ AC_CONFIG_COMMANDS(mkdirs, "$SAGE_LOCAL/bin" "$SAGE_LOCAL/etc" \ "$SAGE_LOCAL/include" "$SAGE_LOCAL/lib" \ "$SAGE_LOCAL/lib/pkgconfig" \ - "$SAGE_SHARE" "$SAGE_INST"; do + "$SAGE_SHARE" "$SAGE_LOCAL/var/lib/sage/installed"; do AC_MSG_NOTICE([creating directory $d]) mkdir -p "$d" || AC_MSG_ERROR(could not create $d) done @@ -507,7 +506,6 @@ AC_CONFIG_COMMANDS(mkdirs, SAGE_LOGS="$SAGE_ROOT/logs/pkgs" SAGE_LOCAL="$SAGE_LOCAL" SAGE_SHARE="$SAGE_LOCAL/share" - SAGE_INST="$SAGE_SPKG_INST" ]) AC_CONFIG_COMMANDS(links, [ diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index 90f10986f78..6b15909eda3 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -230,12 +230,12 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do in_sdist=no uninstall_message=", use \"$srcdir/configure --disable-$SPKG_NAME\" to uninstall" stampfile="" - for f in "$SAGE_SPKG_INST/$SPKG_NAME"-*; do + for f in "$SAGE_LOCAL/var/lib/sage/installed/$SPKG_NAME"-*; do AS_IF([test -r "$f"], [ AS_IF([test -n "$stampfile"], [ AC_MSG_ERROR(m4_normalize([ multiple installation records for $SPKG_NAME: - m4_newline($(ls -l "$SAGE_SPKG_INST/$SPKG_NAME"-*)) + m4_newline($(ls -l "$SAGE_LOCAL/var/lib/sage/installed/$SPKG_NAME"-*)) m4_newline([only one should exist, so please delete some or all of these files and re-run "$srcdir/configure"]) ])) @@ -309,7 +309,7 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do # Determine whether package is enabled AS_VAR_SET([is_installed], [no]) - for f in "$SAGE_SPKG_INST/${SPKG_NAME}"-*; do + for f in "${SAGE_LOCAL}/var/lib/sage/installed/${SPKG_NAME}"-*; do AS_IF([test -r "$f"], [AS_VAR_SET([is_installed], [yes])]) done diff --git a/m4/sage_spkg_configure.m4 b/m4/sage_spkg_configure.m4 index e6aa0f3ca72..a0eeaa53a74 100644 --- a/m4/sage_spkg_configure.m4 +++ b/m4/sage_spkg_configure.m4 @@ -85,7 +85,7 @@ $4 dnl If a version of this package is already installed in local/ we have no dnl choice but to use it and we will actually also update it even if it is not dnl required. -AS_IF([test -n "`ls "${SAGE_SPKG_INST}/${sage_spkg_name}"-* 2>/dev/null`"], [ +AS_IF([test -n "`ls "${SAGE_LOCAL}/var/lib/sage/installed/${sage_spkg_name}"-* 2>/dev/null`"], [ AC_MSG_NOTICE(m4_normalize(SPKG_NAME[ has already been installed by SageMath])) AS_VAR_SET(SPKG_INSTALL, [yes]) AS_VAR_SET(SPKG_USE_SYSTEM, [installed]) From 493f855f4f00e6d516b7d988290c59a81b5abb6f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 22 Nov 2021 23:16:25 -0800 Subject: [PATCH 2/4] m4/sage_spkg_collect.m4: Check installation record in SAGE_VENV for packages installed there --- m4/sage_spkg_collect.m4 | 44 ++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index 6b15909eda3..a2886da6d6b 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -192,6 +192,30 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do fi SAGE_PACKAGE_TREES="${SAGE_PACKAGE_TREES}$(printf '\ntrees_')${SPKG_NAME} = ${SPKG_TREE_VAR}" + dnl Determine whether it is installed already + AS_VAR_SET([is_installed], [no]) + for treevar in ${SPKG_TREE_VAR} SAGE_LOCAL; do + AS_VAR_COPY([t], [$treevar]) + AS_IF([test -n "$t" -a -d "$t/var/lib/sage/installed/" ], [ + for f in "$t/var/lib/sage/installed/$SPKG_NAME"-*; do + AS_IF([test -r "$f"], [ + AS_IF([test "$is_installed" = "yes"], [ + AC_MSG_ERROR(m4_normalize([ + multiple installation records for $SPKG_NAME: + m4_newline($(ls -l "$t/var/lib/sage/installed/$SPKG_NAME"-*)) + m4_newline([only one should exist, so please delete some or all + of these files and re-run "$srcdir/configure"]) + ])) + ]) + AS_VAR_SET([is_installed], [yes]) + ]) + done + dnl Only check the first existing tree, so that we do not issue "multiple installation" warnings + dnl when SAGE_LOCAL = SAGE_VENV + break + ]) + done + uninstall_message="" SAGE_NEED_SYSTEM_PACKAGES_VAR=SAGE_NEED_SYSTEM_PACKAGES # Check consistency of 'DIR/type' file @@ -229,20 +253,6 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do optional|experimental) in_sdist=no uninstall_message=", use \"$srcdir/configure --disable-$SPKG_NAME\" to uninstall" - stampfile="" - for f in "$SAGE_LOCAL/var/lib/sage/installed/$SPKG_NAME"-*; do - AS_IF([test -r "$f"], [ - AS_IF([test -n "$stampfile"], [ - AC_MSG_ERROR(m4_normalize([ - multiple installation records for $SPKG_NAME: - m4_newline($(ls -l "$SAGE_LOCAL/var/lib/sage/installed/$SPKG_NAME"-*)) - m4_newline([only one should exist, so please delete some or all - of these files and re-run "$srcdir/configure"]) - ])) - ]) - stampfile=yes - ]) - done ;; esac @@ -308,12 +318,6 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do fi # Determine whether package is enabled - AS_VAR_SET([is_installed], [no]) - for f in "${SAGE_LOCAL}/var/lib/sage/installed/${SPKG_NAME}"-*; do - AS_IF([test -r "$f"], - [AS_VAR_SET([is_installed], [yes])]) - done - AS_VAR_IF([SAGE_ENABLE_${SPKG_NAME}}], [if_installed], [AS_VAR_SET([SAGE_ENABLE_${SPKG_NAME}], $is_installed)]) AS_VAR_COPY([want_spkg], [SAGE_ENABLE_${SPKG_NAME}]) From ba42f8c02df2a59d675da46edd532f11164d21aa Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 22 Nov 2021 23:55:25 -0800 Subject: [PATCH 3/4] m4/sage_spkg_collect.m4: No multiple installation record check for script packages --- m4/sage_spkg_collect.m4 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index a2886da6d6b..4633dc4b233 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -199,13 +199,17 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do AS_IF([test -n "$t" -a -d "$t/var/lib/sage/installed/" ], [ for f in "$t/var/lib/sage/installed/$SPKG_NAME"-*; do AS_IF([test -r "$f"], [ - AS_IF([test "$is_installed" = "yes"], [ - AC_MSG_ERROR(m4_normalize([ - multiple installation records for $SPKG_NAME: - m4_newline($(ls -l "$t/var/lib/sage/installed/$SPKG_NAME"-*)) - m4_newline([only one should exist, so please delete some or all - of these files and re-run "$srcdir/configure"]) - ])) + AS_VAR_IF([SPKG_SOURCE], [normal], [ + dnl Only run the multiple installation record test for normal packages, + dnl not for script packages. We actually do not clean up after those... + AS_IF([test "$is_installed" = "yes"], [ + AC_MSG_ERROR(m4_normalize([ + multiple installation records for $SPKG_NAME: + m4_newline($(ls -l "$t/var/lib/sage/installed/$SPKG_NAME"-*)) + m4_newline([only one should exist, so please delete some or all + of these files and re-run "$srcdir/configure"]) + ])) + ]) ]) AS_VAR_SET([is_installed], [yes]) ]) From 9eca9ae7dd39cf5a104a5005dfe406ac958f842d Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Tue, 23 Nov 2021 00:15:48 -0800 Subject: [PATCH 4/4] m4/sage_spkg_collect.m4: Move if_installed logic earlier --- m4/sage_spkg_collect.m4 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/m4/sage_spkg_collect.m4 b/m4/sage_spkg_collect.m4 index 4633dc4b233..09ec6240d1b 100644 --- a/m4/sage_spkg_collect.m4 +++ b/m4/sage_spkg_collect.m4 @@ -220,6 +220,11 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do ]) done + # Determine whether package is enabled + AS_VAR_IF([SAGE_ENABLE_${SPKG_NAME}], [if_installed], + [AS_VAR_SET([SAGE_ENABLE_${SPKG_NAME}], $is_installed)]) + AS_VAR_COPY([want_spkg], [SAGE_ENABLE_${SPKG_NAME}]) + uninstall_message="" SAGE_NEED_SYSTEM_PACKAGES_VAR=SAGE_NEED_SYSTEM_PACKAGES # Check consistency of 'DIR/type' file @@ -321,11 +326,6 @@ for DIR in $SAGE_ROOT/build/pkgs/*; do SAGE_SDIST_PACKAGES="${SAGE_SDIST_PACKAGES} \\$(printf '\n ')${SPKG_NAME}" fi - # Determine whether package is enabled - AS_VAR_IF([SAGE_ENABLE_${SPKG_NAME}}], [if_installed], - [AS_VAR_SET([SAGE_ENABLE_${SPKG_NAME}], $is_installed)]) - AS_VAR_COPY([want_spkg], [SAGE_ENABLE_${SPKG_NAME}]) - spkg_line=" \\$(printf '\n ')$SPKG_NAME" AS_CASE([$is_installed-$want_spkg], [*-yes], [AS_VAR_APPEND(SAGE_OPTIONAL_INSTALLED_PACKAGES, "$spkg_line")],