Skip to content

Commit 227d488

Browse files
authored
Merge branch 'develop' into ramified_places
2 parents 6426296 + ab24dac commit 227d488

File tree

4,401 files changed

+54666
-46480
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,401 files changed

+54666
-46480
lines changed

.ci/create-changes-html.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ diffParagraphs.forEach(paragraph => {
5151
EOF
5252
echo '</head>' >> CHANGES.html
5353
echo '<body>' >> CHANGES.html
54-
(cd $DOC_REPOSITORY && git diff $BASE_DOC_COMMIT -- *.html) > diff.txt
54+
(cd $DOC_REPOSITORY && git diff $BASE_DOC_COMMIT -- "*.html") > diff.txt
5555
python3 - << EOF
5656
import os, re, html
5757
with open('diff.txt', 'r') as f:
@@ -82,7 +82,7 @@ for block in diff_blocks:
8282
if content:
8383
with open(file_path, 'w') as file:
8484
file.writelines(content)
85-
path = 'html/' + doc
85+
path = doc
8686
hunks = '&nbsp;'.join(f'<a href="{path}#hunk{i+1}" class="hunk" target="_blank">#{i + 1}</a>' for i in range(count))
8787
out_blocks.append(f'<p class="diff"><a href="{path}">{doc}</a>&nbsp;' + hunks + '&emsp;</p>'
8888
+ '\n<pre><code class="language-diff">'

.ci/docker-exec-script.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh -x
2+
if [ $# -lt 3 ]; then
3+
echo >&2 "usage: docker-exec-script.sh CONTAINER WORKDIR [VAR=VALUE...] SCRIPT"
4+
exit 1
5+
fi
6+
CONTAINER=$1
7+
WORKDIR=$2
8+
shift 2
9+
(echo "cd \"$WORKDIR\"";
10+
while [ $# -gt 1 ]; do
11+
echo "export \"$1\""
12+
shift
13+
done;
14+
cat "$1") | docker exec -i $CONTAINER bash -ex

.ci/merge-fixes.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/bin/sh
2-
# Apply open PRs labeled "blocker" from sagemath/sage as patches.
2+
# Apply open PRs labeled "p: CI Fix" from sagemath/sage as patches.
3+
# (policy set by vote in 2024-03,
4+
# https://groups.google.com/g/sage-devel/c/OKwwUGyKveo/m/vpyCXYBqAAAJ)
5+
#
36
# This script is invoked by various workflows in .github/workflows
47
#
58
# The repository variable SAGE_CI_FIXES_FROM_REPOS can be set
@@ -20,15 +23,15 @@ for REPO in ${SAGE_CI_FIXES_FROM_REPOSITORIES:-sagemath/sage}; do
2023
echo "Nothing to do for 'none' in SAGE_CI_FIXES_FROM_REPOSITORIES"
2124
;;
2225
*/*)
23-
echo "Getting open PRs with 'blocker' status from https://github.com/$REPO/pulls?q=is%3Aopen+label%3A%22p%3A+blocker+%2F+1%22"
26+
echo "Getting open PRs with 'p: CI Fix' label from https://github.com/$REPO/pulls?q=is%3Aopen+label%3A%22p%3A+CI+Fix%22"
2427
GH="gh -R $REPO"
2528
REPO_FILE="upstream/ci-fixes-${REPO%%/*}-${REPO##*/}"
26-
PRs="$($GH pr list --label "p: blocker / 1" --json number --jq '.[].number' | tee $REPO_FILE)"
29+
PRs="$($GH pr list --label "p: CI Fix" --json number --jq '.[].number' | tee $REPO_FILE)"
2730
date -u +"%Y-%m-%dT%H:%M:%SZ" > $REPO_FILE.date # Record the date, for future reference
2831
if [ -z "$PRs" ]; then
29-
echo "Nothing to do: Found no open PRs with 'blocker' status in $REPO."
32+
echo "Nothing to do: Found no open PRs with 'p: CI Fix' label in $REPO."
3033
else
31-
echo "Found open PRs with 'blocker' status in $REPO: $(echo $PRs)"
34+
echo "Found open PRs with 'p: CI Fix' label in $REPO: $(echo $PRs)"
3235
git tag -f test_base
3336
git commit -q -m "Uncommitted changes" --no-allow-empty -a
3437
for a in $PRs; do

.ci/retrofit-worktree.sh

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,32 +12,35 @@ export GIT_AUTHOR_EMAIL="[email protected]"
1212
export GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
1313
export GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
1414

15+
set -e
16+
1517
# Set globally for other parts of the workflow
1618
git config --global user.name "$GIT_AUTHOR_NAME"
1719
git config --global user.email "$GIT_AUTHOR_EMAIL"
1820

19-
set -ex
21+
set -x
2022

2123
# If actions/checkout downloaded our source tree using the GitHub REST API
2224
# instead of with git (because do not have git installed in our image),
2325
# we first make the source tree a repo.
24-
if [ ! -d .git ]; then git init && git add -A && git commit --quiet -m "new"; fi
26+
if [ ! -d .git ]; then git init; fi
2527

26-
# Tag this state of the source tree "new". This is what we want to build and test.
28+
# Commit and tag this state of the source tree "new". This is what we want to build and test.
29+
git add -A && git commit --quiet --allow-empty -m "new"
2730
git tag -f new
2831

2932
# Our container image contains a source tree in $WORKTREE_DIRECTORY with a full build of Sage.
3033
# But $WORKTREE_DIRECTORY is not a git repository.
3134
# We make $WORKTREE_DIRECTORY a worktree whose index is at tag "new".
3235
# We then commit the current sources and set the tag "old". (This keeps all mtimes unchanged.)
33-
# Then we update worktree and index with "git reset --hard new".
36+
# Then we update worktree and index with "git checkout new".
3437
# (This keeps mtimes of unchanged files unchanged and mtimes of changed files newer than unchanged files.)
35-
# Finally we reset the index to "old". (This keeps all mtimes unchanged.)
36-
# The changed files now show up as uncommitted changes.
37-
# The final "git add -N" makes sure that files that were added in "new" do not show
38-
# as untracked files, which would be removed by "git clean -fx".
38+
if [ -L $WORKTREE_NAME ]; then
39+
rm -f $WORKTREE_NAME
40+
fi
41+
git worktree prune --verbose
3942
git worktree add --detach $WORKTREE_NAME
4043
rm -rf $WORKTREE_DIRECTORY/.git && mv $WORKTREE_NAME/.git $WORKTREE_DIRECTORY/
4144
rm -rf $WORKTREE_NAME && ln -s $WORKTREE_DIRECTORY $WORKTREE_NAME
4245
if [ ! -f $WORKTREE_NAME/.gitignore ]; then cp .gitignore $WORKTREE_NAME/; fi
43-
(cd $WORKTREE_NAME && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git reset --hard new && git reset --quiet old && git add -N . && git status)
46+
(cd $WORKTREE_NAME && git add -A && git commit --quiet --allow-empty -m "old" -a && git tag -f old && git checkout new && git status)

.ci/set_labels_by_changes.sh

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/usr/bin/env bash
2+
3+
# cd to the PR directory
4+
cd $PR_MOUNT_DIR
5+
PR_BASE_SHA=$(git merge-base $BASE_SHA $PR_HEAD_SHA)
6+
7+
echo "set_labels_by_changes.sh called with environment:"
8+
echo "BASE SHA: $PR_BASE_SHA"
9+
echo "HEAD SHA: $PR_HEAD_SHA"
10+
echo "SMALL THRESHOLD $SMALL_THRESHOLD"
11+
echo "MODERATE THERESHOLD: $MODERATE_THRESHOLD"
12+
echo "LARGE THRESHOLD: $LARGE_THRESHOLD"
13+
14+
# get all the changes made and changed files
15+
CHANGES=$(git diff --ignore-all-space $PR_BASE_SHA $PR_HEAD_SHA)
16+
17+
# ignore blank lines
18+
CHANGES=$(echo "$CHANGES" | grep -vE '^[\+\-]\s*$')
19+
20+
# ignore non necessary lines from git diff
21+
CHANGES=$(echo "$CHANGES" | grep -E '^[+\-]' | grep -vE '^\+\+\+|^\-\-\-')
22+
23+
# count total no of lines
24+
CHANGES=$(echo "$CHANGES" | wc -l)
25+
26+
echo "CHANGES MADE: $CHANGES"
27+
28+
AUTH_HEADER="Authorization: Bearer $GITHUB_TOKEN"
29+
30+
MINIMAL="v: minimal"
31+
SMALL="v: small"
32+
MODERATE="v: moderate"
33+
LARGE="v: large"
34+
35+
DELETE_LABELS=("$MINIMAL" "$SMALL" "$MODERATE" "$LARGE")
36+
37+
if [ "$CHANGES" -gt "$LARGE_THRESHOLD" ]; then
38+
SIZE_LABEL="$LARGE"
39+
elif [ "$CHANGES" -gt "$MODERATE_THRESHOLD" ]; then
40+
SIZE_LABEL="$MODERATE"
41+
elif [ "$CHANGES" -gt "$SMALL_THRESHOLD" ]; then
42+
SIZE_LABEL="$SMALL"
43+
else
44+
SIZE_LABEL="$MINIMAL"
45+
fi
46+
47+
DELETE_LABELS=("${DELETE_LABELS[@]//${SIZE_LABEL}/}")
48+
49+
# API for adding labels on the Pull Request
50+
API_URL="https://api.github.com/repos/$REPOSITORY/issues/$PR_NUMBER/labels"
51+
52+
echo "Adding label: ${SIZE_LABEL[@]}"
53+
for LABEL in "${SIZE_LABEL[@]}"; do
54+
curl -X POST \
55+
-H "$AUTH_HEADER" \
56+
-H "Accept: application/vnd.github+json" \
57+
-H "X-GitHub-Api-Version: 2022-11-28" \
58+
-d "{\"labels\":[\"$LABEL\"]}" \
59+
"$API_URL" >/dev/null
60+
done
61+
62+
echo "Deleting Labels:"
63+
64+
for DELETE_LABEL in "${DELETE_LABELS[@]}"; do
65+
ENCODED_LABEL=$(echo "$DELETE_LABEL" | sed 's/ /%20/g')
66+
curl -X DELETE \
67+
-H "Accept: application/vnd.github+json" \
68+
-H "$AUTH_HEADER" \
69+
-H "X-GitHub-Api-Version: 2022-11-28" \
70+
"$API_URL/$ENCODED_LABEL" >/dev/null
71+
done

build/bin/write-dockerfile.sh renamed to .ci/write-dockerfile.sh

Lines changed: 89 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
11
#! /usr/bin/env bash
2-
## Write a Dockerfile to stdout that tests that the packages listed in the debian.txt/fedora.txt files of standard spkg exist
3-
## and satisfy the requirements tested by spkg-configure.m4
4-
## This is called by $SAGE_ROOT/tox.ini
52
set -e
6-
SYSTEM="${1:-debian}"
73
shopt -s extglob
4+
##
5+
## Write a Dockerfile for portability testing to stdout.
6+
##
7+
## This script needs to be run from SAGE_ROOT (root of the Sage repository).
8+
## It is called by $SAGE_ROOT/tox.ini for all environments 'tox -e docker-...'
9+
##
10+
## Positional arguments:
11+
##
12+
SYSTEM="${1:-debian}"
813
SAGE_PACKAGE_LIST_ARGS="${2:-:standard:}"
914
WITH_SYSTEM_SPKG="${3:-yes}"
1015
IGNORE_MISSING_SYSTEM_PACKAGES="${4:-no}"
1116
EXTRA_SAGE_PACKAGES="${5:-_bootstrap}"
12-
#
17+
##
18+
## Environment variables that take influence:
19+
##
20+
## - BOOTSTRAP
21+
## - CONFIGURE_ARGS
22+
## - DEVTOOLSET
23+
## - DIST_UPGRADE
24+
## - DOCKER_BUILDKIT
25+
## - EXTRA_PATH
26+
## - EXTRA_REPOSITORIES
27+
## - EXTRA_SYSTEM_PACKAGES
28+
## - FULL_BASE_IMAGE_AND_TAG
29+
## - SKIP_SYSTEM_PKG_INSTALL
30+
## - USE_CONDARC
31+
## - __CHOWN
32+
## - __SUDO
33+
##
1334
STRIP_COMMENTS="sed s/#.*//;"
1435
SAGE_ROOT=.
1536
export PATH="$SAGE_ROOT"/build/bin:$PATH
1637
SYSTEM_PACKAGES=$EXTRA_SYSTEM_PACKAGES
17-
CONFIGURE_ARGS="--enable-option-checking "
38+
SYSTEM_CONFIGURE_ARGS="--enable-option-checking "
1839
for SPKG in $(sage-package list --has-file=spkg-configure.m4 $SAGE_PACKAGE_LIST_ARGS) $EXTRA_SAGE_PACKAGES; do
1940
SYSTEM_PACKAGE=$(sage-get-system-packages $SYSTEM $SPKG)
2041
if [ -n "${SYSTEM_PACKAGE}" ]; then
@@ -24,16 +45,16 @@ for SPKG in $(sage-package list --has-file=spkg-configure.m4 $SAGE_PACKAGE_LIST_
2445
# shell-quote package if necessary
2546
SYSTEM_PACKAGES+=$(printf " %q" "$a")
2647
done
27-
CONFIGURE_ARGS+="--with-system-${SPKG}=${WITH_SYSTEM_SPKG} "
48+
SYSTEM_CONFIGURE_ARGS+="--with-system-${SPKG}=${WITH_SYSTEM_SPKG} "
2849
fi
2950
done
30-
echo "# Automatically generated by SAGE_ROOT/build/bin/write-dockerfile.sh"
51+
echo "# Automatically generated by SAGE_ROOT/.ci/write-dockerfile.sh"
3152
echo "# the :comments: separate the generated file into sections"
3253
echo "# to simplify writing scripts that customize this file"
3354
ADD="ADD $__CHOWN"
3455
RUN=RUN
3556
cat <<EOF
36-
ARG BASE_IMAGE
57+
ARG BASE_IMAGE=$(eval echo "${FULL_BASE_IMAGE_AND_TAG}")
3758
FROM \${BASE_IMAGE} as with-system-packages
3859
EOF
3960
case $SYSTEM in
@@ -54,8 +75,21 @@ case $SYSTEM in
5475
1|y*|Y*)
5576
;;
5677
*)
78+
#
79+
# The Ubuntu Docker images are "minimized", meaning that some large
80+
# bits such as documentation has been removed. We have to unminimize
81+
# once (which reinstalls the full versions of some minimized packages),
82+
# or e.g. the maxima documentation (which we depend on for correct operation)
83+
# will be missing.
84+
#
85+
# But we only have to do this once. To save time in incremental builds,
86+
# we remove the unminimize binary here after it has done its job.
87+
#
5788
cat <<EOF
58-
RUN (yes | unminimize) || echo "(ignored)"
89+
RUN if command -v unminimize > /dev/null; then \
90+
(yes | unminimize) || echo "(ignored)"; \
91+
rm -f "\$(command -v unminimize)"; \
92+
fi
5993
EOF
6094
if [ -n "$DIST_UPGRADE" ]; then
6195
cat <<EOF
@@ -143,7 +177,7 @@ EOF
143177
;;
144178
*)
145179
cat <<EOF
146-
ARG USE_CONDARC=condarc.yml
180+
ARG USE_CONDARC=${USE_CONDARC-condarc.yml}
147181
ADD *condarc*.yml /tmp/
148182
RUN echo \${CONDARC}; cd /tmp && conda config --stdin < \${USE_CONDARC}
149183
RUN conda update -n base conda
@@ -230,32 +264,49 @@ cat <<EOF
230264
231265
FROM with-system-packages as bootstrapped
232266
#:bootstrapping:
233-
RUN if [ -d /sage ]; then echo "### Incremental build from \$(cat /sage/VERSION.txt)" && mv /sage /sage-old && mkdir /sage && for a in local logs; do if [ -d /sage-old/\$a ]; then mv /sage-old/\$a /sage; fi; done; rm -rf /sage-old; else mkdir -p /sage; fi
267+
RUN rm -rf /new /sage/.git
268+
$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 .gitignore /new/
269+
$ADD config/config.rpath /new/config/config.rpath
270+
$ADD src/doc/bootstrap /new/src/doc/bootstrap
271+
$ADD src/bin /new/src/bin
272+
$ADD src/Pipfile.m4 src/pyproject.toml src/requirements.txt.m4 src/setup.cfg.m4 src/VERSION.txt /new/src/
273+
$ADD m4 /new/m4
274+
$ADD pkgs /new/pkgs
275+
$ADD build /new/build
276+
$ADD .upstream.d /new/.upstream.d
277+
ADD .ci /.ci
278+
RUN if [ -d /sage ]; then \
279+
echo "### Incremental build from \$(cat /sage/VERSION.txt)" && \
280+
printf '/src\n!/src/doc/bootstrap\n!/src/bin\n!/src/*.m4\n!/src/*.toml\n!/src/VERSION.txt\n' >> /sage/.gitignore && \
281+
printf '/src\n!/src/doc/bootstrap\n!/src/bin\n!/src/*.m4\n!/src/*.toml\n!/src/VERSION.txt\n' >> /new/.gitignore && \
282+
if ! (cd /new && /.ci/retrofit-worktree.sh worktree-image /sage); then \
283+
echo "retrofit-worktree.sh failed, falling back to replacing /sage"; \
284+
for a in local logs; do \
285+
if [ -d /sage/\$a ]; then mv /sage/\$a /new/; fi; \
286+
done; \
287+
rm -rf /sage; \
288+
mv /new /sage; \
289+
fi; \
290+
else \
291+
mv /new /sage; \
292+
fi
234293
WORKDIR /sage
235-
$ADD Makefile VERSION.txt COPYING.txt condarc.yml README.md bootstrap bootstrap-conda configure.ac sage .homebrew-build-env tox.ini Pipfile.m4 ./
236-
$ADD config/config.rpath config/config.rpath
237-
$ADD src/doc/bootstrap src/doc/bootstrap
238-
$ADD src/bin src/bin
239-
$ADD src/Pipfile.m4 src/pyproject.toml.m4 src/requirements.txt.m4 src/VERSION.txt src/
240-
$ADD m4 ./m4
241-
$ADD pkgs pkgs
242-
$ADD build ./build
243-
$ADD .upstream.d ./.upstream.d
244-
ARG BOOTSTRAP=./bootstrap
294+
295+
ARG BOOTSTRAP="${BOOTSTRAP-./bootstrap}"
245296
$RUN sh -x -c "\${BOOTSTRAP}" $ENDRUN $THEN_SAVE_STATUS
246297
247298
FROM bootstrapped as configured
248299
#:configuring:
249300
RUN $CHECK_STATUS_THEN mkdir -p logs/pkgs; rm -f config.log; ln -s logs/pkgs/config.log config.log
250-
ARG EXTRA_CONFIGURE_ARGS=""
301+
ARG CONFIGURE_ARGS="${CONFIGURE_ARGS:---enable-build-as-root}"
251302
EOF
252303
if [ ${WITH_SYSTEM_SPKG} = "force" ]; then
253304
cat <<EOF
254-
$RUN echo "****** Configuring: ./configure --enable-build-as-root $CONFIGURE_ARGS \${EXTRA_CONFIGURE_ARGS} *******"; ./configure --enable-build-as-root $CONFIGURE_ARGS \${EXTRA_CONFIGURE_ARGS} || (echo "********** configuring without forcing ***********"; echo "::group::config.log"; cat config.log; echo "::endgroup::"; ./configure --enable-build-as-root; echo "::group::config.log"; cat config.log; echo "::endgroup::"; exit 1) $ENDRUN $THEN_SAVE_STATUS
305+
$RUN ./configure $SYSTEM_CONFIGURE_ARGS \${CONFIGURE_ARGS} || (echo "::group::config.log"; cat config.log; echo "::endgroup::"; echo "********** configuring without forcing ***********"; ./configure \${CONFIGURE_ARGS}; echo "::group::config.log"; cat config.log; echo "::endgroup::"; exit 1) $ENDRUN $THEN_SAVE_STATUS
255306
EOF
256307
else
257308
cat <<EOF
258-
$RUN echo "****** Configuring: ./configure --enable-build-as-root $CONFIGURE_ARGS \${EXTRA_CONFIGURE_ARGS} *******"; ./configure --enable-build-as-root $CONFIGURE_ARGS \${EXTRA_CONFIGURE_ARGS} || (echo "::group::config.log"; cat config.log; echo "::endgroup::"; exit 1) $ENDRUN $THEN_SAVE_STATUS
309+
$RUN ./configure $SYSTEM_CONFIGURE_ARGS \${CONFIGURE_ARGS} || (echo "::group::config.log"; cat config.log; echo "::endgroup::"; exit 1) $ENDRUN $THEN_SAVE_STATUS
259310
EOF
260311
fi
261312
cat <<EOF
@@ -286,7 +337,19 @@ ENV MAKE="make -j\${NUMPROC}"
286337
ARG USE_MAKEFLAGS="-k V=0"
287338
ENV SAGE_CHECK=warn
288339
ENV SAGE_CHECK_PACKAGES="!cython,!r,!python3,!gap,!cysignals,!linbox,!git,!ppl,!cmake,!rpy2,!sage_sws2rst"
289-
$ADD src src
340+
$ADD .gitignore /new/.gitignore
341+
$ADD src /new/src
342+
RUN cd /new && rm -rf .git && \
343+
if /.ci/retrofit-worktree.sh worktree-pre /sage; then \
344+
cd /sage && touch configure build/make/Makefile; \
345+
else \
346+
echo "retrofit-worktree.sh failed, falling back to replacing /sage/src"; \
347+
rm -rf /sage/src; \
348+
mv src /sage/src; \
349+
cd /sage && ./bootstrap && ./config.status; \
350+
fi; \
351+
cd /sage && rm -rf /new .git
352+
290353
ARG TARGETS="build"
291354
$RUN $CHECK_STATUS_THEN make SAGE_SPKG="sage-spkg -y -o" \${USE_MAKEFLAGS} \${TARGETS} $ENDRUN $THEN_SAVE_STATUS
292355

.devcontainer/onCreate-conda.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,4 @@ conda init bash
88

99
# Build sage
1010
conda run -n sage-dev ./bootstrap
11-
conda run -n sage-dev ./configure --with-python=/opt/conda/envs/sage-dev/bin/python --prefix=/opt/conda/envs/sage-dev
12-
conda run -n sage-dev pip install --no-build-isolation -v -v -e ./pkgs/sage-conf ./pkgs/sage-setup
1311
conda run -n sage-dev pip install --no-build-isolation -v -v -e ./src

.devcontainer/portability-centos-stream-8-python3.9-minimal/devcontainer.json

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)