Skip to content

Commit

Permalink
make SPKG-check for normal/wheel/script packages via sage-spkg
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jan 22, 2024
1 parent 3dd953c commit 9652a6e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 22 deletions.
16 changes: 10 additions & 6 deletions build/bin/sage-spkg
Original file line number Diff line number Diff line change
Expand Up @@ -788,8 +788,6 @@ run_test_suite() { ###############################################
# SAGE_INST_LOCAL. It might make more sense to run the tests before, but the
# spkg-check scripts were written before use of DESTDIR installs, and so
# fail in many cases. This might be good to change later.

if [ "$SAGE_CHECK" = "yes" -o "$SAGE_CHECK" = "warn" ]; then
if [ -f spkg-check ]; then
echo "Running the test suite for $PKG_NAME..."
time ./spkg-check
Expand All @@ -807,11 +805,13 @@ if [ "$SAGE_CHECK" = "yes" -o "$SAGE_CHECK" = "warn" ]; then
TEST_SUITE_RESULT="passed"
echo "Passed the test suite for $PKG_NAME."
fi
elif [ -f spkg-check.in ]; then
echo "The test suite for $PKG_NAME requires the temporary build directory."
exit 1
else
echo "Package $PKG_NAME has no test suite."
TEST_SUITE_RESULT="not available"
fi
fi
} ################################################# run_test_suite

write_installation_record() { ####################################
Expand Down Expand Up @@ -889,17 +889,21 @@ if [ $INSTALL = 1 ]; then
extract_the_package
prepare_for_installation
actually_build_and_install
else
cd "$SAGE_BUILD_DIR/$PKG_NAME" || exit $?
fi

if [ $POST_INSTALL = 1 ]; then
cd "$SAGE_BUILD_DIR/$PKG_NAME" || exit $?
unload_destdir
install_scripts
post_install
fi

run_test_suite
if [ "$SAGE_CHECK" = "yes" -o "$SAGE_CHECK" = "warn" ]; then
if ! cd "$SAGE_BUILD_DIR/$PKG_NAME" 2>/dev/null; then
cd "$PKG_SCRIPTS" || exit $?
fi
run_test_suite
fi

if [ $POST_INSTALL = 1 ]; then
write_installation_record
Expand Down
22 changes: 6 additions & 16 deletions build/make/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,11 @@ $(1)-$(4)-no-deps:

$(1)-no-deps: $(1)-$(4)-no-deps

$(1)-$(4)-check:
$(PLUS)@sage-logger -p 'PATH=$$(SAGE_SRC)/bin:$$($(4))/bin:$$$$PATH $$(SAGE_SPKG) --check-only $(1)-$(2) $$($(4))' '$$(SAGE_LOGS)/$(1)-$(2).log'

$(1)-check: $(1)-$(4)-check

$(1)-$(4)-uninstall:
if [ -d '$$($(4))' ]; then \
sage-spkg-uninstall $(if $(filter $(1),$(TOOLCHAIN_DEPS)),--keep-files) \
Expand Down Expand Up @@ -760,22 +765,7 @@ $(1)-$(4)-no-deps:
$(1)-no-deps: $(1)-$(4)-no-deps

$(1)-$(4)-check:
$(PLUS)@if [ -x $$(SAGE_ROOT)/build/pkgs/$(1)/spkg-check ]; then \
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' && \
PKG_BASE="$(1)" \
PKG_VER="$(2)" \
PKG_NAME="$(1)-$(2)" \
SAGE_SPKG_WHEELS=$$($(4))/var/lib/sage/wheels \
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-check' '$$(SAGE_LOGS)/$(1)-$(2).log'; \
fi
$(PLUS)@sage-logger -p 'PATH=$$(SAGE_SRC)/bin:$$($(4))/bin:$$$$PATH $$(SAGE_SPKG) --check-only $(1)-$(2) $$($(4))' '$$(SAGE_LOGS)/$(1)-$(2).log'

$(1)-check: $(1)-$(4)-check

Expand Down

0 comments on commit 9652a6e

Please sign in to comment.