Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • feat-add_graphviz_wf
  • experimental_rel
  • master
  • lab-jupyterlab4
  • snudda_2.2.2
  • add-nestml-tests
  • ebrains-25-02
  • lab-widgets
  • ebrains-24-04
  • feat_add_py-jaxley
  • feat_JUSUF_image
  • fix-k8s-job-cache-dir
  • test_open3d
  • add-music
  • add_gcc-spinnaker
  • disable-view
  • test_quiggeldy_service
  • image_build
  • update-readme
  • create-module-file
  • feat_add_py-norse
  • update-libneuroml
  • update-bluebrain-packages
  • feat_arbor_install_all_binaries
  • ebrains-23.09-jsc-site-config
  • ebrains-23-09-spack-v0.19.2
  • ebrains-23-09
  • ebrains-23-06
  • ebrains-23-02
  • ebrains-22-10
  • ebrains-22-07
  • release_v0.1_202109_hotfix
  • release_v0.1_202109
  • v22.07
  • v22.10
  • v23.02
  • v23.06
  • v23.09
  • v24.04
  • v25.02
40 results

Target

Select target project
No results found
Select Git revision
  • cineca_ebrains/libvips_magick
  • cineca/wget_openssl_external
  • create-module-file
  • master
  • ebrains-24-04
  • add-nestml-tests
  • experimental_rel
  • feat_add_py-norse
  • update-libneuroml
  • update-bluebrain-packages
  • feat_arbor_install_all_binaries
  • ebrains-23.09-jsc-site-config
  • spack-v0.20.0
  • ebrains-23-09-spack-v0.19.2
  • ebrains-23-09
  • nestml-source-distribution
  • ebrains-23-06
  • ebrains-23-02
  • ebrains-22-10
  • ebrains-22-07
  • release_v0.1_202109_hotfix
  • release_v0.1_202109
22 results
Show changes

Commits on Source 259

159 additional commits have been omitted to prevent performance issues.
343 files
+ 15038
6201
Compare changes
  • Side-by-side
  • Inline

Files

+245 −128
Original line number Diff line number Diff line
@@ -3,27 +3,40 @@ stages:
  - test

variables:
  BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/tc/ebrains-spack-build-env/okd:okd_23.06
  GITLAB_BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/tc/ebrains-spack-build-env/gitlab_runners_nfs:gitlab_runners_nfs_23.06
  SPACK_VERSION: v0.21.1
  SPACK_PATH_GITLAB: /mnt/spack_v0.21.1
  BUILD_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/ebrains-spack-build-env/base:devel
  RUN_ENV_DOCKER_IMAGE: docker-registry.ebrains.eu/clb-jupyter-image/ebrains:dev-a7ab31be
  SPACK_PATH_GITLAB: /mnt/spack_v0.23.1
  SYSTEMNAME: ebrainslab
  GIT_SUBMODULE_STRATEGY: recursive
  GIT_CLEAN_FLAGS: -ffdxq
  RUNNER_AFTER_SCRIPT_TIMEOUT: 20m

# start an OpenShift Job that will build the Spack environment
# ===================================================================
# LAB DEPLOYMENTS
# ===================================================================

# start a k8s Job that will build the Spack environment
.deploy-build-environment:
  variables:
    OCI_CACHE_PREFIX: ""
    UPDATE_SPACK_OCI_CACHES: false
  stage: build
  tags:
    - docker-runner
    - read-only
  image: alpine:3.21.0
  before_script:
    - apk add kubectl
  script:
    # login and select project in openshift
    - oc login "$OPENSHIFT_SERVER" --token="$OPENSHIFT_TOKEN"
    - oc project $OC_PROJECT
    # use the site-specific kubectl context
    - kubectl config use-context $KUBE_CONTEXT
    # create job description file
    - chmod a+x create_job.sh
    - ./create_job.sh $CI_PIPELINE_ID $BUILD_ENV_DOCKER_IMAGE update $INSTALLATION_ROOT $SPACK_VERSION $SPACK_ENV $CI_COMMIT_BRANCH $RELEASE_NAME $LAB_KERNEL_ROOT
    - sh create_job.sh $CI_PIPELINE_ID $BUILD_ENV_DOCKER_IMAGE $INSTALLATION_ROOT $SPACK_ENV $CI_COMMIT_SHA $RELEASE_NAME $LAB_KERNEL_ROOT $UPDATE_SPACK_OCI_CACHES $OCI_CACHE_PREFIX
    - cat simplejob.yml
    # start the deploy job
    - oc create -f simplejob.yml
    - kubectl create -f simplejob.yml
    # wait for job to finish to get the logs
    - while true; do sleep 300; x=$(oc get pods | grep simplejob${CI_PIPELINE_ID} | awk '{ print $3}'); if [ $x != "Running" ]; then break; fi; done 
    - while true; do sleep 300; x=$(kubectl get pods -l job-name=simplejob${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.phase}'); if [ $x != "Running" ]; then break; fi; done
    # # copy logs of failed packages locally, to keep as job artifacts
    # - oc rsync $(oc get pods -l job-name=simplejob${CI_PIPELINE_ID} -o name):/tmp ./ --include="*/" --include="spack/spack-stage/*/*.txt" --exclude="*"
    # - mv tmp/spack/spack-stage spack_logs
@@ -32,159 +45,200 @@ variables:
    # - oc rsync $(oc get pods -l job-name=simplejob${CI_PIPELINE_ID} -o name):$LAB_KERNEL_PATH ./
    # - mv .$LAB_KERNEL_PATH kernel_specs
    # if spack install has failed, fail the pipeline
    - oc logs jobs/simplejob${CI_PIPELINE_ID} | tee log.txt
    - if [ $(cat log.txt | grep "No module available for package" | wc -l) -gt 0 ]; then exit 1; fi;
    # delete the job from OpenShift as we have the logs here
    - oc delete job simplejob${CI_PIPELINE_ID} || true
  tags:
    - shell-runner
    - kubectl logs jobs/simplejob${CI_PIPELINE_ID} | tee log.txt
    - if [ $(kubectl get pods -l job-name=simplejob${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.containerStatuses[0].state.terminated.exitCode}') -ne 0 ]; then exit 1; fi;
    # delete the job, as we have the logs here
    - kubectl delete job simplejob${CI_PIPELINE_ID} || true
  after_script:
    - kubectl config use-context $KUBE_CONTEXT
    - sh create_job_widget_script.sh $CI_PIPELINE_ID $RUN_ENV_DOCKER_IMAGE $INSTALLATION_ROOT $SPACK_ENV $RELEASE_NAME $LAB_KERNEL_ROOT
    - cat widget-script.yml
    - kubectl create -f widget-script.yml
    - while true; do sleep 300; x=$(kubectl get pods -l job-name=widget-script${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.phase}'); if [ $x != "Running" ]; then break; fi; done
    - kubectl logs jobs/widget-script${CI_PIPELINE_ID} | tee log.txt
    - if [ $(kubectl get pods -l job-name=widget-script${CI_PIPELINE_ID} -o jsonpath='{.items[0].status.containerStatuses[0].state.terminated.exitCode}') -ne 0 ]; then exit 1; fi;
    - kubectl delete job widget-script${CI_PIPELINE_ID} || true
  # artifacts:
  #   paths:
  #     - spack_logs
  #     - kernel_specs
  #   when: always

# Deploy in the lab-int environment the version of the tools to be
# tested before released to production (push pipeline)
# deploy on the dev environment of the okd dev cluster at CSCS
# runs on protected branches only as the token variable is protected
deploy-int-release-dev-cscs:
# -------------------------------------------------------------------
# Lab deployment target environments: dev and prod Lab instances
# -------------------------------------------------------------------

# deploy to a dev lab environment
.deploy-dev-server:
  extends: .deploy-build-environment
  variables:
    OPENSHIFT_SERVER: $CSCS_OPENSHIFT_DEV_SERVER
    OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_DEV_TOKEN
    OC_PROJECT: jupyterhub-int
    LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/int
    INSTALLATION_ROOT: /srv/test-build-2402
    SPACK_ENV: test
    RELEASE_NAME: EBRAINS-test
  resource_group: shared-NFS-mount-dev-cscs
  rules:
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PROJECT_NAMESPACE =~ /platform\/esd/ && $CI_PIPELINE_SOURCE != "schedule"
    INSTALLATION_ROOT: /srv/test-build-2502

# Deploy the production release of tools (manual pipeline)
# deploy on the production environment of the okd prod cluster at CSCS
# runs on protected branches only as the token variable is protected
deploy-prod-release-prod-cscs:
# deploy to a prod lab environment
.deploy-prod-server:
  extends: .deploy-build-environment
  variables:
    OPENSHIFT_SERVER: $CSCS_OPENSHIFT_PROD_SERVER
    OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_PROD_TOKEN
    OC_PROJECT: jupyterhub
    LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
    INSTALLATION_ROOT: /srv/main-spack-instance-2402
    SPACK_ENV: ebrains-24-04
    RELEASE_NAME: EBRAINS-24.04
  resource_group: shared-NFS-mount-prod-cscs
  rules:
    - if: $CI_COMMIT_BRANCH =~ /^ebrains/
      when: manual
    INSTALLATION_ROOT: /srv/main-spack-instance-2502

# Deploy the production release of tools (manual pipeline)
# deploy on the production environment of the okd prod cluster at JSC
# runs on protected branches only as the token variable is protected
deploy-prod-release-prod-jsc:
  extends: .deploy-build-environment
# deploy to the dev lab environment at CINECA
.deploy-dev-server-cineca:
  extends: .deploy-dev-server
  variables:
    OPENSHIFT_SERVER: $JSC_OPENSHIFT_PROD_SERVER
    OPENSHIFT_TOKEN: $JSC_OPENSHIFT_PROD_TOKEN
    OC_PROJECT: jupyterhub
    LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
    INSTALLATION_ROOT: /srv/main-spack-instance-2402
    SPACK_ENV: ebrains-24-04
    RELEASE_NAME: EBRAINS-24.04
    KUBE_CONTEXT: cineca-int
  resource_group: shared-NFS-mount-dev-cineca

# deploy to the prod lab environment at JSC
.deploy-prod-server-jsc:
  extends: .deploy-prod-server
  variables:
    KUBE_CONTEXT: jsc-prod
  resource_group: shared-NFS-mount-prod-jsc

# deploy to the prod lab environment at CINECA
.deploy-prod-server-cineca:
  extends: .deploy-prod-server
  variables:
    KUBE_CONTEXT: cineca-prod
  resource_group: shared-NFS-mount-prod-cineca

# -------------------------------------------------------------------
# Release types: test, experimental and official releases
# -------------------------------------------------------------------

# deploy int release (latest changes) to dev env to be tested before release to production
# (the master branch and any branch starting with "lab-" is deployed to a dedicated kernel)
.deploy-int-release:
  variables:
    SPACK_ENV: $CI_COMMIT_BRANCH
    RELEASE_NAME: $CI_COMMIT_BRANCH
  rules:
    - if: '($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^lab-/) && $CI_PROJECT_NAMESPACE =~ /platform\/esd/ && $CI_PIPELINE_SOURCE == "push"'

# deploy a pre-production environment first, to avoid directly modifying the experimental or official release environments
.deploy-ppd-release:
  variables:
    SPACK_ENV: ppd
    RELEASE_NAME: EBRAINS-ppd
  allow_failure: false
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"  && $DEPLOYMENT == "prod"
    - if: $CI_COMMIT_BRANCH =~ /^ebrains/
      when: manual

# Deploy the experimental release of tools (sheduled pipeline)
# once a week from latest working version of integration release 
# (branch=experimental_release) to an experimental JupyterLab kernel
# deploy on the dev environment of the okd dev cluster at CSCS
# runs on protected branches only as the token variable is protected
deploy-exp-release-dev-cscs:
  extends: .deploy-build-environment
# deploy the experimental release of tools once a week from latest working version of int release 
.deploy-exp-release:
  variables:
    OPENSHIFT_SERVER: $CSCS_OPENSHIFT_DEV_SERVER
    OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_DEV_TOKEN
    OC_PROJECT: jupyterhub-int
    LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/int
    INSTALLATION_ROOT: /srv/test-build-2402
    SPACK_ENV: experimental
    RELEASE_NAME: EBRAINS-experimental
  resource_group: shared-NFS-mount-dev-cscs

# deploy the experimental release to dev env
.deploy-exp-dev-release:
  extends: .deploy-exp-release
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"  && $DEPLOYMENT == "dev"

# Deploy the experimental release of tools (sheduled pipeline)
# once a week from latest working version of integration release 
# (branch=experimental_release) to an experimental JupyterLab kernel
# deploy on the prod environment of the okd prod cluster at CSCS
# runs on protected branches only as the token variable is protected
deploy-exp-release-prod-cscs:
  extends: .deploy-build-environment
  variables:
    OPENSHIFT_SERVER: $CSCS_OPENSHIFT_PROD_SERVER
    OPENSHIFT_TOKEN: $CSCS_OPENSHIFT_PROD_TOKEN
    OC_PROJECT: jupyterhub
    LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
    INSTALLATION_ROOT: /srv/main-spack-instance-2402
    SPACK_ENV: experimental
    RELEASE_NAME: EBRAINS-experimental
  resource_group: shared-NFS-mount-prod-cscs
  tags:             # this is just to ensure that the two jobs will run on different runners
    - read-write    # to avoid issues with common environment variables
    - shell-runner
# deploy the experimental release to prod env
.deploy-exp-prod-release:
  extends: .deploy-exp-release
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"  && $DEPLOYMENT == "prod"

# Deploy the experimental release of tools (sheduled pipeline)
# once a week from latest working version of integration release 
# (branch=experimental_release) to an experimental JupyterLab kernel
# deploy on the prod environment of the okd prod cluster at JSC
# runs on protected branches only as the token variable is protected
deploy-exp-release-prod-jsc:
  extends: .deploy-build-environment
# deploy the production release of tools
.deploy-prod-release:
  variables:
    OPENSHIFT_SERVER: $JSC_OPENSHIFT_PROD_SERVER
    OPENSHIFT_TOKEN: $JSC_OPENSHIFT_PROD_TOKEN
    OC_PROJECT: jupyterhub
    LAB_KERNEL_ROOT: /srv/jupyterlab_kernels/prod
    INSTALLATION_ROOT: /srv/main-spack-instance-2402
    SPACK_ENV: experimental
    RELEASE_NAME: EBRAINS-experimental
  resource_group: shared-NFS-mount-prod-jsc
  tags:             # this is just to ensure that the two jobs will run on different runners
    - read-only     # to avoid issues with common environment variables
    - shell-runner
    SPACK_ENV: ebrains-25-02
    RELEASE_NAME: EBRAINS-25.02
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule"  && $DEPLOYMENT == "prod"
      when: never
    - if: $CI_COMMIT_BRANCH =~ /^ebrains/
      when: manual

# -------------------------------------------------------------------
# Lab deployment jobs
# -------------------------------------------------------------------

# deploy int release to dev environment at CINECA
deploy-int-release-dev-cineca:
  extends:
    - .deploy-int-release
    - .deploy-dev-server-cineca

# deploy exp release to dev environment at CINECA
deploy-exp-release-dev-cineca:
  extends:
    - .deploy-exp-dev-release
    - .deploy-dev-server-cineca

# deploy ppd release to prod environment at JSC
deploy-ppd-release-prod-jsc:
  extends:
    - .deploy-ppd-release
    - .deploy-prod-server-jsc

# deploy ppd release to prod environment at CINECA
deploy-ppd-release-prod-cineca:
  extends:
    - .deploy-ppd-release
    - .deploy-prod-server-cineca

# deploy exp release to prod environment at JSC
deploy-exp-release-prod-jsc:
  needs: [deploy-ppd-release-prod-jsc]
  extends:
    - .deploy-exp-prod-release
    - .deploy-prod-server-jsc

# deploy exp release to prod environment at CINECA
deploy-exp-release-prod-cineca:
  needs: [deploy-ppd-release-prod-cineca]
  extends:
    - .deploy-exp-prod-release
    - .deploy-prod-server-cineca

# deploy prod release to prod environment at JSC
deploy-prod-release-prod-jsc:
  needs: [deploy-ppd-release-prod-jsc]
  extends:
    - .deploy-prod-release
    - .deploy-prod-server-jsc

# deploy prod release to prod environment at CINECA
deploy-prod-release-prod-cineca:
  needs: [deploy-ppd-release-prod-cineca]
  extends:
    - .deploy-prod-release
    - .deploy-prod-server-cineca

# ===================================================================
# GITLAB RUNNER DEPLOYMENTS
# ===================================================================

# run test build job on any gitlab runner, trying to build latest changes
# with persistent, read-only deployment as upstream
build-spack-env-on-runner:
  stage: build
  tags:
    - docker-runner
    - read-only
  image: $GITLAB_BUILD_ENV_DOCKER_IMAGE
  image: $BUILD_ENV_DOCKER_IMAGE
  variables:
    SPACK_DEV_ENV: ebrains-dev
    SPACK_JOBS: 2
    OCI_CACHE_PREFIX: ""
    UPDATE_SPACK_OCI_CACHES: false
  script:
    # deactivate environment views (we don't need them for the test build-job)
    - >
        echo "  view: False" >> $CI_PROJECT_DIR/site-config/$SYSTEMNAME/spack.yaml
    # run installation script
    - . install_spack_env.sh $CI_PROJECT_DIR $SPACK_VERSION $CI_PROJECT_DIR $SPACK_DEV_ENV $SPACK_PATH_GITLAB
    # re-activate envionment and run tests
    - spack env activate $SPACK_DEV_ENV
    # TODO: run all tests when test dependency issue is fixed
    # - spack test run -x wf-brainscales2-demos wf-multi-area-model
    - bash install_spack_env.sh $SPACK_JOBS $CI_PROJECT_DIR $CI_PROJECT_DIR $SPACK_DEV_ENV $SPACK_PATH_GITLAB $UPDATE_SPACK_OCI_CACHES $OCI_CACHE_PREFIX
  after_script:
    - mkdir -p $CI_PROJECT_DIR/spack_logs/installed $CI_PROJECT_DIR/spack_logs/not_installed
      # for succesfully installed packages: keep the spack logs for any package modified during this CI job
    - PKG_DIR=$CI_PROJECT_DIR/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0
    - if cd $PKG_DIR; then find . \( -name ".spack" -o -name ".build" \) -exec cp -r --parents "{}" $CI_PROJECT_DIR/spack_logs/installed \;; fi
    - . $CI_PROJECT_DIR/spack/share/spack/setup-env.sh
    - cd $(spack-python -c "print(spack.store.parse_install_tree(spack.config.get('config'))[0])")
    - find . -mindepth 4 -maxdepth 4 \( -name ".spack" -o -name ".build" \) -exec cp -r --parents "{}" $CI_PROJECT_DIR/spack_logs/installed \;
      # for not succesfully installed packages: also keep the spack logs for any packages that failed
    - if cd /tmp/$(whoami)/spack-stage/; then find . -maxdepth 2 \( -name "*.txt" -o -name ".install_time_tests" \) -exec cp -r --parents "{}" $CI_PROJECT_DIR/spack_logs/not_installed \;; fi
    # - if [ -d /tmp/spack_tests ]; then mv /tmp/spack_tests $CI_PROJECT_DIR; fi
@@ -195,33 +249,95 @@ build-spack-env-on-runner:
    when: always
  timeout: 2 days
  rules:
    - if: $CI_PIPELINE_SOURCE != "schedule" && $CI_PIPELINE_SOURCE != "merge_request_event"
    - if: $CI_PIPELINE_SOURCE == "push"

# this one fills the spack caches and updates the ESD (ebrainslab-variant) images on harbor
sync-esd-image:
  stage: build
  tags:
    - esd_image
  image: docker-registry.ebrains.eu/esd/tmp:latest
  variables:
    CI_SPACK_ENV: esd
    SPACK_JOBS: 4
    # we access the branch-specific cache here (and also update it!)
    OCI_CACHE_PREFIX: ${HARBOR_HOST}/${HARBOR_PROJECT}/${CI_COMMIT_BRANCH}
    UPDATE_SPACK_OCI_CACHES: true
    OCI_IMAGE_PREFIX: ${HARBOR_HOST}/${HARBOR_PROJECT}/${CI_COMMIT_BRANCH}/image
    INSTALLATION_ROOT: /esd
    SANDBOX_ROOT_RELATIVE: esd_image
    SANDBOX_ROOT: ${CI_PROJECT_DIR}/${SANDBOX_ROOT_RELATIVE}
  script:
    # create a sandbox/image for performing an spack install inside based on some base image/install
    - apptainer build --fix-perms --sandbox ${SANDBOX_ROOT}/ docker://${BUILD_ENV_DOCKER_IMAGE}
    # run installation script inside future container environment
    #   => DAG concretization, subsequent cache access + fetching and actual build should be separate steps
    - mkdir --mode=0777 -p ${SANDBOX_ROOT}/${INSTALLATION_ROOT}
    - apptainer exec --writable --bind ${CI_PROJECT_DIR}:${INSTALLATION_ROOT} --cwd ${INSTALLATION_ROOT} ${SANDBOX_ROOT} bash ./install_spack_env.sh $SPACK_JOBS $INSTALLATION_ROOT ${INSTALLATION_ROOT} $CI_SPACK_ENV "" $UPDATE_SPACK_OCI_CACHES $OCI_CACHE_PREFIX
    - echo "export SYSTEMNAME=${SYSTEMNAME}" >> ${SANDBOX_ROOT}/.singularity.d/env/90-environment.sh
    - echo ". ${INSTALLATION_ROOT}/vendor/spack/var/spack/environments/${CI_SPACK_ENV}/load_env.sh" >> ${SANDBOX_ROOT}/.singularity.d/env/90-environment.sh
    # preparing to assemble the image: move in the CI project contents...
    - shopt -s dotglob
    - find . -maxdepth 1 -and -not -name "." -and -not -name "${SANDBOX_ROOT_RELATIVE}" -exec mv -t ${SANDBOX_ROOT}/${INSTALLATION_ROOT} {} \;
    # convert to SIF image file
    - apptainer build latest.sif "${SANDBOX_ROOT}"
    # upload SIF image as an artifact to OCI repo
    - oras push --username $HARBOR_USERNAME --password $HARBOR_PASSWORD ${OCI_IMAGE_PREFIX}:lab_latest.sif latest.sif && oras_ret=$? || oras_ret=$?
    # convert SIF image to OCI format and upload to OCI repo
    - skopeo --insecure-policy copy --dest-creds=${HARBOR_USERNAME}:${HARBOR_PASSWORD} sif:latest.sif docker://${OCI_IMAGE_PREFIX}:lab_latest.oci && skopeo_ret=$? || skopeo_ret=$?
    - exit $(expr $oras_ret + $skopeo_ret)
  after_script:
    - mkdir -p $CI_PROJECT_DIR/spack_logs/installed $CI_PROJECT_DIR/spack_logs/not_installed
      # for succesfully installed packages: keep the spack logs for any package modified during this CI job
    - PKG_DIR=${SANDBOX_ROOT}/${INSTALLATION_ROOT}/spack/opt/spack/**/linux-*/gcc-13.3.0
    - if cd $PKG_DIR; then find . \( -name ".spack" -o -name ".build" \) -exec cp -r --parents "{}" $CI_PROJECT_DIR/spack_logs/installed \;; fi
      # for not succesfully installed packages: also keep the spack logs for any packages that failed
    - if cd /tmp/$(whoami)/spack-stage/; then find . -maxdepth 2 \( -name "*.txt" -o -name ".install_time_tests" \) -exec cp -r --parents "{}" $CI_PROJECT_DIR/spack_logs/not_installed \;; fi
  artifacts:
    paths:
      - spack_logs
    when: always
  timeout: 2 days
  resource_group: registry-esd-master-image
  rules:
    # branches that update the gitlab-runner upstream (read-only) installation and the spack OCI caches
    - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "experimental_rel" || $CI_COMMIT_BRANCH =~ /^ebrains/) && $CI_PROJECT_PATH =~ /platform\/esd\/ebrains-spack-builds/ && $CI_PIPELINE_SOURCE == "push"
      when: manual

# update gitlab-runner upstream (read-only) installation
sync-gitlab-spack-instance:
  stage: build
  tags:
    - docker-runner
    - read-write
  image: $GITLAB_BUILD_ENV_DOCKER_IMAGE
  image: $BUILD_ENV_DOCKER_IMAGE
  variables:
    SPACK_REPO_PATH: $SPACK_PATH_GITLAB/ebrains-spack-builds
    SPACK_JOBS: 16
    OCI_CACHE_PREFIX: ""
    UPDATE_SPACK_OCI_CACHES: false
  script:
    - SPACK_NFS_ENV=${CI_COMMIT_BRANCH//./-}
    # create spack dir if it doesn't exist
    - mkdir -p $SPACK_PATH_GITLAB
    # get latest state of EBRAINS repo
    - rm -rf $SPACK_REPO_PATH && cp -r $CI_PROJECT_DIR $SPACK_REPO_PATH
    - if [ ! -d $SPACK_REPO_PATH ]; then git clone $CI_REPOSITORY_URL --recurse-submodules $SPACK_REPO_PATH; fi
    - cd $SPACK_REPO_PATH
    - git fetch origin
    - git reset --hard $CI_COMMIT_SHA
    - git submodule update --force
    # run installation script
    - . install_spack_env.sh $SPACK_PATH_GITLAB $SPACK_VERSION $SPACK_REPO_PATH $SPACK_NFS_ENV
    - bash install_spack_env.sh $SPACK_JOBS $SPACK_PATH_GITLAB $SPACK_REPO_PATH $SPACK_NFS_ENV "" $UPDATE_SPACK_OCI_CACHES $OCI_CACHE_PREFIX
    # create kernel spec, so that the environment can be used in gitlab CI jobs
    - RELEASE_NAME=$(case $CI_COMMIT_BRANCH in experimental_rel) echo ebrains-experimental;; ebrains*) echo ${CI_COMMIT_BRANCH:0:10}.${CI_COMMIT_BRANCH:11};; *) echo $CI_COMMIT_BRANCH;; esac);
    - . create_JupyterLab_kernel.sh $SPACK_PATH_GITLAB $SPACK_NFS_ENV $RELEASE_NAME /mnt/ebrains_env
    - bash create_JupyterLab_kernel.sh $SPACK_PATH_GITLAB $SPACK_NFS_ENV $RELEASE_NAME /mnt/ebrains_env
  after_script:
    - mkdir -p $CI_PROJECT_DIR/spack_logs/installed $CI_PROJECT_DIR/spack_logs/not_installed
      # for succesfully installed packages: keep the spack logs for any package modified during this CI job
      # (we use repo.yaml, that is modified at each start of the pipeline, as a reference file)
    - PKG_DIR=$SPACK_PATH_GITLAB/spack/opt/spack/linux-ubuntu20.04-x86_64/gcc-10.3.0
    - if cd $PKG_DIR; then find . -newer $SPACK_REPO_PATH/repo.yaml \( -name ".spack" -o -name ".build" \) -exec cp -r --parents "{}" $CI_PROJECT_DIR/spack_logs/installed \;; fi
    - . $SPACK_PATH_GITLAB/spack/share/spack/setup-env.sh
    - cd $(spack-python -c "print(spack.store.parse_install_tree(spack.config.get('config'))[0])")
    - find . -mindepth 4 -maxdepth 4 -newer $SPACK_REPO_PATH/repo.yaml \( -name ".spack" -o -name ".build" \) -exec cp -r --parents "{}" $CI_PROJECT_DIR/spack_logs/installed \;
      # for not succesfully installed packages: also keep the spack logs for any packages that failed
    - if cd /tmp/$(whoami)/spack-stage/; then find . -maxdepth 2 \( -name "*.txt" -o -name ".install_time_tests" \) -exec cp -r --parents "{}" $CI_PROJECT_DIR/spack_logs/not_installed \;; fi
  artifacts:
@@ -229,15 +345,17 @@ sync-gitlab-spack-instance:
      - spack_logs
    when: always
  rules:
    - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "experimental_rel" || $CI_COMMIT_BRANCH =~ /^ebrains/) && $CI_PROJECT_NAMESPACE =~ /platform\/esd/ && $CI_PIPELINE_SOURCE != "schedule"
    # branches that update the gitlab-runner upstream (read-only) installation
    - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH == "experimental_rel" || $CI_COMMIT_BRANCH =~ /^ebrains/) && $CI_PROJECT_NAMESPACE =~ /platform\/esd/ && $CI_PIPELINE_SOURCE == "push"
      when: manual

# run (scheduled) standalone tests for environment
test-gitlab-spack-instance:
  stage: test
  tags:
    - docker-runner
    - read-write
  image: $GITLAB_BUILD_ENV_DOCKER_IMAGE
  image: $BUILD_ENV_DOCKER_IMAGE
  variables:
    SPACK_REPO_PATH: $SPACK_PATH_GITLAB/ebrains-spack-builds
    SPACK_USER_CACHE_PATH: $SPACK_PATH_GITLAB/spack/.spack
@@ -256,4 +374,3 @@ test-gitlab-spack-instance:
    when: always
  rules:
    - if: $CI_PIPELINE_SOURCE == "schedule" && $TEST_DEPLOYMENT == "true"
Original line number Diff line number Diff line
### Summary

|               |                                        |
|---------------|----------------------------------------|
| Package       | <!-- Spack package name -->            |
| Contact point | <!-- maintainer GitLab handle -->      |
| KG entry      | <!-- insert link -->                   |


### Checks

<!-- please read the EBRAINS Software Quality Guidelines and fill out the checklist, and attach/replace the file below -->
* [ ] Software Follows [EBRAINS Software Quality Guidelines](https://drive.ebrains.eu/d/6061531326d048308823/files/?p=%2FSQ-Guideline.pdf) and reaches level: <!-- passing, silver, gold -->
   > *fill the [SQ-Checklist.pdf](https://drive.ebrains.eu/d/6061531326d048308823/files/?p=%2FSQ-Checklist.pdf) and attach below*
* [ ] Current maintainer is listed first in `package.py`
* [ ] No pinned dependency versions
* [ ] Post-installation tests are defined
 No newline at end of file
Original line number Diff line number Diff line
### Summary

|               |                                        |
|---------------|----------------------------------------|
| Package       | <!-- Spack package name -->            |
| Version added | <!-- version number -->                |
| Contact point | <!-- maintainer GitLab handle -->      |
| KG entry      | <!-- insert link -->                   |


### Checks

<!-- please read the EBRAINS Software Quality Guidelines and fill out the checklist, and attach/replace the file below -->
* [ ] Software Follows [EBRAINS Software Quality Guidelines](https://drive.ebrains.eu/d/6061531326d048308823/files/?p=%2FSQ-Guideline.pdf) and reaches level: <!-- passing, silver, gold -->
   > *fill the [SQ-Checklist.pdf](https://drive.ebrains.eu/d/6061531326d048308823/files/?p=%2FSQ-Checklist.pdf) and attach below*
* [ ] Current maintainer is listed first in `package.py`
* [ ] No pinned dependency versions
* [ ] Post-installation tests are defined
 No newline at end of file

.gitmodules

0 → 100644
+8 −0
Original line number Diff line number Diff line
[submodule "vendor/spack"]
	path = vendor/spack
	url = https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/spack.git
	shallow = true
[submodule "vendor/yashchiki"]
	path = vendor/yashchiki
	url = https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/dedal
	shallow = true
+2 −7
Original line number Diff line number Diff line
@@ -38,9 +38,9 @@ Clone this repository. You can use the `ebrains-yy-mm` branches to install the E
git clone --branch {branch-name} https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/ebrains-spack-builds.git
```

Clone Spack. We currently use version v0.21.1:
Clone Spack. We currently use version v0.23.1:
```
git clone --depth 1 -c advice.detachedHead=false -c feature.manyFiles=true --branch v0.20.0 https://github.com/spack/spack
git clone --depth 1 -c advice.detachedHead=false -c feature.manyFiles=true --branch v0.23.1 https://github.com/spack/spack
```

Activate Spack:
@@ -53,11 +53,6 @@ Add the project repository to your Spack environment:
spack repo add ebrains-spack-builds
```

Create the environment:
```
spack env create -d ebrains-spack-builds/
```

Define your site-specific configurations:
```
export SYSTEMNAME=<your-system-name>
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
#                 loaded by all users.
# ===========================================================================================================

set -euo pipefail

INSTALLATION_ROOT=$1
EBRAINS_SPACK_ENV=$2
RELEASE_NAME=$3
@@ -35,12 +37,17 @@ cp $INSTALLATION_ROOT/spack/var/spack/environments/$EBRAINS_SPACK_ENV/load_env.s
# and the location of python modules installed in the base docker Collab image
cat <<EOF >> $KERNEL_PATH/bin/env.sh
export PATH=\$PATH:/opt/app-root/src/.local/bin
export PYTHONPATH=\$PYTHONPATH:/opt/app-root/src/.local/lib/python3.8/site-packages:/usr/local/lib/python3.8/dist-packages
export PYTHONPATH=\$PYTHONPATH:/opt/conda/lib/python3.11/site-packages
export R_LIBS_USER=/opt/app-root/src/.local/lib/R/site-library
mkdir -p \$R_LIBS_USER
export R_LIBS=\$R_LIBS_USER:\$R_LIBS
EOF

# ... and set the SYSTEMNAME env var, to use Spack commands inside the kernel
cat <<EOF >> $KERNEL_PATH/bin/env.sh
export SYSTEMNAME=ebrainslab
EOF

# (4) create startup script for python kernel
cat $KERNEL_PATH/bin/env.sh > $KERNEL_PATH/bin/env_python.sh
echo "python -m ipykernel_launcher -f \$@" >> $KERNEL_PATH/bin/env_python.sh
+73 −20
Original line number Diff line number Diff line
@@ -2,20 +2,20 @@

# ===========================================================================================================
# title         : create_job.sh
# usage         : ./create_job.sh $OC_JOB_ID $BUILD_ENV_DOCKER_IMAGE $OP $INSTALLATION_ROOT $SPACK_VERSION
#                 $SPACK_ENV $BRANCH $RELEASE_NAME $LAB_KERNEL_ROOT
# usage         : ./create_job.sh $OC_JOB_ID $BUILD_ENV_DOCKER_IMAGE $INSTALLATION_ROOT
#                 $SPACK_ENV $COMMIT_SHA $RELEASE_NAME $LAB_KERNEL_ROOT
# description   : creates OKD job yaml file that builds/updates spack environment and creates Lab kernel
# ===========================================================================================================

OC_JOB_ID=$1
BUILD_ENV_DOCKER_IMAGE=$2
OP=$3
INSTALLATION_ROOT=$4
SPACK_VERSION=$5
SPACK_ENV=$6
BRANCH=$7
RELEASE_NAME=$8
LAB_KERNEL_ROOT=$9
INSTALLATION_ROOT=$3
EBRAINS_SPACK_ENV=$4
COMMIT_SHA=$5
RELEASE_NAME=$6
LAB_KERNEL_ROOT=$7
UPDATE_SPACK_OCI_CACHES=$8
OCI_CACHE_PREFIX=$9

cat <<EOT >> simplejob.yml
apiVersion: batch/v1
@@ -34,26 +34,79 @@ spec:
      - name: simplejob
        image: ${BUILD_ENV_DOCKER_IMAGE}
        imagePullPolicy: Always
        resources:
          limits:
            cpu: '8'
            memory: '32Gi'
            ephemeral-storage: '10Gi'
          requests:
            cpu: '4'
            memory: '20Gi'
            ephemeral-storage: '256Mi'
        volumeMounts:
          - name: sharedbin
            mountPath: /srv
        command: ["/usr/local/bin/deploy-build-env.sh", "$OP", "$INSTALLATION_ROOT", "$SPACK_VERSION", "$SPACK_ENV", "$BRANCH", "$RELEASE_NAME", "$LAB_KERNEL_ROOT"]
          - name: tmp
            mountPath: /tmp
        command:
        - /bin/bash
        - -c
        - |
          # create root dir if it doesn't exist
          mkdir -p \$INSTALLATION_ROOT
          
          # reset spack repository dir by cloning the selected version
          if [ ! -d \$EBRAINS_REPO_PATH ]; then git clone ${CI_PROJECT_URL} --recurse-submodules \$EBRAINS_REPO_PATH; fi
          cd \$EBRAINS_REPO_PATH
          git fetch origin
          git reset --hard \$COMMIT_SHA
          git submodule update --force

          # reset build error log dir (delete previous logs to save space)
          rm -rf \$BUILD_LOGS_DIR
          mkdir -p \$BUILD_LOGS_DIR
          cd \$BUILD_LOGS_DIR
          
          # run installation script
          bash \$EBRAINS_REPO_PATH/install_spack_env.sh \$SPACK_JOBS \$INSTALLATION_ROOT \$EBRAINS_REPO_PATH \$EBRAINS_SPACK_ENV "" \$UPDATE_SPACK_OCI_CACHES \$OCI_CACHE_PREFIX
          
          if [ \$? -eq 0 ]
          then
            # build process succeeded - create or update kernel on the NFS based on the current spack environment
            bash \$EBRAINS_REPO_PATH/create_JupyterLab_kernel.sh \$INSTALLATION_ROOT \$EBRAINS_SPACK_ENV \$RELEASE_NAME \$LAB_KERNEL_ROOT && exit 0
          else
            # build process failed - keep spack build logs and fail the pipeline
            cp -r /tmp/spack/spack-stage/* \$BUILD_LOGS_DIR
            exit 1
          fi
        env:
          - name: SYSTEMNAME
            value: ebrainslab
          - name: GITLAB_USER
            valueFrom:
              secretKeyRef:
                name: spack-repo-gitlab-token
                key: username
          - name: GITLAB_TOKEN
            valueFrom:
              secretKeyRef:
                name: spack-repo-gitlab-token
                key: password
          - name: INSTALLATION_ROOT
            value: $INSTALLATION_ROOT
          - name: EBRAINS_SPACK_ENV
            value: $EBRAINS_SPACK_ENV
          - name: UPDATE_SPACK_OCI_CACHES
            value: '$UPDATE_SPACK_OCI_CACHES'
          - name: OCI_CACHE_PREFIX
            value: $OCI_CACHE_PREFIX
          - name: COMMIT_SHA
            value: $COMMIT_SHA
          - name: RELEASE_NAME
            value: $RELEASE_NAME
          - name: LAB_KERNEL_ROOT
            value: $LAB_KERNEL_ROOT
          - name: BUILD_LOGS_DIR
            value: /srv/build_logs/$EBRAINS_SPACK_ENV
          - name: EBRAINS_REPO_PATH
            value: $INSTALLATION_ROOT/ebrains-spack-builds
          - name: SPACK_JOBS
            value: '6'
      volumes:
        - name: sharedbin
          persistentVolumeClaim:
            claimName: shared-binaries
        - name: tmp
          emptyDir: {}
      restartPolicy: Never
EOT
+68 −0
Original line number Diff line number Diff line
#!/bin/bash

# ===========================================================================================================
# title         : create_job_widget_script.sh
# usage         : ./create_job_widget_script.sh $OC_JOB_ID $RUN_ENV_DOCKER_IMAGE $INSTALLATION_ROOT
#                 $SPACK_ENV $RELEASE_NAME $LAB_KERNEL_ROOT
# description   : creates job file that generates a script to load the jupyter extensions for a given env
# ===========================================================================================================

OC_JOB_ID=$1
RUN_ENV_DOCKER_IMAGE=$2
INSTALLATION_ROOT=$3
EBRAINS_SPACK_ENV=$4
RELEASE_NAME=$5
LAB_KERNEL_ROOT=$6

cat <<EOT >> widget-script.yml
apiVersion: batch/v1
kind: Job
metadata:
  name: widget-script${OC_JOB_ID}
spec:
  parallelism: 1
  completions: 1
  backoffLimit: 0
  template:
    spec:
      containers:
      - name: widget-script
        image: ${RUN_ENV_DOCKER_IMAGE}
        imagePullPolicy: Always
        resources:
          limits:
            cpu: '1'
            memory: '1Gi'
          requests:
            cpu: '0.5'
            memory: '500Mi'
        volumeMounts:
          - name: sharedbin
            mountPath: /srv
        command:
        - /bin/bash
        - -c
        - |
          . \$INSTALLATION_ROOT/spack/share/spack/setup-env.sh
          spack env activate --without-view \$EBRAINS_SPACK_ENV
          KERNEL_PATH=\$LAB_KERNEL_ROOT/\$(echo "\$RELEASE_NAME" | tr '[:upper:]' '[:lower:]')
          spack load --sh --first clb-nb-utils py-pip py-tvb-ext-bucket py-tvb-ext-unicore py-tvb-ext-xircuits > \$KERNEL_PATH/bin/widget_activation.sh
        env:
          - name: SYSTEMNAME
            value: ebrainslab
          - name: SPACK_DISABLE_LOCAL_CONFIG
            value: "true"
          - name: INSTALLATION_ROOT
            value: "$INSTALLATION_ROOT"
          - name: EBRAINS_SPACK_ENV
            value: "$EBRAINS_SPACK_ENV"
          - name: RELEASE_NAME
            value: "$RELEASE_NAME"
          - name: LAB_KERNEL_ROOT
            value: "$LAB_KERNEL_ROOT"
      volumes:
        - name: sharedbin
          persistentVolumeClaim:
            claimName: shared-binaries
      restartPolicy: Never
EOT
Original line number Diff line number Diff line
#!/bin/bash

# ===============================================================================================================================
# =========================================================================================================================================
# title         : install_spack_env.sh
# usage         : ./install_spack_env.sh $INSTALLATION_ROOT $SPACK_VERSION $EBRAINS_REPO $EBRAINS_SPACK_ENV $UPSTREAM_INSTANCE
# usage         : ./install_spack_env.sh $SPACK_JOBS $INSTALLATION_ROOT $EBRAINS_REPO $EBRAINS_SPACK_ENV $UPSTREAM_INSTANCE \
#                                        $UPDATE_SPACK_OCI_CACHES $OCI_CACHE_PREFIX
# description   : installs or updates the spack environment defined in the EBRAINS spack repo
#                 (if the specified spack instance doesn't exist, it also creates it)
# ===============================================================================================================================
# =========================================================================================================================================

INSTALLATION_ROOT=$1  # where to set up the installation
SPACK_VERSION=$2      # which spack version to use
set -eo pipefail

SPACK_JOBS=$1         # number of jobs
INSTALLATION_ROOT=$2  # where to set up the installation
EBRAINS_REPO=$3       # location of ebrains-spack-builds repository
EBRAINS_SPACK_ENV=$4  # name of EBRAINS Spack environment to be created/updated
UPSTREAM_INSTANCE=$5  # path to Spack instance to use as upstream (optional)
UPDATE_SPACK_OCI_CACHES=$6 # "true" enables updating the OCI cache for spack sources and build results
export OCI_CACHE_PREFIX=$7

SPACK_REPO=https://gitlab.ebrains.eu/ri/tech-hub/platform/esd/spack.git
SPACK_VERSION_EBRAINS=${SPACK_VERSION}_ebrains24.04
# make sure spack uses the symlinked folder as path
export CI_SPACK_ROOT=${INSTALLATION_ROOT}/spack

# specify location of .spack dir (by default in ~)
# this is where cache and configuration settings are stored
export SPACK_USER_CACHE_PATH=$INSTALLATION_ROOT/spack/.spack
export SPACK_USER_CONFIG_PATH=$INSTALLATION_ROOT/spack/.spack
# disable local configuration and cache directories
export SPACK_DISABLE_LOCAL_CONFIG=true
export SPACK_USER_CACHE_PATH=/tmp/spack

# define SYSTEMNAME variable in sites where it's not already defined
export SYSTEMNAME=${SYSTEMNAME:-${HPC_SYSTEM:-$BSC_MACHINE}}

# initial setup: clone spack if spack dir doesn't already exist
if [ ! -d $INSTALLATION_ROOT/spack ]
then
  git clone --depth 1 -c advice.detachedHead=false -c feature.manyFiles=true --branch $SPACK_VERSION_EBRAINS $SPACK_REPO $INSTALLATION_ROOT/spack
  # SPACK PATCH: the post-build logs on install-time-test-logs.txt gets ovewritten by the post-install logs.
  # quick fix for that: (TODO: investigate more and open PR)
  sed -i "s/self.file_like, \"w\"/self.file_like, \"a\"/g" $INSTALLATION_ROOT/spack/lib/spack/llnl/util/tty/log.py
# cache related variables
export CACHE_SPECFILE=${CACHE_SPECFILE:-"env_specfile.yaml"}
export YASHCHIKI_HOME=${EBRAINS_REPO}/vendor/yashchiki
export SPACK_CACHE_SOURCE=${SPACK_CACHE_SOURCE:-${CI_SPACK_ROOT}/var/spack/cache}
export SPACK_CACHE_BUILD=${SPACK_CACHE_BUILD:-${CI_SPACK_ROOT}/var/spack/cache}

if [ ! -d ${INSTALLATION_ROOT} ]; then
    mkdir -p ${INSTALLATION_ROOT}
fi

if [[ $UPSTREAM_INSTANCE ]]
then
  cat <<EOF > $INSTALLATION_ROOT/spack/etc/spack/defaults/upstreams.yaml
upstreams:
  upstream-spack-instance:
    install_tree: $UPSTREAM_INSTANCE/spack/opt/spack
EOF
# initial setup: use spack submodule if spack dir doesn't already exist
SPACK_ROOT_EXISTED=1
if [ ! -d ${CI_SPACK_ROOT} ]; then
  ln -s ${EBRAINS_REPO}/vendor/spack ${CI_SPACK_ROOT}
  SPACK_ROOT_EXISTED=0
fi

# activate Spack
source $INSTALLATION_ROOT/spack/share/spack/setup-env.sh
source ${CI_SPACK_ROOT}/share/spack/setup-env.sh

if [[ $UPSTREAM_INSTANCE ]]; then
    UPSTREAM_PREFIX=$(find $UPSTREAM_INSTANCE/spack/opt/spack/ -type d -name ".spack-db" 2>/dev/null | xargs -I {} dirname {})
    spack config add upstreams:upstream-spack-instance:install_tree:$UPSTREAM_PREFIX
fi

if [ "${SPACK_ROOT_EXISTED}" -eq 0 ]; then
    # for caching purposes it's nice if we can relocate into long paths, but we
    # can't do that for existing installations -> else path
    # ECM (2025-01-23) true seems to yield too large paths for some packages (e.g., gcc)
    spack config add config:install_tree:padded_length:128
fi

# add repo if it does not exist
if [[ ! $(spack repo list | grep ebrains-spack-builds$) ]]
@@ -51,37 +66,119 @@ then
  spack repo add $EBRAINS_REPO
fi

# install platform compiler (extract version from packages.yaml)
if [ $SYSTEMNAME == ebrainslab ]
then
  EBRAINS_SPACK_COMPILER=$(grep 'compiler' $EBRAINS_REPO/site-config/$SYSTEMNAME/packages.yaml | awk -F'[][]' '{ print $2 }')
  spack compiler find
  spack load $EBRAINS_SPACK_COMPILER || { spack install $EBRAINS_SPACK_COMPILER; spack load $EBRAINS_SPACK_COMPILER; }
# make sure all fetching/clingo stuff happens before anything else
spack spec aida

# rebuild spack's database (could be an debugging session)
spack reindex

# add local mirror if it does not exist
if [[ ! $(spack mirror list | grep local_cache) ]]; then
    # TODO for newer spack versions, add: --autopush --unsigned, drop create cache command below
    # (Note: spack expects `build_cache/` below the folder we specify here
    spack mirror add local_cache ${SPACK_CACHE_BUILD}
fi

spack compiler find

# create environment if it does not exist
if [ ! -d "$SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV" ]
if [ ! -d "${CI_SPACK_ROOT}/var/spack/environments/$EBRAINS_SPACK_ENV" ]
then
  spack env create $EBRAINS_SPACK_ENV
fi

# update environment site-configs
rm -rf $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/site-config && cp -r $EBRAINS_REPO/site-config $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV
rm -rf ${CI_SPACK_ROOT}/var/spack/environments/$EBRAINS_SPACK_ENV/site-config && cp -r $EBRAINS_REPO/site-config ${CI_SPACK_ROOT}/var/spack/environments/$EBRAINS_SPACK_ENV
# update spack.yaml: merge top-level and site-specific spack.yaml files
spack-python $EBRAINS_REPO/site-config/ymerge.py $EBRAINS_REPO/spack.yaml $EBRAINS_REPO/site-config/$SYSTEMNAME/spack.yaml > /tmp/spack.yaml
cp /tmp/spack.yaml $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/
cp /tmp/spack.yaml ${CI_SPACK_ROOT}/var/spack/environments/$EBRAINS_SPACK_ENV/

# activate environment
spack env activate --without-view $EBRAINS_SPACK_ENV

# fetch all sources
spack concretize --force --fresh --test root
spack-python -c "exit(not len(spack.environment.active_environment().uninstalled_specs()))" && spack fetch --dependencies --missing

# dump dag to file
spack spec -y > "${CACHE_SPECFILE}"
if [ -n "${OCI_CACHE_PREFIX}" ]; then
    # fetch missing sources (if packages not yet installed)
    python3 ${YASHCHIKI_HOME}/fetch_cached_sources.py \
        --local-cache=${SPACK_CACHE_SOURCE} \
        --remote-cache-type=oci \
        --remote-cache=${OCI_CACHE_PREFIX}/source_cache \
        --yashchiki-home=${YASHCHIKI_HOME} \
        /tmp/missing_paths_sources.dat ${CACHE_SPECFILE}
    # fetch missing build results (if packages not yet installed)
    python3 ${YASHCHIKI_HOME}/fetch_cached_buildresults.py \
        --local-cache=${SPACK_CACHE_BUILD}/build_cache \
        --remote-cache-type=oci \
        --remote-cache=${OCI_CACHE_PREFIX}/build_cache \
        --yashchiki-home=${YASHCHIKI_HOME} \
        /tmp/missing_paths_buildresults.dat ${CACHE_SPECFILE}
fi
spack-python -c "exit(not len(spack.environment.active_environment().uninstalled_specs()))" && (
    # fetch all sources but delay exit code handling
    spack fetch --dependencies --missing && ret=$? || ret=$?;
    if [ -n "${OCI_CACHE_PREFIX}" ] && [ "${UPDATE_SPACK_OCI_CACHES:-false}" = "true" ]; then
        # push freshly fetched sources to remote cache
        echo "Performing update of the source cache"
        python3 ${YASHCHIKI_HOME}/update_cached_sources.py \
            --local-cache=${SPACK_CACHE_SOURCE} \
            --remote-cache-type=oci \
            --remote-cache=${OCI_CACHE_PREFIX}/source_cache \
            /tmp/missing_paths_sources.dat;
    else
        echo "Updating of the source cache disabled."
    fi
    # if [ "$ret" -ne 0 ]; then
    #     (exit $ret)
    # fi
)

if [ -n "${OCI_CACHE_PREFIX}" ]; then
    # record the state of installed/uninstalled packages before actually installing them
    dag_hashes_pre_install=$(spack-python ${YASHCHIKI_HOME}/specfile_dag_hash.py ${CACHE_SPECFILE})
fi

# install the environment, use 2 jobs to reduce the amount of required RAM
spack install -y -j2 --fresh --test root
# delay exit code until we have updated the cache below
spack install --no-check-signature -y -j$SPACK_JOBS --fresh --test root && spack_install_ret=$? || spack_install_ret=$?

# no need to update the local cache nor the remote cache if we don't want to update
if [ -n "${OCI_CACHE_PREFIX}" ] && [ "${UPDATE_SPACK_OCI_CACHES:-false}" = "true" ]; then
    # push previously missing (but now installed) packages to the local cache
    for dag_hash in $dag_hashes_pre_install; do
        spack buildcache create --unsigned --only package ${SPACK_CACHE_BUILD} /${dag_hash} && ret=$? || ret=$?
        if [ $ret -ne 0 ]; then
            echo "Failed to push ${dag_hash}, trying to call spack find on it:"
            spack find -Lvp /${dag_hash} || true
        fi
    done

    # upload packages from local to remote cache
    echo "Performing update of the build cache"
    python3 ${YASHCHIKI_HOME}/update_cached_buildresults.py \
        --local-cache=${SPACK_CACHE_BUILD}/build_cache \
        --remote-cache-type=oci \
        --remote-cache=${OCI_CACHE_PREFIX}/build_cache \
        /tmp/missing_paths_buildresults.dat
else
    echo "Updating of the build cache disabled."
fi

# propagate spack install exit code
if [ $spack_install_ret -ne 0 ]; then
    (exit "$spack_install_ret")
fi

# remove local cache content
if [ -d ${SPACK_CACHE_BUILD} ]; then
    spack mirror destroy --mirror-name local_cache
fi

# TODO: when using spack remote OCI build caches require an index file
#spack mirror add ebrains oci://docker-registry.ebrains.eu/esd/build_cache
#spack buildcache list -a ebrains && ret=$? || ret=$?

# rebuild spack's database
spack reindex
@@ -90,7 +187,7 @@ spack reindex
# this needs deactivating the environment first:
spack env deactivate
unset SPACK_LD_LIBRARY_PATH
spack env activate --sh $EBRAINS_SPACK_ENV > $SPACK_ROOT/var/spack/environments/$EBRAINS_SPACK_ENV/load_env.sh
spack env activate --sh $EBRAINS_SPACK_ENV > ${CI_SPACK_ROOT}/var/spack/environments/$EBRAINS_SPACK_ENV/load_env.sh

# create modules files with spack
# spack module tcl refresh -y
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *
from spack.package import *

class Acpype(PythonPackage):
    """A tool based in Python to use Antechamber to generate topologies for chemical 
Original line number Diff line number Diff line
@@ -3,28 +3,31 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *
from spack.package import *


class Ambertools(CMakePackage):
    """AmberTools is a free, useful standalone package and a prerequisite for installing Amber itself.
    The AmberTools suite is free of charge, and its components are mostly released under the GNU General Public License (GPL).
    A few components are included that are in the public domain or which have other, open-source, licenses.
    The libsander and libpbsa libraries use the LGPL license."""
    """AmberTools is a free, useful standalone package and a prerequisite
    for installing Amber itself. The AmberTools suite is free of charge,
    and its components are mostly released under the GNU General Public
    License (GPL). A few components are included that are in the public
    domain or which have other, open-source, licenses. The libsander and
    libpbsa libraries use the LGPL license."""

    # Set the homepage and download url
    homepage = "http://ambermd.org/AmberTools.php"
    url      = "http://ambermd.org/downloads/AmberTools22jlmrcc.tar.bz2"
    homepage = "https://ambermd.org/AmberTools.php"
    url = "https://ambermd.org/downloads/AmberTools22jlmrcc.tar.bz2"

    # Set the gitlab accounts of this package maintainers
    maintainers = ['dbeltran', 'elmath']
    maintainers("d-beltran")

    version('22jlmrcc', sha256='1571d4e0f7d45b2a71dce5999fa875aea8c90ee219eb218d7916bf30ea229121')
    # begin EBRAINS (added): add version
    version("23_rc6", sha256="debb52e6ef2e1b4eaa917a8b4d4934bd2388659c660501a81ea044903bf9ee9d")
    # end EBRAINS
    version("22jlmrcc", sha256="1571d4e0f7d45b2a71dce5999fa875aea8c90ee219eb218d7916bf30ea229121")

    # Dependencies
    depends_on("flex",                      type="build") # This is necessary for sure (experimentally tested)
    depends_on("bison",                     type="build") # This is necessary for sure (experimentally tested)
    depends_on("flex", type="build")
    depends_on("bison", type="build")
    depends_on("tcsh", type="build")
    depends_on("zlib",                      type=("build", "link", "run"))
    depends_on("zlib", type=("build", "run"))
    depends_on("bzip2", type=("build", "run"))
    depends_on("blas", type=("build", "run"))
    depends_on("lapack", type=("build", "run"))
@@ -34,21 +37,24 @@ class Ambertools (CMakePackage):
    depends_on("fftw", type=("build", "run"))
    depends_on("readline", type=("build", "run"))
    depends_on("netlib-xblas~plain_blas", type=("build", "run"))
    # specific variants needed for boost - from the build log "Could NOT find Boost (missing: thread system program_options iostreams regex timer chrono filesystem graph)"
    depends_on("boost+thread+system+program_options+iostreams+regex+timer+chrono+filesystem+graph", type=("build", "run"))

    # Specific variants needed for boost according to build logs
    depends_on(
        "boost+thread+system+program_options+iostreams+regex+timer+chrono+filesystem+graph",
        type=("build", "run"),
    )
    # Python dependencies
    # WARNING: If a python 3.8 version is already installed in spack then the '+tkinter' variant makes spack ignore the version
    # WARNING: Spack may try to install the preferred python version (i.e. python 3.10.8)
    # WARNING: The soultion is uninstall python and reinstall with this variant
    depends_on('python@3.8: +tkinter',      type=('build', 'run'))
    # begin EBRAINS (modified): add version
    depends_on("python@3.8:3.10 +tkinter", type=("build", "run"), when="@22jlmrcc")
    depends_on("python@3.8: +tkinter", type=("build", "run"), when="@23_rc6")
    # end EBRAINS
    depends_on("py-setuptools", type="build")
    depends_on("py-numpy", type=("build", "run"))
    depends_on("py-matplotlib", type=("build", "run"))
    depends_on("py-scipy", type=("build", "run"))

    def cmake_args(self):
        # Translated from ambertools build/run_cmake script
        # We also add the TRUST_SYSTEM_LIBS argument that is mentioned in the ambertools CMake guide
        # We also add the TRUST_SYSTEM_LIBS argument mentioned in the ambertools guide
        #   https://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Guide-to-Options
        args = [
            self.define("COMPILER", "GNU"),
@@ -58,9 +64,9 @@ class Ambertools (CMakePackage):
            self.define("DOWNLOAD_MINICONDA", False),
            self.define("TRUST_SYSTEM_LIBS", True),
            # This is to avoid the x11 (X11_Xext_LIB) error
            # It is equivalent to the '-noX11' flag accoridng to the docs:
            # It is equivalent to the "-noX11" flag accoridng to the docs:
            # https://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Common-Options
            self.define("BUILD_GUI", False)
            self.define("BUILD_GUI", False),
        ]
        return args

@@ -72,7 +78,17 @@ class Ambertools (CMakePackage):
        env.set("AMBER_PREFIX", self.prefix)
        env.set("AMBERHOME", self.prefix)

    @run_after('install')
    @run_after("install")
    @on_package_attributes(run_tests=True)
    def check_install(self):
        make("test.serial")

    # Temporarily copy netcdf.h header file to netcdf-fortran/include to pass the Ambertools
    # cmake check (quickest fix, will probably cause problems, needs to change)
    @run_before("cmake")
    def fix_check(self):
        cp = Executable("cp")
        cp(
            self.spec["netcdf-c"].headers.directories[0] + "/netcdf.h",
            self.spec["netcdf-fortran"].headers.directories[0],
        )
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *
from spack.package import *


class Apbs(CMakePackage):
@@ -38,9 +38,9 @@ class Apbs(CMakePackage):
    depends_on('boost',             type=('build', 'run'))
    depends_on('blas',              type=('build', 'run'))
    depends_on('arpack-ng',         type=('build', 'run'))
    depends_on('suite-sparse+tbb',  type=('build', 'run'))
    depends_on('suite-sparse',      type=('build', 'run'))
    depends_on('maloc',             type=('build', 'run'))
    depends_on('python@3.8:3.10',   type=('build', 'run'))
    depends_on('python@3.8:3.11',   type=('build', 'run'))

    def cmake_args(self):
        # Min and max Python versions need to be set as variables to pass tests.
Original line number Diff line number Diff line
@@ -13,10 +13,15 @@ class Arbor(CMakePackage, CudaPackage):
    homepage = "https://arbor-sim.org"
    git = "https://github.com/arbor-sim/arbor.git"
    url = "https://github.com/arbor-sim/arbor/releases/download/v0.9.0/arbor-v0.9.0-full.tar.gz"
    maintainers = ["thorstenhater", "brenthuisman", "haampie"]
    maintainers = ("thorstenhater", "ErbB4", "haampie")

    version("master", branch="master")
    version("develop")
    version("master", branch="master", submodules=True)
    version("develop", branch="master", submodules=True)
    version(
        "0.10.0",
        sha256="72966b7a2f45ce259b8ba167ca3e4f5ab9f212136a300267aaac0c04ed3fe3fc",
        url="https://github.com/arbor-sim/arbor/releases/download/v0.10.1/arbor-v0.10.0-full.tar.gz",
    )
    version(
        "0.9.0",
        sha256="5f9740955c821aca81e23298c17ad64f33f635756ad9b4a0c1444710f564306a",
@@ -75,36 +80,50 @@ class Arbor(CMakePackage, CudaPackage):
    conflicts("%cce@:9.1")
    conflicts("%intel")

    # begin EBRAINS (modified: added run dep)
    depends_on("cmake@3.19:", type=("build", "run"))
    # end EBRAINS

    # misc dependencies
    depends_on("fmt@7.1:", when="@0.5.3:")  # required by the modcc compiler
    depends_on("fmt@9.1:", when="@0.7.1:")
    depends_on("googletest@1.12.1", when="@0.7.1:")
    # begin EBRAINS (modified: relaxed (upstream gave no info about update))
    # upstream adds: depends_on("fmt@10.1:", when="@0.9.1:")
    depends_on("googletest@1.12.1:", when="@0.7.1:")
    depends_on("pugixml@1.11:", when="@0.7.1:")
    depends_on("nlohmann-json@3.11.2")
    # upstream adds: depends_on("pugixml@1.13:", when="@0.9.1:")
    depends_on("nlohmann-json@3.11.2:")
    depends_on("random123")
    #upstream adds: depends_on("random123@1.14.0:", when="@0.10:")
    # end EBRAINS (modified)
    with when("+cuda"):
        depends_on("cuda@10:")
        depends_on("cuda@11:", when="@0.7.1:")
        depends_on("cuda@12:", when="@0.9.1:")

    # mpi
    # begin EBRAINS (modified: added run dep)
    depends_on("mpi", when="+mpi", type=("build", "run"))
    # end EBRAINS (modified)
    depends_on("py-mpi4py", when="+mpi+python", type=("build", "run"))

    # python (bindings)
    extends("python", when="+python")
    depends_on("python@3.7:", when="+python", type=("build", "run"))
    depends_on("py-numpy", when="+python", type=("build", "run"))
    with when("+python"):
        extends("python")
        depends_on("python@3.7:", type=("build", "run"))
        depends_on("python@3.9:", when="@0.9.1:", type=("build", "run"))
        depends_on("py-numpy", type=("build", "run"))
        depends_on("py-pybind11@2.6:", type="build")
        depends_on("py-pybind11@2.8.1:", when="@0.5.3:", type="build")
        depends_on("py-pybind11@2.10.1:", when="@0.7.1:", type="build")
        depends_on("py-pandas", type="test")
        depends_on("py-seaborn", type="test")

    # sphinx based documentation
    depends_on("python@3.7:", when="+doc", type="build")
    depends_on("py-sphinx", when="+doc", type="build")
    depends_on("py-svgwrite", when="+doc", type="build")
    with when("+doc"):
        depends_on("python@3.10:", type="build")
        depends_on("py-sphinx", type="build")
        depends_on("py-svgwrite", type="build")

    @property
    def build_targets(self):
@@ -124,10 +143,14 @@ class Arbor(CMakePackage, CudaPackage):

        # query spack for the architecture-specific compiler flags set by its wrapper
        args.append("-DARB_ARCH=none")
        opt_flags = self.spec.target.optimization_flags(
            self.spec.compiler.name, self.spec.compiler.version
        opt_flags = spack.build_environment.optimization_flags(
            self.compiler, self.spec.target
        )
        # Might return nothing
        if opt_flags:
            args.append("-DARB_CXX_FLAGS_TARGET=" + opt_flags)
        # Needed, spack has no units package
        args.append("-DARB_USE_BUNDLED_UNITS=ON")

        return args

@@ -135,3 +158,4 @@ class Arbor(CMakePackage, CudaPackage):
    @on_package_attributes(run_tests=True)
    def install_test(self):
        python("-c", "import arbor")
        python("python/example/single_cell_model.py")
+0 −16
Original line number Diff line number Diff line
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java
@@ -150,6 +150,13 @@
       builder.put("PATH", null);
       builder.put("LD_LIBRARY_PATH", null);
     }
+
+    Map<String, String> spackEnv = System.getenv();
+    for (String envName : spackEnv.keySet()) {
+      if (envName.startsWith("SPACK_")) {
+        builder.put(envName, spackEnv.get(envName));
+      }
+    }
   }
 
   private static PathFragment determineShellExecutable(OS os, PathFragment fromOption) {
+0 −16
Original line number Diff line number Diff line
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
@@ -168,6 +168,13 @@ public class BazelRuleClassProvider {
       env.put("PATH", null);
     }
 
+    Map<String, String> spackEnv = System.getenv();
+    for (String envName : spackEnv.keySet()) {
+      if (envName.startsWith("SPACK_")) {
+        env.put(envName, spackEnv.get(envName));
+      }
+    }
+
     // Shell environment variables specified via options take precedence over the
     // ones inherited from the fragments. In the long run, these fragments will
     // be replaced by appropriate default rc files anyway.

packages/bazel/build-0.29.1.patch

deleted100644 → 0
+0 −61
Original line number Diff line number Diff line
From 9c9d27561780bc56d9f0867e325c7421a94ee1cb Mon Sep 17 00:00:00 2001
From: Harsh Bhatia <bhatia4@llnl.gov>
Date: Tue, 15 Dec 2020 15:56:10 -0800
Subject: [PATCH] https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0 

---
 src/conditions/BUILD | 6 ++++++
 third_party/BUILD    | 8 ++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/conditions/BUILD b/src/conditions/BUILD
index 2b28e28057..faa41a439d 100644
--- a/src/conditions/BUILD
+++ b/src/conditions/BUILD
@@ -10,6 +10,12 @@ filegroup(
     visibility = ["//src:__pkg__"],
 )
 
+config_setting(
+    name = "linux_ppc",
+    values = {"cpu": "ppc"},
+    visibility = ["//visibility:public"],
+)
+
 config_setting(
     name = "linux_x86_64",
     values = {"cpu": "k8"},
diff --git a/third_party/BUILD b/third_party/BUILD
index 159006d741..4fcae54c00 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -523,12 +523,13 @@ UNNECESSARY_DYNAMIC_LIBRARIES = select({
     "//src/conditions:darwin": "*.so *.dll",
     "//src/conditions:darwin_x86_64": "*.so *.dll",
     "//src/conditions:linux_x86_64": "*.jnilib *.dll",
+    "//src/conditions:linux_ppc": "*.so *.jnilib *.dll",
     # The .so file is an x86 one, so we can just remove it if the CPU is not x86
     "//src/conditions:arm": "*.so *.jnilib *.dll",
     "//src/conditions:linux_aarch64": "*.so *.jnilib *.dll",
     # Play it safe -- better have a big binary than a slow binary
     # zip -d does require an argument. Supply something bogus.
-    "//conditions:default": "*.bogusextension",
+    "//conditions:default": "",
 })
 
 # Remove native libraries that are for a platform different from the one we are
@@ -537,7 +538,10 @@ genrule(
     name = "filter_netty_dynamic_libs",
     srcs = ["netty_tcnative/netty-tcnative-boringssl-static-2.0.24.Final.jar"],
     outs = ["netty_tcnative/netty-tcnative-filtered.jar"],
-    cmd = "cp $< $@ && zip -qd $@ " + UNNECESSARY_DYNAMIC_LIBRARIES,
+    cmd = "cp $< $@ && " +
+      # End successfully if there is nothing to be deleted from the archive
+      "if [ -n '" + UNNECESSARY_DYNAMIC_LIBRARIES + "' ]; then " +
+      "zip -qd $@ " + UNNECESSARY_DYNAMIC_LIBRARIES + "; fi",
 )
 
 java_import(
-- 
2.21.0 (Apple Git-122.2)
+0 −24
Original line number Diff line number Diff line
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -173,8 +173,19 @@
   else:
     inc_dirs = result.stderr[index1 + 1:index2].strip()
 
-  return [repository_ctx.path(_cxx_inc_convert(p))
-          for p in inc_dirs.split("\n")]
+  default_inc_directories = [
+    repository_ctx.path(_cxx_inc_convert(p))
+    for p in inc_dirs.split("\n")
+  ]
+
+  env = repository_ctx.os.environ
+  if "SPACK_INCLUDE_DIRS" in env:
+    for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+      default_inc_directories.append(
+        repository_ctx.path(_cxx_inc_convert(path))
+      )
+
+  return default_inc_directories
 
 def _add_option_if_supported(repository_ctx, cc, option):
   """Checks that `option` is supported by the C compiler."""
+0 −24
Original line number Diff line number Diff line
--- a/tools/cpp/cc_configure.bzl
+++ b/tools/cpp/cc_configure.bzl
@@ -200,8 +200,19 @@
   else:
     inc_dirs = result.stderr[index1 + 1:index2].strip()
 
-  return [_escape_string(repository_ctx.path(_cxx_inc_convert(p)))
-          for p in inc_dirs.split("\n")]
+  default_inc_directories = [
+    _escape_string(repository_ctx.path(_cxx_inc_convert(p)))
+    for p in inc_dirs.split("\n")
+  ]
+
+  env = repository_ctx.os.environ
+  if "SPACK_INCLUDE_DIRS" in env:
+    for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+      default_inc_directories.append(
+        repository_ctx.path(_cxx_inc_convert(path))
+      )
+
+  return default_inc_directories
 
 
 def _add_option_if_supported(repository_ctx, cc, option):

packages/bazel/compile-0.13.patch

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
--- a/compile.sh
+++ b/compile.sh
@@ -92,7 +92,7 @@
 log "Building output/bazel"
 # We set host and target platform directly since the defaults in @bazel_tools
 # have not yet been generated.
-bazel_build "src:bazel${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel${EXE_EXT}" \
   --host_platform=@bazel_tools//platforms:host_platform \
   --platforms=@bazel_tools//platforms:target_platform \
   || fail "Could not build Bazel"

packages/bazel/compile-0.16.patch

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
--- a/compile.sh
+++ b/compile.sh
@@ -92,7 +92,7 @@ display "."
 log "Building output/bazel"
 # We set host and target platform directly since the defaults in @bazel_tools
 # have not yet been generated.
-bazel_build "src:bazel_nojdk${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel_nojdk${EXE_EXT}" \
   --host_platform=@bazel_tools//platforms:host_platform \
   --platforms=@bazel_tools//platforms:target_platform \
   || fail "Could not build Bazel"

packages/bazel/compile-0.21.patch

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
--- a/compile.sh
+++ b/compile.sh
@@ -92,7 +92,7 @@ display "."
 log "Building output/bazel"
 # We set host and target platform directly since the defaults in @bazel_tools
 # have not yet been generated.
-bazel_build "src:bazel_nojdk${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel_nojdk${EXE_EXT}" \
   --action_env=PATH \
   --host_platform=@bazel_tools//platforms:host_platform \
   --platforms=@bazel_tools//platforms:target_platform \

packages/bazel/compile-0.3.patch

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
--- a/compile.sh
+++ b/compile.sh
@@ -99,7 +99,7 @@
   new_step 'Building Bazel with Bazel'
   display "."
   log "Building output/bazel"
-  bazel_build "src:bazel${EXE_EXT}"
+  CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel${EXE_EXT}"
   cp -f "bazel-bin/src/bazel${EXE_EXT}" "output/bazel${EXE_EXT}"
   chmod 0755 "output/bazel${EXE_EXT}"
   BAZEL="$(pwd)/output/bazel${EXE_EXT}"

packages/bazel/compile-0.9.patch

deleted100644 → 0
+0 −11
Original line number Diff line number Diff line
--- a/compile.sh
+++ b/compile.sh
@@ -92,7 +92,7 @@
 log "Building output/bazel"
 # We set host and target platform directly since the defaults in @bazel_tools
 # have not yet been generated.
-bazel_build "src:bazel${EXE_EXT}" \
+CC=$SPACK_CC CXX=$SPACK_CXX bazel_build "src:bazel${EXE_EXT}" \
   --host_platform=//tools/platforms:host_platform \
   --platforms=//tools/platforms:target_platform \
   || fail "Could not build Bazel"
+0 −11
Original line number Diff line number Diff line
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java.orig    2020-06-08 13:42:14.035342560 -0400
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java 2020-06-08 13:42:25.149375458 -0400
@@ -963,7 +963,7 @@
           // are, it's probably due to a non-hermetic #include, & we should stop
           // the build with an error.
           if (execPath.startsWith(execRoot)) {
-            execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
+             //  execPathFragment = execPath.relativeTo(execRoot); // funky but tolerable path
           } else {
             problems.add(execPathFragment.getPathString());
             continue;
Original line number Diff line number Diff line
diff --color=auto --color=auto -Naur a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java	1980-01-01 00:00:00
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/HeaderDiscovery.java	2024-02-15 13:36:37
@@ -143,7 +143,7 @@
               LabelConstants.EXPERIMENTAL_EXTERNAL_PATH_PREFIX.getRelative(
                   execPath.relativeTo(execRoot.getParentDirectory()));
         } else {
-          absolutePathProblems.add(execPathFragment.getPathString());
+          // absolutePathProblems.add(execPathFragment.getPathString());
           continue;
         }
       }
+0 −22
Original line number Diff line number Diff line
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -147,9 +147,18 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc, additional_flags = []):
   else:
     inc_dirs = result.stderr[index1 + 1:index2].strip()
 
-  return [_prepare_include_path(repository_ctx, _cxx_inc_convert(p))
-          for p in inc_dirs.split("\n")]
+  default_inc_directories = [
+    _prepare_include_path(repository_ctx, _cxx_inc_convert(p))
+      for p in inc_dirs.split("\n")
+  ]
+ 
+  env = repository_ctx.os.environ
+  if "SPACK_INCLUDE_DIRS" in env:
+    for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+      default_inc_directories.append(path)
+
+  return default_inc_directories
 

 def _is_option_supported(repository_ctx, cc, option):
+0 −24
Original line number Diff line number Diff line
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -117,9 +117,19 @@ def get_escaped_cxx_inc_directories(repository_ctx, cc):
   else:
     inc_dirs = result.stderr[index1 + 1:index2].strip()
 
-  return [escape_string(repository_ctx.path(_cxx_inc_convert(p)))
-          for p in inc_dirs.split("\n")]
+  default_inc_directories = [
+    escape_string(repository_ctx.path(_cxx_inc_convert(p)))
+          for p in inc_dirs.split("\n")
+  ]
 
+  env = repository_ctx.os.environ
+  if "SPACK_INCLUDE_DIRS" in env:
+    for path in env["SPACK_INCLUDE_DIRS"].split(":"):
+      default_inc_directories.append(
+        repository_ctx.path(_cxx_inc_convert(path))
+      )
+
+  return default_inc_directories
 
 def _add_option_if_supported(repository_ctx, cc, option):
   """Checks that `option` is supported by the C compiler. Doesn't %-escape the option."""

packages/biobb-common/package.py

deleted100644 → 0
+0 −38
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *

class BiobbCommon(PythonPackage):
    """Biobb_common is the base package required to use the biobb packages"""

    # Homepage and download url
    homepage = "https://github.com/bioexcel/biobb_common"
    git = 'https://github.com/bioexcel/biobb_common.git'
    url = 'https://github.com/bioexcel/biobb_common/archive/refs/tags/v4.0.0.tar.gz'

    # Set the gitlab accounts of this package maintainers
    maintainers = ['dbeltran']

    # Versions
    version('master', branch='master')
    version('4.0.0', sha256='fff990dce42ded2af3d587567dbf5321b1498f12f24d04d62003f9869d6eb8fe')

    # Dependencies
    depends_on('py-setuptools')
    depends_on('python@3.8:', type=('build', 'run'))
    depends_on('py-pyyaml', type=('build', 'run'))
    depends_on('py-requests', type=('build', 'run'))
    depends_on('py-biopython@1.78:1.80', type=('build', 'run'))

    # Custom patch to enable python 3.10.8 for this package
    def patch(self):
        filter_file("    python_requires='>=3.7,<=3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")

    # Test
    @run_after('install')
    @on_package_attributes(run_tests=True)
    def check_install (self):
        python("-c", 'import biobb_common')

packages/biobb-gromacs/package.py

deleted100644 → 0
+0 −37
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *

class BiobbGromacs(PythonPackage):
    """Biobb_gromacs is the Biobb module collection to perform molecular
    dynamics simulations using Gromacs"""

    # Homepage and download url
    homepage = "https://github.com/bioexcel/biobb_gromacs"
    git = 'https://github.com/bioexcel/biobb_gromacs.git'
    url = 'https://github.com/bioexcel/biobb_gromacs/archive/refs/tags/v4.0.0.tar.gz'

    # Set the gitlab accounts of this package maintainers
    maintainers = ['dbeltran']

    # Versions
    version('master', branch='master')
    version('4.0.0', sha256='87f9079ec8b72ff43cd1b388a06fee5b1f64bb4080ffab110941f3c6d155ef0b')

    # Dependencies
    depends_on('python@3.8:', type=('build', 'run'))
    depends_on('biobb-common')
    depends_on('gromacs')

    # Patching to enable python 3.10 (not official, might not be stable)
    def patch(self):
        filter_file("    python_requires='>=3.7,<=3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")

    # Test
    @run_after('install')
    @on_package_attributes(run_tests=True)
    def check_install (self):
        python("-c", 'import biobb_gromacs')

packages/biobb-io/package.py

deleted100644 → 0
+0 −42
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *

class BiobbIo(PythonPackage):
    """Biobb_io is the Biobb module collection to fetch data to be
    consumed by the rest of the Biobb building blocks"""

    # Homepage and download url
    homepage = "https://github.com/bioexcel/biobb_io"
    git = 'https://github.com/bioexcel/biobb_io.git'
    url = 'https://github.com/bioexcel/biobb_io/archive/refs/tags/v4.0.0.tar.gz'

    # Set the gitlab accounts of this package maintainers
    maintainers = ['dbeltran']

    # Versions
    version('master', branch='master')
    version('4.0.0', sha256='600a30f14b1a0e21f57775ba1be695e1595f5702237415fe90d7c531b5a0408a')

    # Dependencies
    depends_on('biobb-common')
    depends_on('python@3.8:', type=('build', 'run'))

    # Patching to enable python 3.10 (not official, might not be stable)
    def patch(self):
        filter_file("    python_requires='>=3.7,<3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
        filter_file(
            "'Programming Language :: Python :: 3.9'",
            "'Programming Language :: Python :: 3.9',\r\n        "
            "'Programming Language :: Python :: 3.10'",
            "setup.py",
        )

    # Test
    @run_after('install')
    @on_package_attributes(run_tests=True)
    def check_install (self):
        python("-c", 'import biobb_io')

packages/biobb-model/package.py

deleted100644 → 0
+0 −43
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *

class BiobbModel(PythonPackage):
    """Biobb_model is the Biobb module collection to check and model 3d structures,
    create mutations or reconstruct missing atoms"""

    # Homepage and download url
    homepage = "https://github.com/bioexcel/biobb_model"
    git = 'https://github.com/bioexcel/biobb_model.git'
    url = 'https://github.com/bioexcel/biobb_model/archive/refs/tags/v4.0.0.tar.gz'

    # Set the gitlab accounts of this package maintainers
    maintainers = ['dbeltran']

    # Versions
    version('master', branch='master')
    version('4.0.0', sha256='92387725b7ccd3f40d18c1d3e30a6169ca4204ba498ac72e25c9e701b1a89d91')

    # Dependencies
    depends_on('python@3.8:', type=('build', 'run'))
    depends_on('biobb-common')
    depends_on('biobb-structure-checking')

    # Patching to enable python 3.10 (not official, might not be stable)
    def patch(self):
        filter_file("    python_requires='>=3.7,<=3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
        filter_file(
            "'Programming Language :: Python :: 3.9'",
            "'Programming Language :: Python :: 3.9',\r\n        "
            "'Programming Language :: Python :: 3.10'",
            "setup.py",
        )

    # Test
    @run_after('install')
    @on_package_attributes(run_tests=True)
    def check_install (self):
        python("-c", 'import biobb_model')
+0 −36
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *

class BiobbStructureChecking(PythonPackage):
    """Biobb_structure_checking performs a checking of the quality of a 
    3D structure intended to facilitate the setup of molecular dynamics 
    simulation of protein or nucleic acids systems"""

    # Homepage and download url
    homepage = "https://github.com/bioexcel/biobb_structure_checking"
    git = 'https://github.com/bioexcel/biobb_structure_checking.git'
    url = 'https://github.com/bioexcel/biobb_structure_checking/archive/refs/tags/v3.12.1.tar.gz'

    # Set the gitlab accounts of this package maintainers
    maintainers = ['dbeltran']

    # Versions
    version('master', branch='master')
    version('3.12.1', sha256='ef3e6fe5f7763e534c91fac00bf873c3d88bcca18be7a63c63608dceb36f3d40')

    # Dependencies
    depends_on('py-setuptools')
    depends_on('python@3.8:', type=('build', 'run'))
    depends_on('py-psutil', type=('build', 'run'))
    depends_on('py-numpy', type=('build', 'run'))
    depends_on('py-biopython@1.78:1.80', type=('build', 'run'))

    # Test
    @run_after('install')
    @on_package_attributes(run_tests=True)
    def check_install (self):
        python("-c", 'import biobb_structure_checking')
+0 −43
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *

class BiobbStructureUtils(PythonPackage):
    """Biobb_structure_utils is the Biobb module collection to modify 
    or extract information from a PDB structure file."""

    # Homepage and download url
    homepage = "https://github.com/bioexcel/biobb_structure_utils"
    git = 'https://github.com/bioexcel/biobb_structure_utils.git'
    url = 'https://github.com/bioexcel/biobb_structure_utils/archive/refs/tags/v4.0.0.tar.gz'

    # Set the gitlab accounts of this package maintainers
    maintainers = ['dbeltran']

    # Versions
    version('master', branch='master')
    version('4.0.0', sha256='f328eee2166631e1cc514118eb41187620c358c8024431ce2a0b0e4547692c47')

    # Dependencies
    depends_on('python@3.8:', type=('build', 'run'))
    depends_on('biobb-common')
    depends_on('biobb-structure-checking')

    # Patching to enable python 3.10 (not official, might not be stable)
    def patch(self):
        filter_file("    python_requires='>=3.7,<=3.10',", "    python_requires='>=3.7,<3.11',", "setup.py")
        filter_file(
            "'Programming Language :: Python :: 3.9'",
            "'Programming Language :: Python :: 3.9',\r\n        "
            "'Programming Language :: Python :: 3.10'",
            "setup.py",
        )

    # Test
    @run_after('install')
    @on_package_attributes(run_tests=True)
    def check_install (self):
        python("-c", 'import biobb_structure_utils')
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ import os
import unittest.mock
import xml.etree.ElementTree as ET

from spack import *
from spack.package import *
from spack.util.environment import EnvironmentModifications
import spack.build_environment

@@ -15,10 +15,93 @@ import spack.build_environment
class BuildBrainscales(WafPackage):
    """Common stuff for BrainScaleS packages..."""

    version(
        "11.0-a3",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-11.0-a3",
        commit="4f27672655f57f41d13b44520e315398887d29ff",
        submodules=True,
    )
    version(
        "11.0-a2",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-11.0-a2",
        commit="65abdc96d737415af853a524e8c5177381a7845c",
        submodules=True,
    )
    version(
        "11.0-a1",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-11.0-a1",
        commit="1bf0f6d3c7da681d3db9401bfe0681f95d0baed1",
        submodules=True,
    )
    version(
        "10.0-a1",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-10.0-a1",
        commit="d9bd675b446be8f313972aef2d6657ffbbb91ed2",
        submodules=True,
    )
    version(
        "9.0-a9",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-9.0-a9",
        commit="41d2597bd6c1c20aee4d538c42c248195a133680",
        submodules=True,
    )
    version(
        "9.0-a8",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-9.0-a8",
        commit="44323be431da4b4b43890815f453c27207dee0b2",
        submodules=True,
    )
    version(
        "9.0-a7",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-9.0-a7",
        commit="2337adc6a33f907900d2b8be5d9f0b15872a200a",
        submodules=True,
    )
    version(
        "9.0-a6",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-9.0-a6",
        commit="e9b6746edb5e8465ae2848556b70e4edd555182e",
        submodules=True,
    )
    version(
        "9.0-a5",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-9.0-a5",
        commit="5fcb0682626d83c089e016aaf433e0938e921634",
        submodules=True,
    )
    version(
        "9.0-a4",
        git="https://github.com/electronicvisions/releases-ebrains",
        tag="ebrains-9.0-a4",
        commit="8d5be2a23ac1eb0129bdf1f83fb0a1c5193c4c85",
        submodules=True,
    )

    # common dependencies of BuildBrainscales-derived packages
    depends_on('oppulance@9.0-a9', when='@10.0-a1:', type=('build', 'link', 'run', 'test')) # keep the old one for now
    depends_on('oppulance@9.0-a9', when='@9.0-a9', type=('build', 'link', 'run', 'test'))
    depends_on('oppulance@9.0-a8', when='@9.0-a8', type=('build', 'link', 'run', 'test'))
    depends_on('oppulance@9.0-a7', when='@9.0-a7', type=('build', 'link', 'run', 'test'))
    depends_on('oppulance@9.0-a6', when='@9.0-a6', type=('build', 'link', 'run', 'test'))
    depends_on('oppulance@9.0-a5', when='@9.0-a5', type=('build', 'link', 'run', 'test'))
    depends_on('oppulance@9.0-a4', when='@9.0-a4', type=('build', 'link', 'run', 'test'))

    # waf setup performs git clone and might query gerrit
    depends_on('git', type=('build', 'link'))
    depends_on('py-git-review', type=('build', 'link'))

    # old BrainScaleS EBRAINS releases used `waf setup --project=X` to download
    # sources of the dependent repositories
    @when("@:8")
    def do_fetch(self, mirror_only=False):
        """Setup the project."""

@@ -56,6 +139,16 @@ class BuildBrainscales(WafPackage):
        with unittest.mock.patch('spack.fetch_strategy.GitFetchStrategy.archive', new=custom_archive):
            self.stage.cache_local()

    # new BrainScaleS EBRAINS releases use git submodules to download sources;
    # we still need to keep the `.git/` folders of the submodules in the source cache though
    @when("@9:")
    def do_fetch(self, mirror_only=False):
        # in the configure step, we need access to all archived .git folders
        def custom_archive(self, destination):
            super(spack.fetch_strategy.GitFetchStrategy, self).archive(destination)
        with unittest.mock.patch('spack.fetch_strategy.GitFetchStrategy.archive', new=custom_archive):
            super(BuildBrainscales, self).do_fetch(mirror_only)

    def _setup_common_env(self, env):
        # grenade needs to find some libraries for the JIT-compilation of
        # programs for BrainScaleS-2's embedded processor.
@@ -84,10 +177,18 @@ class BuildBrainscales(WafPackage):
        # spack tries to find headers and libraries by itself (i.e. it's not
        # relying on the compiler to find it); we explicitly expose the
        # spack-provided env vars that contain include and library paths
        if 'SPACK_STORE_INCLUDE_DIRS' in my_env:
            for dir in reversed(get_path(my_env, "SPACK_STORE_INCLUDE_DIRS")):
                env.prepend_path("C_INCLUDE_PATH", dir)
                env.prepend_path("CPLUS_INCLUDE_PATH", dir)
        if 'SPACK_INCLUDE_DIRS' in my_env:
            for dir in reversed(get_path(my_env, "SPACK_INCLUDE_DIRS")):
                env.prepend_path("C_INCLUDE_PATH", dir)
                env.prepend_path("CPLUS_INCLUDE_PATH", dir)
        if 'SPACK_STORE_LINK_DIRS' in my_env:
            for dir in reversed(get_path(my_env, "SPACK_STORE_LINK_DIRS")):
                env.prepend_path("LIBRARY_PATH", dir)
                env.prepend_path("LD_LIBRARY_PATH", dir)
        if 'SPACK_LINK_DIRS' in my_env:
            for dir in reversed(get_path(my_env, "SPACK_LINK_DIRS")):
                env.prepend_path("LIBRARY_PATH", dir)
@@ -112,6 +213,9 @@ class BuildBrainscales(WafPackage):

        args = ['--prefix={0}'.format(self.prefix)]
        args += self.configure_args()

        if spec.version >= Version("9"):
            self.waf('setup', '--directory=' + str(spec.name), '--repo-db-url=https://github.com/electronicvisions/projects')
        self.waf('configure', '--build-profile=release', '--disable-doxygen', *args)

    def build_args(self):
@@ -133,6 +237,7 @@ class BuildBrainscales(WafPackage):
                    if (elem.tag == 'failure') and not (
                            elem.get('message').startswith("pylint:") or
                            elem.get('message').startswith("pycodestyle:") or
                            "catchsegv: not found" in elem.get('message') or
                            ("OK" in elem.get('message') and "Segmentation fault" in elem.get('message'))):
                        raise RuntimeError("Failed test found: {}".format(testcase.get('name')))

Original line number Diff line number Diff line
from spack.package import *
import os

class BuildJupyterNotebook(Package):

    depends_on('py-notebook', type='test')

    def execute_notebook(self, input_nb, output_nb, timeout=None):
        """
        Execute a Jupyter notebook and save the executed copy.

        Args:
            input_nb (str): Path to the input notebook.
            output_nb (str): Path to the executed notebook.
            timeout (int | None): Cell execution timeout in seconds. If None, no timeout.
        """
        jupyter = Executable("jupyter")
        cmd = [
            "nbconvert",
            "--ExecutePreprocessor.kernel_name=python3",
            "--execute",
            "--to", "notebook",
            input_nb,
            "--output", output_nb,
        ]
        if timeout:
            cmd.append(f"--ExecutePreprocessor.timeout={timeout}")

        try:
            # Run notebook and save output
            jupyter(*cmd, output=str.split, error=str.split)
        except Exception as err:
            # If execution fails, re-run with --allow-errors (except on timeout)
            if "CellTimeoutError" not in str(err):
                jupyter(*cmd, "--allow-errors")
            raise

    def batch_execute_notebooks(self, notebooks, output_dir, timeout=None):
        """
        Execute a batch of Jupyter notebooks, saving outputs in the given directory.

        Args:
            notebooks (list[str]): List of notebook file paths to execute.
            output_dir (str): Directory where executed notebooks are saved.
            timeout (int | None): Execution timeout for each notebook.
        """
        mkdirp(output_dir)
        failures: list[Exception] = []

        for notebook in notebooks:
            output_path = join_path(output_dir, os.path.basename(notebook))
            try:
                self.execute_notebook(notebook, output_path, timeout=timeout)
            except Exception as err:
                failures.append(err)

        if failures:
            raise Exception(f"Notebook execution failed for {len(failures)} file(s).")
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *
from spack.package import *

# Usage
# from clb_nb_utils import oauth
+92 −0
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class Cmdstan(MakefilePackage):
    """CmdStan is the command line interface to Stan."""

    homepage = "https://mc-stan.org/users/interfaces/cmdstan"
    url = "https://github.com/stan-dev/cmdstan/releases/download/v2.30.1/cmdstan-2.30.1.tar.gz"

    license("BSD-3-Clause")

    # begin EBRAINS (added)
    version("2.37.0", sha256="635e2e1cf9c4774c9019001325354d3610bae2adc4ed5af2fed87872dfc671fc")
    # end EBRAINS
    version("2.30.1", sha256="bab76dcefa7f4c955595c0bf0496770507fc6ab0df5896e8cf8c2db0a17eedb9")

    depends_on("c", type="build")  # generated
    depends_on("cxx", type="build")  # generated
    depends_on("fortran", type="build")  # generated

    variant("threads", default=True, description="enable thread support")
    variant("opencl", default=False, description="enable OpenCl support")
    variant("mpi", default=False, description="enable MPI support")

    depends_on("opencl", when="+opencl")
    depends_on("mpi", when="+mpi")

    build_targets = ["build"]

    filter_compiler_wrappers("local", relative_root="make")

    def edit(self, spec, prefix):
        if spec.satisfies("%intel"):
            cxx_type = "icc"
        else:
            cxx_type = spec.compiler.name

        if spec.satisfies("+mpi"):
            cxx = spec["mpi"].mpicxx
        else:
            cxx = spack_cxx

        make_options = [
            "CXX={0}\n".format(cxx),
            "CXXFLAGS+= -O2 -funroll-loops\n",
            "LDFLAGS+={0}{1}\n".format(
                self.compiler.cc_rpath_arg,
                join_path(prefix, "stan", "lib", "stan_math", "lib", "tbb"),
            ),
            "STANCFLAGS+= --warn-pedantic\n",
            "TBB_CXX_TYPE={0}\n".format(cxx_type),
        ]

        if spec.satisfies("+threads"):
            make_options.append("STAN_THREADS=true\n")

        if spec.satisfies("+opencl"):
            make_options.append("STAN_OPENCL=true\n")

        if spec.satisfies("+mpi"):
            make_options.append("STAN_MPI=true\n")

        filepath = join_path(self.stage.source_path, "make", "local")
        with open(filepath, "w") as make_file:
            make_file.writelines(make_options)

    def install(self, spec, prefix):
        make(join_path("examples", "bernoulli", "bernoulli"))

        mkdir(prefix.bin)

        with working_dir(self.build_directory):
            copy("makefile", prefix)
            copy_tree("make", prefix.make)
            copy_tree("examples", prefix.examples)
            copy_tree("lib", prefix.lib)
            copy_tree("src", prefix.src)
            copy_tree("stan", prefix.stan)

        with working_dir(join_path(self.build_directory, "bin")):
            install("diagnose", prefix.bin)
            install("print", prefix.bin)
            install("stanc", prefix.bin)
            install("stansummary", prefix.bin)

    def setup_run_environment(self, env):
        env.set("CMDSTAN", self.prefix)
+409 −0
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import os
import platform

from spack.package import *

_versions = {
    # cuDNN 9.8.0
    "9.8.0.87-12": {
        "Linux-x86_64": "321b9b33bb1287404d93d5672d352f16feabc4b220ac6ae0b86e4b27f257dcf4",
        "Linux-aarch64": "f03ece3ff07d1719f06218973a8797cec1be387cc317baab5bb118dc988199e7",
    },
    "9.8.0.87-11": {
        "Linux-x86_64": "cf4dfaef8311d987d640a322f668cd5240ac3e5302abe9617dd991b5b2532758"
    },
    # cuDNN 9.2.0
    "9.2.0.82-12": {
        "Linux-x86_64": "1362b4d437e37e92c9814c3b4065db5106c2e03268e22275a5869e968cee7aa8",
        "Linux-aarch64": "24cc2a0308dfe412c02c7d41d4b07ec12dacb021ebf8c719de38eb77d22f68c1",
    },
    "9.2.0.82-11": {
        "Linux-x86_64": "99dcb3fa2bf7eed7f35b0f8e58e7d1f04d9a52e01e382efc1de16fed230d3b26"
    },
    # cuDNN 8.9.7
    "8.9.7.29-12": {
        "Linux-x86_64": "475333625c7e42a7af3ca0b2f7506a106e30c93b1aa0081cd9c13efb6e21e3bb",
        "Linux-ppc64le": "8574d291b299f9cc0134304473c9933bd098cc717e8d0876f4aba9f9eebe1b76",
    },
    "8.9.7.29-11": {
        "Linux-x86_64": "a3e2509028cecda0117ce5a0f42106346e82e86d390f4bb9475afc976c77402e",
        "Linux-ppc64le": "f23fd7d59f9d4f743fa926f317dab0d37f6ea21edb2726ceb607bea45b0f9f36",
    },
    # cuDNN 8.9.5
    "8.9.5.30-12": {
        "Linux-x86_64": "2a2eb89a2ab51071151c6082f1e816c702167a711a9372f9f73a7b5c4b06e01a",
        "Linux-ppc64le": "38388ec3c99c6646aaf5c707985cd35e25c67f653d780c4081c2df5557ab665f",
        "Linux-aarch64": "0491f7b02f55c22077eb678bf314c1f917524bd507cf5b658239bf98a47233a1",
    },
    "8.9.5.30-11": {
        "Linux-x86_64": "bbe10e3c08cd7e4aea1012213781e4fe270e1c908263444f567cafefb2cc6525",
        "Linux-ppc64le": "d678f8b2903b95de7eeaef38890c5674705864ea049b2b63e90565f2c0ea682f",
    },
    # cuDNN 8.9.0
    "8.9.0.131-12": {
        "Linux-x86_64": "477631002be61022b60961cba0a501271507a93f81d6b08384bc320cb8706c98",
        "Linux-ppc64le": "ff239e4cbbf21fa18104b62a887686e2197f820ad58817d62e509c735a331829",
        "Linux-aarch64": "fab70f4fb3b933ff502200a1d954d2c6fc205ff9c9b1d271ea4c41e980a66596",
    },
    "8.9.0.131-11": {
        "Linux-x86_64": "3cb82c50723f14b41d43523f222cd52cc9d50b3ad67c380f4be51bd1133daa2d",
        "Linux-ppc64le": "18778de490550c5b584e96560208e5e37678397037946e10a1c2824174c69725",
    },
    # cuDNN 8.8.1
    "8.8.1.3-12": {
        "Linux-x86_64": "79d77a769c7e7175abc7b5c2ed5c494148c0618a864138722c887f95c623777c",
        "Linux-ppc64le": "b0e89021a846952cad8cfc674edce2883f6e344ebd47a2394f706b1136715bc7",
    },
    "8.8.1.3-11": {
        "Linux-x86_64": "af7584cae0cc5524b5913ef08c29ba6154113c60eb0a37a0590a91b515a8a8f9",
        "Linux-ppc64le": "d086003d09d5388aa42142f07483a773aa74b602478b0933e24fc63f56f1658f",
    },
    # cuDNN 8.7.0
    "8.7.0.84-11.8": {
        "Linux-x86_64": "976c4cba7233c97ae74006afab5172976300ba40f5b250a21f8cf71f59c9f76d",
        "Linux-ppc64le": "0433d6d8b6841298e049e8a542750aa330a6e046a52ad95fae0c2f75dabe5575",
        "Linux-aarch64": "cf967f78dbf6c075243cc83aa18759e370db3754aa15b12a0a14e8bf67a3a9d4",
    },
    # cuDNN 8.6.0
    "8.6.0.163-11.8": {
        "Linux-x86_64": "bbc396df47294c657edc09c600674d608cb1bfc80b82dcf4547060c21711159e",
        "Linux-ppc64le": "c8a25e7e3df1bb9c4e18a4f24dd5f25cfd4bbe8b7054e34008e53b2be4f58a80",
        "Linux-aarch64": "a0202278d3cbd4f3adc3f7816bff6071621cb042b0903698b477acac8928ac06",
    },
    # cuDNN 8.5.0
    "8.5.0.96-11.7": {
        "Linux-x86_64": "5454a6fd94f008728caae9adad993c4e85ef36302e26bce43bea7d458a5e7b6d",
        "Linux-ppc64le": "00373c3d5e0b536a5557d0d0eb50706777f213a222b4030e1b71b1bec43d205f",
        "Linux-aarch64": "86780abbecd4634e7363fad1d000ae23b7905a5f8383bddbf7332c6934791dde",
    },
    # cuDNN 8.4.0
    "8.4.0.27-11.6": {
        "Linux-x86_64": "d19bdafd9800c79d29e6f6fffa9f9e2c10d1132d6c2ff10b1593e057e74dd050",
        "Linux-ppc64le": "7ef72353331cf42b357f53cb4a4971fb07e2f0b2ae66e03d54933df52de411c8",
        "Linux-aarch64": "3972ab37b6f0271274931f69c5675c3b61d16f8f5a2dedd422a5efd7b0f358e5",
    },
    "8.4.0.27-10.2": {
        "Linux-x86_64": "14c5e3ca4258271996d1fd959c42d17c582ce4d9aff451f84524469e784fd154"
    },
    # cuDNN 8.3.3
    "8.3.3.40-11.5": {
        "Linux-x86_64": "eabe96c75cf03ea4f5379894d914f1f8ae14ceab121989e84b0836d927fb7731",
        "Linux-ppc64le": "eaedc8dea675767f9445c11d96e6b472110d2fed728db4179153ca7da6503083",
        "Linux-aarch64": "83b1d21b0f6495dfdc2316e6d53489db8ab1b752e4e4d21caca0a08fb2136cdc",
    },
    "8.3.3.40-10.2": {
        "Linux-x86_64": "d8554f2b32e6295d5fc8f3ac25e68f94058b018c801dab9c143e36812f8926ab"
    },
    # cuDNN 8.3.2
    "8.3.2.44-11.5": {
        "Linux-x86_64": "5500953c08c5e5d1dddcfda234f9efbddcdbe43a53b26dc0a82c723fa170c457",
        "Linux-ppc64le": "0581bce48023a3ee71c3a819aaefcabe693eca18b61e2521dc5f8e6e71567b1b",
        "Linux-aarch64": "7eb8c96bfeec98e8aa7cea1e95633d2a9481fc99040eb0311d31bf137a7aa6ea",
    },
    # cuDNN 8.3.1
    "8.3.1.22-11.5": {
        "Linux-x86_64": "f5ff3c69b6a8a9454289b42eca1dd41c3527f70fcf49428eb80502bcf6b02f6e",
        "Linux-ppc64le": "1d2419a20ee193dc6a3a0ba87e79f408286d3d317c9831cbc1f0b7a268c100b0",
        "Linux-aarch64": "ff23a881366c0ee79b973a8921c6dd400628a321557550ad4e0a26a21caad263",
    },
    # cuDNN 8.2.4
    "8.2.4.15-11.4": {
        "Linux-x86_64": "0e5d2df890b9967efa6619da421310d97323565a79f05a1a8cb9b7165baad0d7",
        "Linux-ppc64le": "af8749ca83fd6bba117c8bee31b787b7f204946e864294030ee0091eb7d3577e",
        "Linux-aarch64": "48b11f19e9cd3414ec3c6c357ad228aebbd43282aae372d42cab2af67c32a08b",
    },
    # cuDNN 8.2.0
    "8.2.0.53-11.3": {
        "Linux-x86_64": "7a195dc93a7cda2bdd4d9b73958d259c784be422cd941a9a625aab75309f19dc",
        "Linux-ppc64le": "cfe06735671a41a5e25fc7542d740177ac8eab1ab146bd30f19e0fa836895611",
        "Linux-aarch64": "0f44af94eef7826dc7b41f92aade3d5210891cdb10858bc0a28ba7167909ab7c",
    },
    "8.2.0.53-10.2": {
        "Linux-x86_64": "6ecbc98b3795e940ce0831ffb7cd2c0781830fdd6b1911f950bcaf6d569f807c"
    },
    # cuDNN 8.1.1
    "8.1.1.33-11.2": {
        "Linux-x86_64": "98a8784e92862f20018d20c281b30d4a0cd951f93694f6433ccf4ae9c502ba6a",
        "Linux-ppc64le": "c3e535a5d633ad8f4d50be0b6f8efd084c6c6ed3525c07cbd89fc508b1d76c7a",
        "Linux-aarch64": "4f7e4f5698539659d51f28dff0da11e5445a5ae58439af1d8a8e9f2d93535245",
    },
    "8.1.1.33-10.2": {
        "Linux-x86_64": "2a4a7b99a6e9bfa690eb19bb41e49553f2a7a491a5b3abfcae900e166c5b6ebd"
    },
    # cuDNN 8.1.0
    "8.1.0.77-11.2": {
        "Linux-x86_64": "dbe82faf071d91ba9bcf00480146ad33f462482dfee56caf4479c1b8dabe3ecb",
        "Linux-ppc64le": "0d3f8fa21959e9f94889841cc8445aecf41d2f3c557091b447313afb43034037",
        "Linux-aarch64": "ba16ff486b68a8b50b69b32702612634954de529f39cfff68c12b8bfc1958499",
    },
    "8.1.0.77-10.2": {
        "Linux-x86_64": "c5bc617d89198b0fbe485156446be15a08aee37f7aff41c797b120912f2b14b4"
    },
    # cuDNN 8.0.5
    "8.0.5.39-11.1": {
        "Linux-x86_64": "1d046bfa79399dabcc6f6cb1507918754439442ea0ca9e0fbecdd446f9b00cce",
        "Linux-aarch64": "0c3542c51b42131247cd9f839d0ebefe4e02bb46d1716be1682cb2919278085a",
    },
    "8.0.5.39-11.0": {
        "Linux-x86_64": "4e16ee7895deb4a8b1c194b812ba49586ef7d26902051401d3717511898a9b73",
        "Linux-ppc64le": "05207a02c0b4f22464dbb0ee646693df4a70ae557640ba576ba8678c26393004",
    },
    "8.0.5.39-10.2": {
        "Linux-x86_64": "21f84c05c67bf1ec859e77c38ccd5bf154964fa1c308f449959be4c356e382f3",
        "Linux-ppc64le": "ce128ea090b05e36d00ffe921e45982ca10e8207e40cfc2e0067d0f62d9b36f9",
    },
    "8.0.5.39-10.1": {
        "Linux-x86_64": "90908495298896b33aa95063a3471f93c36627d7ac01c17dc36d75c65eea4a00",
        "Linux-ppc64le": "e43b10bb3932d5e7a598dcc726d16dc9938dd99dd319cd74b3420f3ed65fe5e0",
    },
    # cuDNN 8.0.4
    "8.0.4.30-11.1": {
        "Linux-x86_64": "8f4c662343afce5998ce963500fe3bb167e9a508c1a1a949d821a4b80fa9beab",
        "Linux-ppc64le": "b4ddb51610cbae806017616698635a9914c3e1eb14259f3a39ee5c84e7106712",
    },
    "8.0.4.30-11.0": {
        "Linux-x86_64": "38a81a28952e314e21577432b0bab68357ef9de7f6c8858f721f78df9ee60c35",
        "Linux-ppc64le": "8da8ed689b1a348182ddd3f59b6758a502e11dc6708c33f96e3b4a40e033d2e1",
    },
    "8.0.4.30-10.2": {
        "Linux-x86_64": "c12c69eb16698eacac40aa46b9ce399d4cd86efb6ff0c105142f8a28fcfb980e",
        "Linux-ppc64le": "32a5b92f9e1ef2be90e10f220c4ab144ca59d215eb6a386e93597f447aa6507e",
    },
    "8.0.4.30-10.1": {
        "Linux-x86_64": "eb4b888e61715168f57a0a0a21c281ada6856b728e5112618ed15f8637487715",
        "Linux-ppc64le": "690811bbf04adef635f4a6f480575fc2a558c4a2c98c85c7090a3a8c60dacea9",
    },
    # cuDNN 8.0.3
    "8.0.3.33-11.0": {
        "Linux-x86_64": "8924bcc4f833734bdd0009050d110ad0c8419d3796010cf7bc515df654f6065a",
        "Linux-ppc64le": "c2d0519831137b43d0eebe07522edb4ef5d62320e65e5d5fa840a9856f25923d",
    },
    "8.0.3.33-10.2": {
        "Linux-x86_64": "b3d487c621e24b5711983b89bb8ad34f0378bdbf8a1a4b86eefaa23b19956dcc",
        "Linux-ppc64le": "ff22c9c37af191c9104989d784427cde744cdde879bfebf3e4e55ca6a9634a11",
    },
    "8.0.3.33-10.1": {
        "Linux-x86_64": "4752ac6aea4e4d2226061610d6843da6338ef75a93518aa9ce50d0f58df5fb07",
        "Linux-ppc64le": "c546175f6ec86a11ee8fb9ab5526fa8d854322545769a87d35b1a505992f89c3",
    },
    # cuDNN 8.0.2
    "8.0.2.39-11.0": {
        "Linux-x86_64": "672f46288b8edd98f8d156a4f1ff518201ca6de0cff67915ceaa37f6d6d86345",
        "Linux-ppc64le": "b7c1ce5b1191eb007ba3455ea5f497fdce293a646545d8a6ed93e9bb06d7f057",
    },
    "8.0.2.39-10.2": {
        "Linux-x86_64": "c9cbe5c211360f3cfbc0fb104f0e9096b37e53f89392525679f049276b2f701f",
        "Linux-ppc64le": "c32325ff84a8123491f2e58b3694885a9a672005bc21764b38874688c0e43262",
    },
    "8.0.2.39-10.1": {
        "Linux-x86_64": "82148a68bd6bdaab93af5e05bb1842b8ccb3ab7de7bed41f609a7616c102213d",
        "Linux-ppc64le": "8196ec4f031356317baeccefbc4f61c8fccb2cf0bdef0a6431438918ddf68fb9",
    },
    # cuDNN 8.0
    "8.0.0.180-11.0": {
        "Linux-x86_64": "9e75ea70280a77de815e0bdc85d08b67e081bc99a708b574092142344d2ba07e",
        "Linux-ppc64le": "1229e94731bbca63ee7f5a239f4e1838a51a301d896f3097fbf7377d74704060",
    },
    "8.0.0.180-10.2": {
        "Linux-x86_64": "0c87c12358ee2b99d57c2a8c7560e3bb93e54bb929f5f8bec4964a72a2bb261d",
        "Linux-ppc64le": "59e4ad6db15fcc374976e8052fe39e3f30f34079710fb3c7751a64c853d9243f",
    },
    # cuDNN 7.6.5
    "7.6.5.32-10.2": {
        "Linux-x86_64": "600267f2caaed2fd58eb214ba669d8ea35f396a7d19b94822e6b36f9f7088c20",
        "Linux-ppc64le": "7dc08b6ab9331bfd12207d4802c61db1ad7cace7395b67a6e7b16efa0335668b",
    },
    "7.6.5.32-10.1": {
        "Linux-x86_64": "7eaec8039a2c30ab0bc758d303588767693def6bf49b22485a2c00bf2e136cb3",
        "Darwin-x86_64": "8ecce28a5ed388a2b9b2d239e08d7c550f53b79288e6d9e5eb4c152bfc711aff",
        "Linux-ppc64le": "97b2faf73eedfc128f2f5762784d21467a95b2d5ba719825419c058f427cbf56",
    },
    "7.6.5.32-10.0": {
        "Linux-x86_64": "28355e395f0b2b93ac2c83b61360b35ba6cd0377e44e78be197b6b61b4b492ba",
        "Darwin-x86_64": "6fa0b819374da49102e285ecf7fcb8879df4d0b3cc430cc8b781cdeb41009b47",
        "Linux-ppc64le": "b1717f4570083bbfc6b8b59f280bae4e4197cc1cb50e9d873c05adf670084c5b",
    },
    "7.6.5.32-9.2": {
        "Linux-x86_64": "a2a2c7a8ba7b16d323b651766ee37dcfdbc2b50d920f73f8fde85005424960e4",
        "Linux-ppc64le": "a11f44f9a827b7e69f527a9d260f1637694ff7c1674a3e46bd9ec054a08f9a76",
    },
    "7.6.5.32-9.0": {
        "Linux-x86_64": "bd0a4c0090d5b02feec3f195738968690cc2470b9bc6026e6fe8ff245cd261c8"
    },
    # cuDNN 7.6.4
    "7.6.4.38-10.1": {
        "Linux-x86_64": "32091d115c0373027418620a09ebec3658a6bc467d011de7cdd0eb07d644b099",
        "Darwin-x86_64": "bfced062c3689ced2c1fb49c7d5052e6bc3da6974c1eb707e4dcf8cd209d4236",
        "Linux-ppc64le": "f3615fea50986a4dfd05d7a0cf83396dfdceefa9c209e8bf9691e20a48e420ce",
    },
    "7.6.4.38-10.0": {
        "Linux-x86_64": "417bb5daf51377037eb2f5c87649000ca1b9cec0acb16cfe07cb1d3e9a961dbf",
        "Darwin-x86_64": "af01ab841caec25087776a6b8fc7782883da12e590e24825ad1031f9ae0ed4b1",
        "Linux-ppc64le": "c1725ad6bd7d7741e080a1e6da4b62eac027a94ac55c606cce261e3f829400bb",
    },
    "7.6.4.38-9.2": {
        "Linux-x86_64": "c79156531e641289b6a6952888b9637059ef30defd43c3cf82acf38d67f60a27",
        "Linux-ppc64le": "98d8aae2dcd851558397a9a30b73242f257e1556be17c83650e63a0685969884",
    },
    "7.6.4.38-9.0": {
        "Linux-x86_64": "8db78c3623c192d4f03f3087b41c32cb0baac95e13408b5d9dabe626cb4aab5d"
    },
    # cuDNN 7.6.3
    "7.6.3.30-10.1": {
        "Linux-x86_64": "352557346d8111e2f954c494be1a90207103d316b8777c33e62b3a7f7b708961",
        "Linux-ppc64le": "f274735a8fc31923d3623b1c3d2b1d0d35bb176687077c6a4d4353c6b900d8ee",
    },
    # cuDNN 7.5.1
    "7.5.1.10-10.1": {
        "Linux-x86_64": "2c833f43c9147d9a25a20947a4c5a5f5c33b2443240fd767f63b330c482e68e0",
        "Linux-ppc64le": "a9e23bc83c970daec20874ccd1d8d80b648adf15440ecd0164818b330b1e2663",
    },
    "7.5.1.10-10.0": {
        "Linux-x86_64": "c0a4ec438920aa581dd567117b9c316745b4a451ac739b1e04939a3d8b229985",
        "Linux-ppc64le": "d9205718da5fbab85433476f9ff61fcf4b889d216d6eea26753bbc24d115dd70",
    },
    # cuDNN 7.5.0
    "7.5.0.56-10.1": {
        "Linux-x86_64": "c31697d6b71afe62838ad2e57da3c3c9419c4e9f5635d14b683ebe63f904fbc8",
        "Linux-ppc64le": "15415eb714ab86ab6c7531f2cac6474b5dafd989479b062776c670b190e43638",
    },
    "7.5.0.56-10.0": {
        "Linux-x86_64": "701097882cb745d4683bb7ff6c33b8a35c7c81be31bac78f05bad130e7e0b781",
        "Linux-ppc64le": "f0c1cbd9de553c8e2a3893915bd5fff57b30e368ef4c964d783b6a877869e93a",
    },
    # cuDNN 7.3.0
    "7.3.0.29-9.0": {
        "Linux-x86_64": "403f9043ff2c7b2c5967454872275d07bca11fd41dfc7b21995eadcad6dbe49b"
    },
    # cuDNN 7.2.1
    "7.2.1.38-9.0": {
        "Linux-x86_64": "cf007437b9ac6250ec63b89c25f248d2597fdd01369c80146567f78e75ce4e37"
    },
    # cuDNN 7.1.3
    "7.1.3-9.1": {
        "Linux-x86_64": "dd616d3794167ceb923d706bf73e8d6acdda770751492b921ee6827cdf190228",
        "Linux-ppc64le": "e3b4837f711b98a52faacc872a68b332c833917ef3cf87c0108f1d01af9b2931",
    },
    # cuDNN 6.0
    "6.0-8.0": {
        "Linux-x86_64": "9b09110af48c9a4d7b6344eb4b3e344daa84987ed6177d5c44319732f3bb7f9c"
    },
    # cuDNN 5.1
    "5.1-8.0": {
        "Linux-x86_64": "c10719b36f2dd6e9ddc63e3189affaa1a94d7d027e63b71c3f64d449ab0645ce"
    },
}


class Cudnn(Package):
    """NVIDIA cuDNN is a GPU-accelerated library of primitives for deep
    neural networks"""

    homepage = "https://developer.nvidia.com/cudnn"

    # Latest versions available at:
    #     https://developer.nvidia.com/rdp/cudnn-download
    # Archived versions available at:
    #     https://developer.nvidia.com/rdp/cudnn-archive
    # Note that download links don't work from command line,
    # need to use modified URLs like in url_for_version.
    maintainers("adamjstewart", "bvanessen")

    skip_version_audit = ["platform=darwin", "platform=windows"]

    license("MIT")

    for ver, packages in _versions.items():
        key = "{0}-{1}".format(platform.system(), platform.machine())
        pkg = packages.get(key)
        cudnn_ver, cuda_ver = ver.split("-")
        long_ver = "{0}-{1}".format(cudnn_ver, cuda_ver)
        if pkg:
            version(long_ver, sha256=pkg)
            # Add constraints matching CUDA version to cuDNN version
            # cuDNN builds for CUDA 11.x are compatible with all CUDA 11.x:
            # https://docs.nvidia.com/deeplearning/cudnn/support-matrix/index.html#fntarg_2
            if Version(cuda_ver) >= Version("11"):
                cuda_ver = Version(cuda_ver).up_to(1)
            depends_on("cuda@{}".format(cuda_ver), when="@{}".format(long_ver))

    def url_for_version(self, version):
        # Get the system and machine arch for building the file path
        sys = "{0}-{1}".format(platform.system(), platform.machine())
        # Munge it to match Nvidia's naming scheme
        sys_key = sys.lower()
        if version < Version("8.3.1"):
            sys_key = (
                sys_key.replace("x86_64", "x64")
                .replace("darwin", "osx")
                .replace("aarch64", "aarch64sbsa")
            )
        elif version < Version("8.8.0"):
            sys_key = sys_key.replace("aarch64", "sbsa")

        if version >= Version("8.3.1"):
            # NOTE: upload layout changed for 8.3.1, they include a 10.2
            # artifact for cuda@10.2 x86_64, but the runtime is only supported
            # for cuda@11.  See
            # https://docs.nvidia.com/deeplearning/cudnn/release-notes/rel_8.html
            # As such, hacking the `directory` to include the extra
            # local_installers/11.5 is included as this may not happen again.
            directory = version[:3]
            ver = version[:4]
            cuda = version[4:]
            directory = "{0}/local_installers/{1}".format(directory, cuda)
        elif version >= Version("7.2"):
            directory = version[:3]
            ver = version[:4]
            cuda = version[4:]
        elif version >= Version("7.1"):
            directory = version[:3]
            ver = version[:2]
            cuda = version[3:]
        elif version >= Version("7.0"):
            directory = version[:3]
            ver = version[0]
            cuda = version[3:]
        else:
            directory = version[:2]
            ver = version[:2]
            cuda = version[2:]

        # 8.8.0 changed the base url again
        if version >= Version("8.8.0"):
            url = "https://developer.download.nvidia.com/compute/cudnn/redist/cudnn/{0}/cudnn-{0}-{1}_cuda{2}-archive.tar.xz"
            return url.format(sys_key, ver, cuda.up_to(1))
        # 8.5.0 removed minor from cuda version
        elif version >= Version("8.5.0"):
            url = "https://developer.download.nvidia.com/compute/redist/cudnn/v{0}/cudnn-{1}-{2}_cuda{3}-archive.tar.xz"
            return url.format(directory, sys_key, ver, cuda.up_to(1))
        # 8.3.1 switched to xzip tarballs and reordered url parts.
        elif version >= Version("8.3.1"):
            url = "https://developer.download.nvidia.com/compute/redist/cudnn/v{0}/cudnn-{1}-{2}_cuda{3}-archive.tar.xz"
            return url.format(directory, sys_key, ver, cuda)
        else:
            url = "https://developer.download.nvidia.com/compute/redist/cudnn/v{0}/cudnn-{1}-{2}-v{3}.tgz"
            return url.format(directory, cuda, sys_key, ver)

    def setup_run_environment(self, env):
        # Package is not compiled, and does not work unless LD_LIBRARY_PATH is set
        env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)

        if self.spec.satisfies("target=ppc64le: platform=linux"):
            env.set("cuDNN_ROOT", os.path.join(self.prefix, "targets", "ppc64le-linux"))

    def install(self, spec, prefix):
        install_tree(".", prefix)

        if spec.satisfies("target=ppc64le: platform=linux"):
            target_lib = os.path.join(prefix, "targets", "ppc64le-linux", "lib")
            if os.path.isdir(target_lib) and not os.path.isdir(prefix.lib):
                symlink(target_lib, prefix.lib)
            target_include = os.path.join(prefix, "targets", "ppc64le-linux", "include")
            if os.path.isdir(target_include) and not os.path.isdir(prefix.include):
                symlink(target_include, prefix.include)

packages/gcc/darwin/apfs.patch

deleted100644 → 0
+0 −12
Original line number Diff line number Diff line
diff -uNr gcc-7.2.0.orig/libstdc++-v3/include/Makefile.in gcc-7.2.0/libstdc++-v3/include/Makefile.in
--- gcc-7.2.0.orig/libstdc++-v3/include/Makefile.in     2017-07-25 14:05:07.000000000 -0400
+++ gcc-7.2.0/libstdc++-v3/include/Makefile.in  2017-09-02 12:22:08.000000000 -0400
@@ -1764,6 +1764,8 @@
 @GLIBCXX_HOSTED_TRUE@install-data-local: install-headers
 @GLIBCXX_HOSTED_FALSE@install-data-local: install-freestanding-headers
 
+.NOTPARALLEL: install-headers
+
 # This is a subset of the full install-headers rule.  We only need <ciso646>,
 # <cstddef>, <cfloat>, <limits>, <climits>, <cstdint>, <cstdlib>, <new>,
 # <typeinfo>, <exception>, <initializer_list>, <cstdalign>, <cstdarg>,

packages/gcc/darwin/clang13.patch

deleted100644 → 0
+0 −32
Original line number Diff line number Diff line
--- a/gcc/genconditions.c	2019-01-01 12:37:19.064943662 +0100
+++ b/gcc/genconditions.c	2019-10-11 10:57:11.464595789 +0200
@@ -57,8 +57,9 @@ write_header (void)
 \n\
 /* It is necessary, but not entirely safe, to include the headers below\n\
    in a generator program.  As a defensive measure, don't do so when the\n\
-   table isn't going to have anything in it.  */\n\
-#if GCC_VERSION >= 3001\n\
+   table isn't going to have anything in it.\n\
+   Clang 9 is buggy and doesn't handle __builtin_constant_p correctly.  */\n\
+#if GCC_VERSION >= 3001 && __clang_major__ < 9\n\
 \n\
 /* Do not allow checking to confuse the issue.  */\n\
 #undef CHECKING_P\n\
@@ -170,7 +171,7 @@ struct c_test\n\
    vary at run time.  It works in 3.0.1 and later; 3.0 only when not\n\
    optimizing.  */\n\
 \n\
-#if GCC_VERSION >= 3001\n\
+#if GCC_VERSION >= 3001 && __clang_major__ < 9\n\
 static const struct c_test insn_conditions[] = {\n");
 
   traverse_c_tests (write_one_condition, 0);
@@ -191,7 +192,7 @@ write_writer (void)
 	"  unsigned int i;\n"
         "  const char *p;\n"
         "  puts (\"(define_conditions [\");\n"
-	"#if GCC_VERSION >= 3001\n"
+	"#if GCC_VERSION >= 3001 && __clang_major__ < 9\n"
 	"  for (i = 0; i < ARRAY_SIZE (insn_conditions); i++)\n"
 	"    {\n"
 	"      printf (\"  (%d \\\"\", insn_conditions[i].value);\n"
+0 −42
Original line number Diff line number Diff line
diff --git a/gcc/configure b/gcc/configure
index 9523773..52b0bf7 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -24884,7 +24884,7 @@ if test "${gcc_cv_as_ix86_filds+set}" = set; then :
 else
   gcc_cv_as_ix86_filds=no
   if test x$gcc_cv_as != x; then
-    $as_echo 'filds mem; fists mem' > conftest.s
+    $as_echo 'filds (%ebp); fists (%ebp)' > conftest.s
     if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
@@ -24915,7 +24915,7 @@ if test "${gcc_cv_as_ix86_fildq+set}" = set; then :
 else
   gcc_cv_as_ix86_fildq=no
   if test x$gcc_cv_as != x; then
-    $as_echo 'fildq mem; fistpq mem' > conftest.s
+    $as_echo 'fildq (%ebp); fistpq (%ebp)' > conftest.s
     if { ac_try='$gcc_cv_as $gcc_cv_as_flags  -o conftest.o conftest.s >&5'
   { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
   (eval $ac_try) 2>&5
diff --git a/gcc/configure.ac b/gcc/configure.ac
index 68b0ee8..bd53978 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3869,13 +3869,13 @@ foo:	nop
 
     gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
        gcc_cv_as_ix86_filds,,,
-       [filds mem; fists mem],,
+       [filds (%ebp); fists (%ebp)],,
        [AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
          [Define if your assembler uses filds and fists mnemonics.])])
 
     gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics],
        gcc_cv_as_ix86_fildq,,,
-       [fildq mem; fistpq mem],,
+       [fildq (%ebp); fistpq (%ebp)],,
        [AC_DEFINE(HAVE_AS_IX86_FILDQ, 1,
          [Define if your assembler uses fildq and fistq mnemonics.])])
 
+0 −28
Original line number Diff line number Diff line
From 82f81877458ea372176eabb5de36329431dce99b Mon Sep 17 00:00:00 2001
From: Iain Sandoe <iain@codesourcery.com>
Date: Sat, 21 Dec 2013 00:30:18 +0000
Subject: [PATCH] don't try to mark local symbols as no-dead-strip

---
 gcc/config/darwin.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index 40804b8..0080299 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -1259,6 +1259,11 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
 void
 darwin_mark_decl_preserved (const char *name)
 {
+  /* Actually we shouldn't mark any local symbol this way, but for now
+     this only happens with ObjC meta-data.  */
+  if (darwin_label_is_anonymous_local_objc_name (name))
+    return;
+
   fprintf (asm_out_file, "\t.no_dead_strip ");
   assemble_name (asm_out_file, name);
   fputc ('\n', asm_out_file);
-- 
2.2.1
+0 −21
Original line number Diff line number Diff line
# Fix for libgccjit.so linkage on Darwin
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64089
# https://github.com/Homebrew/homebrew-core/issues/1872#issuecomment-225625332
# https://github.com/Homebrew/homebrew-core/issues/1872#issuecomment-225626490

# Stolen from Homebrew:
# https://raw.githubusercontent.com/Homebrew/formula-patches/e9e0ee09389a54cc4c8fe1c24ebca3cd765ed0ba/gcc/6.1.0-jit.patch
diff --git a/gcc/jit/Make-lang.in b/gcc/jit/Make-lang.in
index 44d0750..4df2a9c 100644
--- a/gcc/jit/Make-lang.in
+++ b/gcc/jit/Make-lang.in
@@ -85,8 +85,7 @@ $(LIBGCCJIT_FILENAME): $(jit_OBJS) \
	     $(jit_OBJS) libbackend.a libcommon-target.a libcommon.a \
	     $(CPPLIB) $(LIBDECNUMBER) $(LIBS) $(BACKENDLIBS) \
	     $(EXTRA_GCC_OBJS) \
-	     -Wl,--version-script=$(srcdir)/jit/libgccjit.map \
-	     -Wl,-soname,$(LIBGCCJIT_SONAME)
+	     -Wl,-install_name,$(LIBGCCJIT_SONAME)

 $(LIBGCCJIT_SONAME_SYMLINK): $(LIBGCCJIT_FILENAME)
	ln -sf $(LIBGCCJIT_FILENAME) $(LIBGCCJIT_SONAME_SYMLINK)
+0 −19
Original line number Diff line number Diff line
# Use -headerpad_max_install_names in the build,
# otherwise lto1 load commands cannot be edited on El Capitan

# Stolen from Homebrew:
# https://raw.githubusercontent.com/Homebrew/formula-patches/32cf103/gcc/7.1.0-headerpad.patch

diff --git a/config/mh-darwin b/config/mh-darwin
index 148b730..c2318b5 100644
--- a/config/mh-darwin
+++ b/config/mh-darwin
@@ -16,7 +16,7 @@ DARWIN_GCC_MDYNAMIC_NO_PIC := \
 DARWIN_NO_PIE := `case ${host} in *-*-darwin[1][1-9]*) echo -Wl,-no_pie ;; esac;`
 
 BOOT_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC)
-BOOT_LDFLAGS += $(DARWIN_NO_PIE)
+BOOT_LDFLAGS += $(DARWIN_NO_PIE) -Wl,-headerpad_max_install_names
 
 # Similarly, for cross-compilation.
 STAGE1_CFLAGS += $(DARWIN_MDYNAMIC_NO_PIC)
+0 −127
Original line number Diff line number Diff line
diff -pur fixincludes/fixincl.x gcc-5.5.0/fixincludes/fixincl.x
--- a/fixincludes/fixincl.x	2017-01-30 17:08:42.000000000 +0100
+++ b/fixincludes/fixincl.x	2017-12-21 14:34:35.000000000 +0100
@@ -1,12 +1,12 @@
 /*  -*- buffer-read-only: t -*- vi: set ro:
- * 
+ *
  * DO NOT EDIT THIS FILE   (fixincl.x)
- * 
- * It has been AutoGen-ed  January  5, 2017 at 06:05:06 PM by AutoGen 5.16.2
+ *
+ * It has been AutoGen-ed  December 21, 2017 at 02:34:35 PM by AutoGen 5.18.7
  * From the definitions    inclhack.def
  * and the template file   fixincl
  */
-/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Jan  5 18:05:06 CET 2017
+/* DO NOT SVN-MERGE THIS FILE, EITHER Thu Dec 21 14:34:35 CET 2017
  *
  * You must regenerate it.  Use the ./genfixes script.
  *
@@ -15,7 +15,7 @@
  * certain ANSI-incompatible system header files which are fixed to work
  * correctly with ANSI C and placed in a directory that GNU C will search.
  *
- * This file contains 240 fixup descriptions.
+ * This file contains 241 fixup descriptions.
  *
  * See README for more information.
  *
@@ -2579,6 +2579,43 @@ extern \"C\" {\n\
 
 /* * * * * * * * * * * * * * * * * * * * * * * * * *
  *
+ *  Description of Darwin_Osavailability fix
+ */
+tSCC zDarwin_OsavailabilityName[] =
+     "darwin_osavailability";
+
+/*
+ *  File name selection pattern
+ */
+tSCC zDarwin_OsavailabilityList[] =
+  "os/availability.h\0";
+/*
+ *  Machine/OS name selection pattern
+ */
+tSCC* apzDarwin_OsavailabilityMachs[] = {
+        "*-*-darwin*",
+        (const char*)NULL };
+
+/*
+ *  content selection pattern - do fix if pattern found
+ */
+tSCC zDarwin_OsavailabilitySelect0[] =
+       "#define[ \t]+__(API_[A-Z_]*)\\(\\.\\.\\.\\)";
+
+#define    DARWIN_OSAVAILABILITY_TEST_CT  1
+static tTestDesc aDarwin_OsavailabilityTests[] = {
+  { TT_EGREP,    zDarwin_OsavailabilitySelect0, (regex_t*)NULL }, };
+
+/*
+ *  Fix Command Arguments for Darwin_Osavailability
+ */
+static const char* apzDarwin_OsavailabilityPatch[] = {
+    "format",
+    "#define %1(...)",
+    (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
  *  Description of Darwin_9_Long_Double_Funcs_2 fix
  */
 tSCC zDarwin_9_Long_Double_Funcs_2Name[] =
@@ -9818,9 +9855,9 @@ static const char* apzX11_SprintfPatch[]
  *
  *  List of all fixes
  */
-#define REGEX_COUNT          276
+#define REGEX_COUNT          277
 #define MACH_LIST_SIZE_LIMIT 187
-#define FIX_COUNT            240
+#define FIX_COUNT            241
 
 /*
  *  Enumerate the fixes
@@ -9885,6 +9922,7 @@ typedef enum {
     CTRL_QUOTES_DEF_FIXIDX,
     CTRL_QUOTES_USE_FIXIDX,
     CXX_UNREADY_FIXIDX,
+    DARWIN_OSAVAILABILITY_FIXIDX,
     DARWIN_9_LONG_DOUBLE_FUNCS_2_FIXIDX,
     DARWIN_EXTERNC_FIXIDX,
     DARWIN_GCC4_BREAKAGE_FIXIDX,
@@ -10364,6 +10402,11 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
      CXX_UNREADY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
      aCxx_UnreadyTests,   apzCxx_UnreadyPatch, 0 },
 
+  {  zDarwin_OsavailabilityName,    zDarwin_OsavailabilityList,
+     apzDarwin_OsavailabilityMachs,
+     DARWIN_OSAVAILABILITY_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+     aDarwin_OsavailabilityTests,   apzDarwin_OsavailabilityPatch, 0 },
+
   {  zDarwin_9_Long_Double_Funcs_2Name,    zDarwin_9_Long_Double_Funcs_2List,
      apzDarwin_9_Long_Double_Funcs_2Machs,
      DARWIN_9_LONG_DOUBLE_FUNCS_2_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
diff -pur fixincludes/inclhack.def gcc-5.5.0/fixincludes/inclhack.def
--- a/fixincludes/inclhack.def	2017-01-30 17:08:42.000000000 +0100
+++ b/fixincludes/inclhack.def	2017-12-21 14:34:28.000000000 +0100
@@ -1337,6 +1337,18 @@ fix = {
     test_text = "extern void* malloc( size_t );";
 };
 
+fix = {
+    hackname  = darwin_osavailability;
+    mach      = "*-*-darwin*";
+    files     = os/availability.h;
+    select    = "#define[ \t]+__(API_[A-Z_]*)\\(\\.\\.\\.\\)";
+    c_fix     = format;
+    c_fix_arg = "#define %1(...)";
+
+    test_text = "#define __API_AVAILABLE(...)\n"
+		"#define API_AVAILABLE(...)\n";
+};
+
 /*
  *  For the AAB_darwin7_9_long_double_funcs fix to be useful,
  *  you have to not use "" includes.

packages/gcc/detection_test.yaml

deleted100644 → 0
+0 −38
Original line number Diff line number Diff line
paths:
  # Ubuntu 18.04, system compilers without Fortran
  - layout:
      - executables:
        - "bin/gcc"
        - "bin/g++"
        script: "echo 7.5.0"
    results:
      - spec: "gcc@7.5.0 languages=c,c++"
  # Mock a version < 7 of GCC that requires -dumpversion and
  # errors with -dumpfullversion
  - layout:
      - executables:
        - "bin/gcc-5"
        - "bin/g++-5"
        - "bin/gfortran-5"
        script: |
          if [[ "$1" == "-dumpversion" ]] ; then
            echo "5.5.0"
          else
            echo "gcc-5: fatal error: no input files"
            echo "compilation terminated."
            exit 1
          fi
    results:
      - spec: "gcc@5.5.0 languages=c,c++,fortran"
  # Multiple compilers present at the same time
  - layout:
      - executables:
        - "bin/x86_64-linux-gnu-gcc-6"
        script: 'echo 6.5.0'
      - executables:
        - "bin/x86_64-linux-gnu-gcc-10"
        - "bin/x86_64-linux-gnu-g++-10"
        script: "echo 10.1.0"
    results:
      - spec: "gcc@6.5.0 languages=c"
      - spec: "gcc@10.1.0 languages=c,c++"
 No newline at end of file

packages/gcc/gcc-backport.patch

deleted100644 → 0
+0 −138
Original line number Diff line number Diff line
2016-02-20  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	Backported from mainline
	2016-02-19  Jakub Jelinek  <jakub@redhat.com>
		    Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* Make-lang.in: Invoke gperf with -L C++.
 	* cfns.gperf: Remove prototypes for hash and libc_name_p
 	inlines.
 	* cfns.h: Regenerated.
	* except.c (nothrow_libfn_p): Adjust.

Index: gcc/cp/Make-lang.in
===================================================================
--- a/gcc/cp/Make-lang.in	(revision 233574)
+++ b/gcc/cp/Make-lang.in	(working copy)
@@ -111,7 +111,7 @@ else
 # deleting the $(srcdir)/cp/cfns.h file.
 $(srcdir)/cp/cfns.h:
 endif
-	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L ANSI-C \
+	gperf -o -C -E -k '1-6,$$' -j1 -D -N 'libc_name_p' -L C++ \
 		$(srcdir)/cp/cfns.gperf --output-file $(srcdir)/cp/cfns.h
 
 #
Index: gcc/cp/cfns.gperf
===================================================================
--- a/gcc/cp/cfns.gperf	(revision 233574)
+++ b/gcc/cp/cfns.gperf	(working copy)
@@ -1,3 +1,5 @@
+%language=C++
+%define class-name libc_name
 %{
 /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
 
@@ -16,14 +18,6 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
-#ifdef __GNUC__
-__inline
-#endif
-static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
-const char * libc_name_p (const char *, unsigned int);
 %}
 %%
 # The standard C library functions, for feeding to gperf; the result is used
Index: gcc/cp/cfns.h
===================================================================
--- a/gcc/cp/cfns.h	(revision 233574)
+++ b/gcc/cp/cfns.h	(working copy)
@@ -1,5 +1,5 @@
-/* ANSI-C code produced by gperf version 3.0.3 */
-/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L ANSI-C cfns.gperf  */
+/* C++ code produced by gperf version 3.0.4 */
+/* Command-line: gperf -o -C -E -k '1-6,$' -j1 -D -N libc_name_p -L C++ --output-file cfns.h cfns.gperf  */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
       && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
@@ -28,7 +28,7 @@
 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>."
 #endif
 
-#line 1 "cfns.gperf"
+#line 3 "cfns.gperf"
 
 /* Copyright (C) 2000-2015 Free Software Foundation, Inc.
 
@@ -47,26 +47,19 @@ for more details.
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING3.  If not see
 <http://www.gnu.org/licenses/>.  */
-#ifdef __GNUC__
-__inline
-#endif
-static unsigned int hash (const char *, unsigned int);
-#ifdef __GNUC__
-__inline
-#endif
-const char * libc_name_p (const char *, unsigned int);
 /* maximum key range = 391, duplicates = 0 */
 
-#ifdef __GNUC__
-__inline
-#else
-#ifdef __cplusplus
-inline
-#endif
-#endif
-static unsigned int
-hash (register const char *str, register unsigned int len)
+class libc_name
 {
+private:
+  static inline unsigned int hash (const char *str, unsigned int len);
+public:
+  static const char *libc_name_p (const char *str, unsigned int len);
+};
+
+inline unsigned int
+libc_name::hash (register const char *str, register unsigned int len)
+{
   static const unsigned short asso_values[] =
     {
       400, 400, 400, 400, 400, 400, 400, 400, 400, 400,
@@ -122,14 +115,8 @@ along with GCC; see the file COPYING3.  If not see
   return hval + asso_values[(unsigned char)str[len - 1]];
 }
 
-#ifdef __GNUC__
-__inline
-#ifdef __GNUC_STDC_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
 const char *
-libc_name_p (register const char *str, register unsigned int len)
+libc_name::libc_name_p (register const char *str, register unsigned int len)
 {
   enum
     {
Index: gcc/cp/except.c
===================================================================
--- a/gcc/cp/except.c	(revision 233574)
+++ b/gcc/cp/except.c	(working copy)
@@ -1040,7 +1040,8 @@ nothrow_libfn_p (const_tree fn)
      unless the system headers are playing rename tricks, and if
      they are, we don't want to be confused by them.  */
   id = DECL_NAME (fn);
-  return !!libc_name_p (IDENTIFIER_POINTER (id), IDENTIFIER_LENGTH (id));
+  return !!libc_name::libc_name_p (IDENTIFIER_POINTER (id),
+				   IDENTIFIER_LENGTH (id));
 }
 
 /* Returns nonzero if an exception of type FROM will be caught by a
Original line number Diff line number Diff line
From ce9568e9e9cf6094be30e748821421e703754ffc Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 8 Nov 2019 19:53:18 +0100
Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
 bootstrap due to libsanitizer)

	Backported from mainline
	2019-10-22  Tamar Christina  <tamar.christina@arm.com>
	Backported for version 5.3.0 <= gcc <= 6.5.0
	2020-06-05  John L. Jolly  <john.jolly@gmail.com>

	PR sanitizer/92154
	* sanitizer_common/sanitizer_platform_limits_posix.cc:
	Cherry-pick compiler-rt revision r375220.

From-SVN: r277981
---
 libsanitizer/ChangeLog                                   | 9 +++++++++
 .../sanitizer_common/sanitizer_platform_limits_posix.cc  | 6 +++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 6cd4a5bac8b0..06a605ff4670 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1130,8 +1130,12 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 #ifndef __GLIBC_PREREQ
 #define __GLIBC_PREREQ(x, y) 0
 #endif
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
+    !defined(__arm__)
 /* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+/* On Arm glibc 2.31 and later provide a different mode field, this field is
+   never used by libsanitizer so we can simply ignore this assert for all glibc
+   versions.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif
 
+0 −37
Original line number Diff line number Diff line
From ce9568e9e9cf6094be30e748821421e703754ffc Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 8 Nov 2019 19:53:18 +0100
Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
 bootstrap due to libsanitizer)

	Backported from mainline
	2019-10-22  Tamar Christina  <tamar.christina@arm.com>

	PR sanitizer/92154
	* sanitizer_common/sanitizer_platform_limits_posix.cc:
	Cherry-pick compiler-rt revision r375220.

From-SVN: r277981
---
 libsanitizer/ChangeLog                                   | 9 +++++++++
 .../sanitizer_common/sanitizer_platform_limits_posix.cc  | 6 +++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 6cd4a5bac8b0..06a605ff4670 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1156,8 +1156,12 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
+    !defined(__arm__)
 /* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
+/* On Arm glibc 2.31 and later provide a different mode field, this field is
+   never used by libsanitizer so we can simply ignore this assert for all glibc
+   versions.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif
 
Original line number Diff line number Diff line
From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 20 Dec 2019 17:58:35 +0100
Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
 bootstrap due to libsanitizer)

	Backported from mainline
	2019-11-26  Jakub Jelinek  <jakub@redhat.com>
	Backported for version 5.3.0 <= gcc <= 6.5.0
	2020-06-05  John L. Jolly  <john.jolly@gmail.com>

	PR sanitizer/92154
	* sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick
	llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce.
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.

From-SVN: r279653
---
 libsanitizer/ChangeLog                            | 10 ++++++++++
 .../sanitizer_platform_limits_posix.cc            |  9 +++------
 .../sanitizer_platform_limits_posix.h             | 15 +--------------
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 06a605ff4670..d823a12190c0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1130,12 +1130,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 #ifndef __GLIBC_PREREQ
 #define __GLIBC_PREREQ(x, y) 0
 #endif
-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
-    !defined(__arm__)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
-/* On Arm glibc 2.31 and later provide a different mode field, this field is
-   never used by libsanitizer so we can simply ignore this assert for all glibc
-   versions.  */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+   on many architectures.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif
 
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 73af92af1e8f..6a673a7c9959 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -211,20 +211,13 @@ namespace __sanitizer {
     unsigned long __unused1;
     unsigned long __unused2;
 #elif defined(__sparc__)
-# if defined(__arch64__)
     unsigned mode;
-    unsigned short __pad1;
-# else
-    unsigned short __pad1;
-    unsigned short mode;
     unsigned short __pad2;
-# endif
     unsigned short __seq;
     unsigned long long __unused1;
     unsigned long long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
+    unsigned int mode;
     unsigned short __seq;
     unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)
Original line number Diff line number Diff line
From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 20 Dec 2019 17:58:35 +0100
Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
 bootstrap due to libsanitizer)

	Backported from mainline
	2019-11-26  Jakub Jelinek  <jakub@redhat.com>
	Backported for version 7.1.0 <= gcc <= 7.4.0
	2020-06-05  John L. Jolly  <john.jolly@gmail.com>

	PR sanitizer/92154
	* sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick
	llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce.
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.

From-SVN: r279653
---
 libsanitizer/ChangeLog                            | 10 ++++++++++
 .../sanitizer_platform_limits_posix.cc            |  9 +++------
 .../sanitizer_platform_limits_posix.h             | 15 +--------------
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 06a605ff4670..d823a12190c0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1156,12 +1156,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
-    !defined(__arm__)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
-/* On Arm glibc 2.31 and later provide a different mode field, this field is
-   never used by libsanitizer so we can simply ignore this assert for all glibc
-   versions.  */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+   on many architectures.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif
 
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 73af92af1e8f..6a673a7c9959 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -211,20 +211,13 @@ namespace __sanitizer {
     unsigned long __unused1;
     unsigned long __unused2;
 #elif defined(__sparc__)
-# if defined(__arch64__)
     unsigned mode;
-    unsigned short __pad1;
-# else
-    unsigned short __pad1;
-    unsigned short mode;
     unsigned short __pad2;
-# endif
     unsigned short __seq;
     unsigned long long __unused1;
     unsigned long long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
+    unsigned int mode;
     unsigned short __seq;
     unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)
+0 −73
Original line number Diff line number Diff line
From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 20 Dec 2019 17:58:35 +0100
Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
 bootstrap due to libsanitizer)

	Backported from mainline
	2019-11-26  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/92154
	* sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick
	llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce.
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.

From-SVN: r279653
---
 libsanitizer/ChangeLog                            | 10 ++++++++++
 .../sanitizer_platform_limits_posix.cc            |  9 +++------
 .../sanitizer_platform_limits_posix.h             | 15 +--------------
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 06a605ff4670..d823a12190c0 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1156,12 +1156,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
 CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
-    !defined(__arm__)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field.  */
-/* On Arm glibc 2.31 and later provide a different mode field, this field is
-   never used by libsanitizer so we can simply ignore this assert for all glibc
-   versions.  */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+   on many architectures.  */
 CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
 #endif
 
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 73af92af1e8f..6a673a7c9959 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -211,26 +211,13 @@ namespace __sanitizer {
     u64 __unused1;
     u64 __unused2;
 #elif defined(__sparc__)
-#if defined(__arch64__)
     unsigned mode;
-    unsigned short __pad1;
-#else
-    unsigned short __pad1;
-    unsigned short mode;
     unsigned short __pad2;
-#endif
     unsigned short __seq;
     unsigned long long __unused1;
     unsigned long long __unused2;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
-    unsigned int mode;
-    unsigned short __seq;
-    unsigned short __pad1;
-    unsigned long __unused1;
-    unsigned long __unused2;
 #else
-    unsigned short mode;
-    unsigned short __pad1;
+    unsigned int mode;
     unsigned short __seq;
     unsigned short __pad2;
 #if defined(__x86_64__) && !defined(_LP64)
Original line number Diff line number Diff line
diff -ru a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc	2014-09-23 17:59:53.000000000 +0000
+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc	2021-10-30 19:48:38.690007561 +0000
@@ -358,15 +358,6 @@
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
-  _(CYGETDEFTHRESH, WRITE, sizeof(int));
-  _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
-  _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
-  _(CYGETTHRESH, WRITE, sizeof(int));
-  _(CYGETTIMEOUT, WRITE, sizeof(int));
-  _(CYSETDEFTHRESH, NONE, 0);
-  _(CYSETDEFTIMEOUT, NONE, 0);
-  _(CYSETTHRESH, NONE, 0);
-  _(CYSETTIMEOUT, NONE, 0);
   _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
   _(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
   _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
diff -ru a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2021-10-30 19:40:51.805824323 +0000
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2021-10-30 19:51:13.640403192 +0000
@@ -143,7 +143,6 @@
 #include <sys/statvfs.h>
 #include <sys/timex.h>
 #include <sys/user.h>
-#include <linux/cyclades.h>
 #include <linux/if_eql.h>
 #include <linux/if_plip.h>
 #include <linux/lp.h>
@@ -392,7 +391,6 @@
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
-  unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
 #if EV_VERSION > (0x010000)
   unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
 #else
@@ -759,15 +757,6 @@
 #endif  // SANITIZER_LINUX || SANITIZER_FREEBSD
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
-  unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
-  unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
-  unsigned IOCTL_CYGETMON = CYGETMON;
-  unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
-  unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
-  unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
-  unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
-  unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
-  unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
   unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
   unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
   unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
diff -ru a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h	2021-10-30 19:40:51.698824053 +0000
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h	2021-10-30 19:51:39.680469814 +0000
@@ -875,7 +875,6 @@
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   extern unsigned struct_ax25_parms_struct_sz;
-  extern unsigned struct_cyclades_monitor_sz;
   extern unsigned struct_input_keymap_entry_sz;
   extern unsigned struct_ipx_config_data_sz;
   extern unsigned struct_kbdiacrs_sz;
@@ -1220,15 +1219,6 @@
 #endif  // SANITIZER_LINUX || SANITIZER_FREEBSD
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
-  extern unsigned IOCTL_CYGETDEFTHRESH;
-  extern unsigned IOCTL_CYGETDEFTIMEOUT;
-  extern unsigned IOCTL_CYGETMON;
-  extern unsigned IOCTL_CYGETTHRESH;
-  extern unsigned IOCTL_CYGETTIMEOUT;
-  extern unsigned IOCTL_CYSETDEFTHRESH;
-  extern unsigned IOCTL_CYSETDEFTIMEOUT;
-  extern unsigned IOCTL_CYSETTHRESH;
-  extern unsigned IOCTL_CYSETTIMEOUT;
   extern unsigned IOCTL_EQL_EMANCIPATE;
   extern unsigned IOCTL_EQL_ENSLAVE;
   extern unsigned IOCTL_EQL_GETMASTRCFG;
Original line number Diff line number Diff line
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
index badf6a401cc..b43733033a6 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -72,7 +72,6 @@
 #include <sys/vt.h>
 #include <linux/cdrom.h>
 #include <linux/fd.h>
-#include <linux/fs.h>
 #include <linux/hdreg.h>
 #include <linux/input.h>
 #include <linux/ioctl.h>
@@ -822,10 +821,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
 #endif
-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
+  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
+  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
+  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
+  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
   unsigned IOCTL_GIO_FONT = GIO_FONT;
   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;
Original line number Diff line number Diff line
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index e8fce8a02..5122baa46 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -65,7 +65,6 @@
 #include <sys/vt.h>
 #include <linux/cdrom.h>
 #include <linux/fd.h>
-#include <linux/fs.h>
 #include <linux/hdreg.h>
 #include <linux/input.h>
 #include <linux/ioctl.h>
@@ -846,10 +845,10 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
   unsigned IOCTL_EVIOCGPROP = IOCTL_NOT_PRESENT;
   unsigned IOCTL_EVIOCSKEYCODE_V2 = IOCTL_NOT_PRESENT;
 #endif
-  unsigned IOCTL_FS_IOC_GETFLAGS = FS_IOC_GETFLAGS;
-  unsigned IOCTL_FS_IOC_GETVERSION = FS_IOC_GETVERSION;
-  unsigned IOCTL_FS_IOC_SETFLAGS = FS_IOC_SETFLAGS;
-  unsigned IOCTL_FS_IOC_SETVERSION = FS_IOC_SETVERSION;
+  unsigned IOCTL_FS_IOC_GETFLAGS = _IOR('f', 1, long);
+  unsigned IOCTL_FS_IOC_GETVERSION = _IOR('v', 1, long);
+  unsigned IOCTL_FS_IOC_SETFLAGS = _IOW('f', 2, long);
+  unsigned IOCTL_FS_IOC_SETVERSION = _IOW('v', 2, long);
   unsigned IOCTL_GIO_CMAP = GIO_CMAP;
   unsigned IOCTL_GIO_FONT = GIO_FONT;
   unsigned IOCTL_GIO_UNIMAP = GIO_UNIMAP;

packages/gcc/package.py

deleted100644 → 0
+0 −1114

File deleted.

Preview size limit exceeded, changes collapsed.

Original line number Diff line number Diff line
From 2b40941d23b1570cdd90083b58fa0f66aa58c86e Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 21 May 2021 12:16:56 +0100
Subject: [PATCH] libsanitizer: Remove cyclades from libsanitizer

The Linux kernel has removed the interface to cyclades from
the latest kernel headers[1] due to them being orphaned for the
past 13 years.

libsanitizer uses this header when compiling against glibc, but
glibcs itself doesn't seem to have any references to cyclades.

Further more it seems that the driver is broken in the kernel and
the firmware doesn't seem to be available anymore.

As such since this is breaking the build of libsanitizer (and so the
GCC bootstrap[2]) I propose to remove this.

[1] https://lkml.org/lkml/2021/3/2/153
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379

libsanitizer/ChangeLog:

	PR sanitizer/100379
	* sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick
	llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135.
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.
	* sanitizer_common/sanitizer_platform_limits_posix.h: Likewise.
---
 .../sanitizer_common_interceptors_ioctl.inc           |  9 ---------
 .../sanitizer_platform_limits_posix.cc                | 11 -----------
 .../sanitizer_platform_limits_posix.h                 | 10 ----------
 3 files changed, 30 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
index 5408ea17c59..7a9cd3f5968 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
@@ -365,15 +365,6 @@ static void ioctl_table_fill() {
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
-  _(CYGETDEFTHRESH, WRITE, sizeof(int));
-  _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
-  _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
-  _(CYGETTHRESH, WRITE, sizeof(int));
-  _(CYGETTIMEOUT, WRITE, sizeof(int));
-  _(CYSETDEFTHRESH, NONE, 0);
-  _(CYSETDEFTIMEOUT, NONE, 0);
-  _(CYSETTHRESH, NONE, 0);
-  _(CYSETTIMEOUT, NONE, 0);
   _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
   _(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
   _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index d823a12190c..e8fce8a0287 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_t;
 # include <sys/procfs.h>
 #endif
 #include <sys/user.h>
-#include <linux/cyclades.h>
 #include <linux/if_eql.h>
 #include <linux/if_plip.h>
 #include <linux/lp.h>
@@ -466,7 +465,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
-  unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
 #if EV_VERSION > (0x010000)
   unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
 #else
@@ -833,15 +831,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
-  unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
-  unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
-  unsigned IOCTL_CYGETMON = CYGETMON;
-  unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
-  unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
-  unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
-  unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
-  unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
-  unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
   unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
   unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
   unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 6a673a7c995..f921bf2b5b5 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -1040,7 +1040,6 @@ struct __sanitizer_cookie_io_functions_t {
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
   extern unsigned struct_ax25_parms_struct_sz;
-  extern unsigned struct_cyclades_monitor_sz;
   extern unsigned struct_input_keymap_entry_sz;
   extern unsigned struct_ipx_config_data_sz;
   extern unsigned struct_kbdiacrs_sz;
@@ -1385,15 +1384,6 @@ struct __sanitizer_cookie_io_functions_t {
 #endif  // SANITIZER_LINUX || SANITIZER_FREEBSD
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
-  extern unsigned IOCTL_CYGETDEFTHRESH;
-  extern unsigned IOCTL_CYGETDEFTIMEOUT;
-  extern unsigned IOCTL_CYGETMON;
-  extern unsigned IOCTL_CYGETTHRESH;
-  extern unsigned IOCTL_CYGETTIMEOUT;
-  extern unsigned IOCTL_CYSETDEFTHRESH;
-  extern unsigned IOCTL_CYSETDEFTIMEOUT;
-  extern unsigned IOCTL_CYSETTHRESH;
-  extern unsigned IOCTL_CYSETTIMEOUT;
   extern unsigned IOCTL_EQL_EMANCIPATE;
   extern unsigned IOCTL_EQL_ENSLAVE;
   extern unsigned IOCTL_EQL_GETMASTRCFG;
-- 
2.31.1
Original line number Diff line number Diff line
From 745dae5923aba02982563481d75a21595df22ff8 Mon Sep 17 00:00:00 2001
From: Tamar Christina <tamar.christina@arm.com>
Date: Fri, 21 May 2021 10:30:59 +0100
Subject: [PATCH] libsanitizer: Remove cyclades from libsanitizer

The Linux kernel has removed the interface to cyclades from
the latest kernel headers[1] due to them being orphaned for the
past 13 years.

libsanitizer uses this header when compiling against glibc, but
glibcs itself doesn't seem to have any references to cyclades.

Further more it seems that the driver is broken in the kernel and
the firmware doesn't seem to be available anymore.

As such since this is breaking the build of libsanitizer (and so the
GCC bootstrap[2]) I propose to remove this.

[1] https://lkml.org/lkml/2021/3/2/153
[2] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100379

(cherry picked from commit f7c5351552387bd43f6ca3631016d7f0dfe0f135)

libsanitizer/ChangeLog:

	PR sanitizer/100379
	* sanitizer_common/sanitizer_common_interceptors_ioctl.inc: Cherry-pick
	llvm-project revision f7c5351552387bd43f6ca3631016d7f0dfe0f135.
	* sanitizer_common/sanitizer_platform_limits_posix.cpp: Likewise.
	* sanitizer_common/sanitizer_platform_limits_posix.h: Likewise.
---
 .../sanitizer_common_interceptors_ioctl.inc           |  9 ---------
 .../sanitizer_platform_limits_posix.cpp               | 11 -----------
 .../sanitizer_platform_limits_posix.h                 | 10 ----------
 3 files changed, 30 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
index 7f181258eab..b7da6598755 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
@@ -370,15 +370,6 @@ static void ioctl_table_fill() {
 
 #if SANITIZER_GLIBC
   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
-  _(CYGETDEFTHRESH, WRITE, sizeof(int));
-  _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
-  _(CYGETMON, WRITE, struct_cyclades_monitor_sz);
-  _(CYGETTHRESH, WRITE, sizeof(int));
-  _(CYGETTIMEOUT, WRITE, sizeof(int));
-  _(CYSETDEFTHRESH, NONE, 0);
-  _(CYSETDEFTIMEOUT, NONE, 0);
-  _(CYSETTHRESH, NONE, 0);
-  _(CYSETTIMEOUT, NONE, 0);
   _(EQL_EMANCIPATE, WRITE, struct_ifreq_sz);
   _(EQL_ENSLAVE, WRITE, struct_ifreq_sz);
   _(EQL_GETMASTRCFG, WRITE, struct_ifreq_sz);
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
index 35a690cba5c..6e5c330b98e 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -143,7 +143,6 @@ typedef struct user_fpregs elf_fpregset_t;
 # include <sys/procfs.h>
 #endif
 #include <sys/user.h>
-#include <linux/cyclades.h>
 #include <linux/if_eql.h>
 #include <linux/if_plip.h>
 #include <linux/lp.h>
@@ -460,7 +459,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
 
 #if SANITIZER_GLIBC
   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
-  unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
 #if EV_VERSION > (0x010000)
   unsigned struct_input_keymap_entry_sz = sizeof(struct input_keymap_entry);
 #else
@@ -824,15 +822,6 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
 #endif // SANITIZER_LINUX
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
-  unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
-  unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
-  unsigned IOCTL_CYGETMON = CYGETMON;
-  unsigned IOCTL_CYGETTHRESH = CYGETTHRESH;
-  unsigned IOCTL_CYGETTIMEOUT = CYGETTIMEOUT;
-  unsigned IOCTL_CYSETDEFTHRESH = CYSETDEFTHRESH;
-  unsigned IOCTL_CYSETDEFTIMEOUT = CYSETDEFTIMEOUT;
-  unsigned IOCTL_CYSETTHRESH = CYSETTHRESH;
-  unsigned IOCTL_CYSETTIMEOUT = CYSETTIMEOUT;
   unsigned IOCTL_EQL_EMANCIPATE = EQL_EMANCIPATE;
   unsigned IOCTL_EQL_ENSLAVE = EQL_ENSLAVE;
   unsigned IOCTL_EQL_GETMASTRCFG = EQL_GETMASTRCFG;
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index ad358eef8b7..cba41ba5494 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -983,7 +983,6 @@ extern unsigned struct_vt_mode_sz;
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
 extern unsigned struct_ax25_parms_struct_sz;
-extern unsigned struct_cyclades_monitor_sz;
 extern unsigned struct_input_keymap_entry_sz;
 extern unsigned struct_ipx_config_data_sz;
 extern unsigned struct_kbdiacrs_sz;
@@ -1328,15 +1327,6 @@ extern unsigned IOCTL_VT_WAITACTIVE;
 #endif  // SANITIZER_LINUX
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
-extern unsigned IOCTL_CYGETDEFTHRESH;
-extern unsigned IOCTL_CYGETDEFTIMEOUT;
-extern unsigned IOCTL_CYGETMON;
-extern unsigned IOCTL_CYGETTHRESH;
-extern unsigned IOCTL_CYGETTIMEOUT;
-extern unsigned IOCTL_CYSETDEFTHRESH;
-extern unsigned IOCTL_CYSETDEFTIMEOUT;
-extern unsigned IOCTL_CYSETTHRESH;
-extern unsigned IOCTL_CYSETTIMEOUT;
 extern unsigned IOCTL_EQL_EMANCIPATE;
 extern unsigned IOCTL_EQL_ENSLAVE;
 extern unsigned IOCTL_EQL_GETMASTRCFG;
-- 
2.31.1
Original line number Diff line number Diff line
From f1feb74046e0feb0596b93bbb822fae02940a90e Mon Sep 17 00:00:00 2001
From: Patrick Palka <ppalka@redhat.com>
Date: Fri, 4 Jun 2021 13:46:53 -0400
Subject: [PATCH] c++: tsubst_function_decl and excess arg levels [PR100102]

Here, when instantiating the dependent alias template
duration::__is_harmonic with args={{T,U},{int}}, we find ourselves
substituting the function decl _S_gcd.  Since we have more arg levels
than _S_gcd has parm levels, an old special case in tsubst_function_decl
causes us to unwantedly reduce args to its innermost level, yielding
args={int}, which leads to a nonsensical substitution into the decl
context and eventually a crash.

The comment for this special case refers to three examples for which we
ought to see more arg levels than parm levels here, but none of the
examples actually demonstrate this.  In the first example, when
defining S<int>::f(U) parms_depth is 2 and args_depth is 1, and
later when instantiating say S<int>::f<char> both depths are 2.  In the
second example, when substituting the template friend declaration
parms_depth is 2 and args_depth is 1, and later when instantiating f
both depths are 1.  Finally, the third example is invalid since we can't
specialize a member template of an unspecialized class template like
that.

Given that this reduction code seems no longer relevant for its
documented purpose and that it causes problems as in the PR, this patch
just removes it.  Note that as far as bootstrap/regtest is concerned,
this code is dead; the below two tests would be the first to reach it.

	PR c++/100102

gcc/cp/ChangeLog:

	* pt.c (tsubst_function_decl): Remove old code for reducing
	args when it has excess levels.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alias-decl-72.C: New test.
	* g++.dg/cpp0x/alias-decl-72a.C: New test.

(cherry picked from commit 5357ab75dedef403b0eebf9277d61d1cbeb5898f)
---
 gcc/cp/pt.c                                 | 39 ---------------------
 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C  |  9 +++++
 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C |  9 +++++
 3 files changed, 18 insertions(+), 39 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 1434beb80f4..1761a902218 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13954,45 +13954,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
 	  if (tree spec = retrieve_specialization (gen_tmpl, argvec, hash))
 	    return spec;
 	}
-
-      /* We can see more levels of arguments than parameters if
-	 there was a specialization of a member template, like
-	 this:
-
-	 template <class T> struct S { template <class U> void f(); }
-	 template <> template <class U> void S<int>::f(U);
-
-	 Here, we'll be substituting into the specialization,
-	 because that's where we can find the code we actually
-	 want to generate, but we'll have enough arguments for
-	 the most general template.
-
-	 We also deal with the peculiar case:
-
-	 template <class T> struct S {
-	   template <class U> friend void f();
-	 };
-	 template <class U> void f() {}
-	 template S<int>;
-	 template void f<double>();
-
-	 Here, the ARGS for the instantiation of will be {int,
-	 double}.  But, we only need as many ARGS as there are
-	 levels of template parameters in CODE_PATTERN.  We are
-	 careful not to get fooled into reducing the ARGS in
-	 situations like:
-
-	 template <class T> struct S { template <class U> void f(U); }
-	 template <class T> template <> void S<T>::f(int) {}
-
-	 which we can spot because the pattern will be a
-	 specialization in this case.  */
-      int args_depth = TMPL_ARGS_DEPTH (args);
-      int parms_depth =
-	TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t)));
-
-      if (args_depth > parms_depth && !DECL_TEMPLATE_SPECIALIZATION (t))
-	args = get_innermost_template_args (args, parms_depth);
     }
   else
     {
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
new file mode 100644
index 00000000000..8009756dcba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
@@ -0,0 +1,9 @@
+// PR c++/100102
+// { dg-do compile { target c++11 } }
+
+template<int()> struct ratio;
+template<class T, class U> struct duration {
+  static constexpr int _S_gcd();
+  template<class> using __is_harmonic = ratio<_S_gcd>;
+  using type = __is_harmonic<int>;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
new file mode 100644
index 00000000000..a4443e18f9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
@@ -0,0 +1,9 @@
+// PR c++/100102
+// { dg-do compile { target c++11 } }
+
+template<int> struct ratio;
+template<class T> struct duration {
+  static constexpr int _S_gcd();
+  template<class> using __is_harmonic = ratio<(duration::_S_gcd)()>;
+  using type = __is_harmonic<int>;
+};
-- 
2.31.1
Original line number Diff line number Diff line
From fc930b3010bd0de899a3da3209eab20664ddb703 Mon Sep 17 00:00:00 2001
From: Patrick Palka <ppalka@redhat.com>
Date: Fri, 4 Jun 2021 13:46:53 -0400
Subject: [PATCH] c++: tsubst_function_decl and excess arg levels [PR100102]

Here, when instantiating the dependent alias template
duration::__is_harmonic with args={{T,U},{int}}, we find ourselves
substituting the function decl _S_gcd.  Since we have more arg levels
than _S_gcd has parm levels, an old special case in tsubst_function_decl
causes us to unwantedly reduce args to its innermost level, yielding
args={int}, which leads to a nonsensical substitution into the decl
context and eventually a crash.

The comment for this special case refers to three examples for which we
ought to see more arg levels than parm levels here, but none of the
examples actually demonstrate this.  In the first example, when
defining S<int>::f(U) parms_depth is 2 and args_depth is 1, and
later when instantiating say S<int>::f<char> both depths are 2.  In the
second example, when substituting the template friend declaration
parms_depth is 2 and args_depth is 1, and later when instantiating f
both depths are 1.  Finally, the third example is invalid since we can't
specialize a member template of an unspecialized class template like
that.

Given that this reduction code seems no longer relevant for its
documented purpose and that it causes problems as in the PR, this patch
just removes it.  Note that as far as bootstrap/regtest is concerned,
this code is dead; the below two tests would be the first to reach it.

	PR c++/100102

gcc/cp/ChangeLog:

	* pt.c (tsubst_function_decl): Remove old code for reducing
	args when it has excess levels.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/alias-decl-72.C: New test.
	* g++.dg/cpp0x/alias-decl-72a.C: New test.

(cherry picked from commit 5357ab75dedef403b0eebf9277d61d1cbeb5898f)
---
 gcc/cp/pt.c                                 | 39 ---------------------
 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C  |  9 +++++
 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C |  9 +++++
 3 files changed, 18 insertions(+), 39 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 5a957141ba3..7ce9ac234f8 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13811,45 +13811,6 @@ tsubst_function_decl (tree t, tree args, tsubst_flags_t complain,
 	  if (tree spec = retrieve_specialization (gen_tmpl, argvec, hash))
 	    return spec;
 	}
-
-      /* We can see more levels of arguments than parameters if
-	 there was a specialization of a member template, like
-	 this:
-
-	 template <class T> struct S { template <class U> void f(); }
-	 template <> template <class U> void S<int>::f(U);
-
-	 Here, we'll be substituting into the specialization,
-	 because that's where we can find the code we actually
-	 want to generate, but we'll have enough arguments for
-	 the most general template.
-
-	 We also deal with the peculiar case:
-
-	 template <class T> struct S {
-	   template <class U> friend void f();
-	 };
-	 template <class U> void f() {}
-	 template S<int>;
-	 template void f<double>();
-
-	 Here, the ARGS for the instantiation of will be {int,
-	 double}.  But, we only need as many ARGS as there are
-	 levels of template parameters in CODE_PATTERN.  We are
-	 careful not to get fooled into reducing the ARGS in
-	 situations like:
-
-	 template <class T> struct S { template <class U> void f(U); }
-	 template <class T> template <> void S<T>::f(int) {}
-
-	 which we can spot because the pattern will be a
-	 specialization in this case.  */
-      int args_depth = TMPL_ARGS_DEPTH (args);
-      int parms_depth =
-	TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (DECL_TI_TEMPLATE (t)));
-
-      if (args_depth > parms_depth && !DECL_TEMPLATE_SPECIALIZATION (t))
-	args = get_innermost_template_args (args, parms_depth);
     }
   else
     {
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
new file mode 100644
index 00000000000..8009756dcba
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72.C
@@ -0,0 +1,9 @@
+// PR c++/100102
+// { dg-do compile { target c++11 } }
+
+template<int()> struct ratio;
+template<class T, class U> struct duration {
+  static constexpr int _S_gcd();
+  template<class> using __is_harmonic = ratio<_S_gcd>;
+  using type = __is_harmonic<int>;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
new file mode 100644
index 00000000000..a4443e18f9d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-72a.C
@@ -0,0 +1,9 @@
+// PR c++/100102
+// { dg-do compile { target c++11 } }
+
+template<int> struct ratio;
+template<class T> struct duration {
+  static constexpr int _S_gcd();
+  template<class> using __is_harmonic = ratio<(duration::_S_gcd)()>;
+  using type = __is_harmonic<int>;
+};
-- 
2.31.1

packages/gcc/piclibs.patch

deleted100644 → 0
+0 −62
Original line number Diff line number Diff line
diff --git a/libgfortran/Makefile.in b/libgfortran/Makefile.in
index 62b9f7a..7666fdb 100644
--- a/libgfortran/Makefile.in
+++ b/libgfortran/Makefile.in
@@ -357,11 +357,11 @@ AUTOMAKE = @AUTOMAKE@
 AWK = @AWK@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ -fPIC
 CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@ -fPIC
 CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
+DEFS = @DEFS@ -fPIC
 DEPDIR = @DEPDIR@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
@@ -371,7 +371,7 @@ ECHO_T = @ECHO_T@
 EGREP = @EGREP@
 EXEEXT = @EXEEXT@
 FC = @FC@
-FCFLAGS = @FCFLAGS@
+FCFLAGS = @FCFLAGS@ -fPIC
 FGREP = @FGREP@
 FPU_HOST_HEADER = @FPU_HOST_HEADER@
 GREP = @GREP@
diff --git a/libstdc++-v3/Makefile.in b/libstdc++-v3/Makefile.in
index bede542..9b3e442 100644
--- a/libstdc++-v3/Makefile.in
+++ b/libstdc++-v3/Makefile.in
@@ -115,7 +115,7 @@ CC = @CC@
 CCODECVT_CC = @CCODECVT_CC@
 CCOLLATE_CC = @CCOLLATE_CC@
 CCTYPE_CC = @CCTYPE_CC@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ -fPIC
 CLOCALE_CC = @CLOCALE_CC@
 CLOCALE_H = @CLOCALE_H@
 CLOCALE_INTERNAL_H = @CLOCALE_INTERNAL_H@
@@ -124,7 +124,7 @@ CMESSAGES_H = @CMESSAGES_H@
 CMONEY_CC = @CMONEY_CC@
 CNUMERIC_CC = @CNUMERIC_CC@
 CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
+CPPFLAGS = @CPPFLAGS@ -fPIC
 CPU_DEFINES_SRCDIR = @CPU_DEFINES_SRCDIR@
 CPU_OPT_BITS_RANDOM = @CPU_OPT_BITS_RANDOM@
 CPU_OPT_EXT_RANDOM = @CPU_OPT_EXT_RANDOM@
@@ -139,7 +139,7 @@ CYGPATH_W = @CYGPATH_W@
 C_INCLUDE_DIR = @C_INCLUDE_DIR@
 DBLATEX = @DBLATEX@
 DEBUG_FLAGS = @DEBUG_FLAGS@
-DEFS = @DEFS@
+DEFS = @DEFS@ -fPIC
 DOT = @DOT@
 DOXYGEN = @DOXYGEN@
 DSYMUTIL = @DSYMUTIL@
-- 
2.8.3

packages/gcc/signal.patch

deleted100644 → 0
+0 −28
Original line number Diff line number Diff line
From 6c709b6262e8b6441b1e94526d6d65d4ce7a7dec Mon Sep 17 00:00:00 2001
From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 7 Sep 2017 07:18:57 +0000
Subject: [PATCH] 2017-09-07  Matthias Klose  <doko@ubuntu.com>

        * asan/asan_linux.cc: Include <signal.h>


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251830 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libsanitizer/asan/asan_linux.cc | 1 +
 2 files changed, 5 insertions(+)

diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc
index c504168..59087b9 100644
--- a/libsanitizer/asan/asan_linux.cc
+++ b/libsanitizer/asan/asan_linux.cc
@@ -29,6 +29,7 @@
 #include <dlfcn.h>
 #include <fcntl.h>
 #include <pthread.h>
+#include <signal.h>
 #include <stdio.h>
 #include <unistd.h>
 #include <unwind.h>
-- 
2.9.3

packages/gcc/stack_t-4.9.patch

deleted100644 → 0
+0 −80
Original line number Diff line number Diff line
From 833e00c01e96f61e24cd7ec97b93fad212dc914b Mon Sep 17 00:00:00 2001
From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 7 Sep 2017 07:17:17 +0000
Subject: [PATCH] 2017-09-07  Matthias Klose  <doko@ubuntu.com>

        Backported from mainline
        2017-07-14  Jakub Jelinek  <jakub@redhat.com>

        PR sanitizer/81066
        * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
        * sanitizer_common/sanitizer_linux.cc: Likewise.
        * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
        * tsan/tsan_platform_linux.cc: Likewise.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251829 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libsanitizer/sanitizer_common/sanitizer_linux.cc              |  3 +--
 libsanitizer/sanitizer_common/sanitizer_linux.h               |  4 +---
 .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc  |  2 +-
 libsanitizer/tsan/tsan_platform_linux.cc                      |  2 +-
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index 9feb307..821b26d 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -514,8 +514,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
 }
 #endif
 
-uptr internal_sigaltstack(const struct sigaltstack *ss,
-                         struct sigaltstack *oss) {
+uptr internal_sigaltstack(const void *ss, void *oss) {
   return internal_syscall(__NR_sigaltstack, (uptr)ss, (uptr)oss);
 }
 
diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h
index 086834c..3a6f4cd 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.h
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.h
@@ -27,8 +26,7 @@ struct linux_dirent;
 // Syscall wrappers.
 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
 uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5);
-uptr internal_sigaltstack(const struct sigaltstack* ss,
-                          struct sigaltstack* oss);
+uptr internal_sigaltstack(const void* ss, void* oss);
 uptr internal_sigaction(int signum, const __sanitizer_kernel_sigaction_t *act,
     __sanitizer_kernel_sigaction_t *oldact);
 uptr internal_sigprocmask(int how, __sanitizer_kernel_sigset_t *set,
diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index 5881202..c54894d 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -234,7 +234,7 @@ static int TracerThread(void* argument) {
 
   // Alternate stack for signal handling.
   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
-  struct sigaltstack handler_stack;
+  stack_t handler_stack;
   internal_memset(&handler_stack, 0, sizeof(handler_stack));
   handler_stack.ss_sp = handler_stack_memory.data();
   handler_stack.ss_size = kHandlerStackSize;
diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
index 3259131..b8e9078 100644
--- a/libsanitizer/tsan/tsan_platform_linux.cc
+++ b/libsanitizer/tsan/tsan_platform_linux.cc
@@ -377,7 +377,7 @@ bool IsGlobalVar(uptr addr) {
 int ExtractResolvFDs(void *state, int *fds, int nfd) {
 #if SANITIZER_LINUX
   int cnt = 0;
-  __res_state *statp = (__res_state*)state;
+  struct __res_state *statp = (struct __res_state*)state;
   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
       fds[cnt++] = statp->_u._ext.nssocks[i];
-- 
2.9.3

packages/gcc/stack_t.patch

deleted100644 → 0
+0 −88
Original line number Diff line number Diff line
From 833e00c01e96f61e24cd7ec97b93fad212dc914b Mon Sep 17 00:00:00 2001
From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 7 Sep 2017 07:17:17 +0000
Subject: [PATCH] 2017-09-07  Matthias Klose  <doko@ubuntu.com>

        Backported from mainline
        2017-07-14  Jakub Jelinek  <jakub@redhat.com>

        PR sanitizer/81066
        * sanitizer_common/sanitizer_linux.h: Cherry-pick upstream r307969.
        * sanitizer_common/sanitizer_linux.cc: Likewise.
        * sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc: Likewise.
        * tsan/tsan_platform_linux.cc: Likewise.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251829 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libsanitizer/sanitizer_common/sanitizer_linux.cc              |  3 +--
 libsanitizer/sanitizer_common/sanitizer_linux.h               |  4 +---
 .../sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc  |  2 +-
 libsanitizer/tsan/tsan_platform_linux.cc                      |  2 +-
 5 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index 9feb307..821b26d 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -514,8 +514,7 @@ uptr internal_prctl(int option, uptr arg2, uptr arg3, uptr arg4, uptr arg5) {
 }
 #endif
 
-uptr internal_sigaltstack(const struct sigaltstack *ss,
-                         struct sigaltstack *oss) {
+uptr internal_sigaltstack(const void *ss, void *oss) {
   return internal_syscall(SYSCALL(sigaltstack), (uptr)ss, (uptr)oss);
 }
 
diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.h b/libsanitizer/sanitizer_common/sanitizer_linux.h
index 086834c..3a6f4cd 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.h
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.h
@@ -18,7 +18,6 @@
 #include "sanitizer_platform_limits_posix.h"
 
 struct link_map;  // Opaque type returned by dlopen().
-struct sigaltstack;
 
 namespace __sanitizer {
 // Dirent structure for getdents(). Note that this structure is different from
@@ -27,8 +26,7 @@ struct linux_dirent;
 
 // Syscall wrappers.
 uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count);
-uptr internal_sigaltstack(const struct sigaltstack* ss,
-                          struct sigaltstack* oss);
+uptr internal_sigaltstack(const void* ss, void* oss);
 uptr internal_sigprocmask(int how, __sanitizer_sigset_t *set,
     __sanitizer_sigset_t *oldset);
 void internal_sigfillset(__sanitizer_sigset_t *set);
diff --git a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
index 5881202..c54894d 100644
--- a/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc
@@ -234,7 +234,7 @@ static int TracerThread(void* argument) {
 
   // Alternate stack for signal handling.
   InternalScopedBuffer<char> handler_stack_memory(kHandlerStackSize);
-  struct sigaltstack handler_stack;
+  stack_t handler_stack;
   internal_memset(&handler_stack, 0, sizeof(handler_stack));
   handler_stack.ss_sp = handler_stack_memory.data();
   handler_stack.ss_size = kHandlerStackSize;
diff --git a/libsanitizer/tsan/tsan_platform_linux.cc b/libsanitizer/tsan/tsan_platform_linux.cc
index 3259131..b8e9078 100644
--- a/libsanitizer/tsan/tsan_platform_linux.cc
+++ b/libsanitizer/tsan/tsan_platform_linux.cc
@@ -377,7 +377,7 @@ bool IsGlobalVar(uptr addr) {
 int ExtractResolvFDs(void *state, int *fds, int nfd) {
 #if SANITIZER_LINUX
   int cnt = 0;
-  __res_state *statp = (__res_state*)state;
+  struct __res_state *statp = (struct __res_state*)state;
   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
     if (statp->_u._ext.nsaddrs[i] && statp->_u._ext.nssocks[i] != -1)
       fds[cnt++] = statp->_u._ext.nssocks[i];
-- 
2.9.3

packages/gcc/sys_ustat-4.9.patch

deleted100644 → 0
+0 −34
Original line number Diff line number Diff line
The sys_ustat.h patch modified for gcc 4.9.x.

diff -Naurb gcc-4.9.4.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc gcc-4.9.4/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
--- gcc-4.9.4.orig/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2013-12-19 06:54:11.000000000 -0600
+++ gcc-4.9.4/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc	2018-12-11 15:57:46.901800462 -0600
@@ -81,7 +81,6 @@
 #include <sys/statvfs.h>
 #include <sys/timex.h>
 #include <sys/user.h>
-#include <sys/ustat.h>
 #include <linux/cyclades.h>
 #include <linux/if_eql.h>
 #include <linux/if_plip.h>
@@ -163,7 +162,19 @@
   unsigned struct_old_utsname_sz = sizeof(struct old_utsname);
   unsigned struct_oldold_utsname_sz = sizeof(struct oldold_utsname);
   unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
-  unsigned struct_ustat_sz = sizeof(struct ustat);
+  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
+  // has been removed from glibc 2.28.
+#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
+  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
+  || defined(__x86_64__)
+#define SIZEOF_STRUCT_USTAT 32
+#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
+  || defined(__powerpc__) || defined(__s390__)
+#define SIZEOF_STRUCT_USTAT 20
+#else
+#error Unknown size of struct ustat
+#endif
+  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
 #endif // SANITIZER_LINUX
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID

packages/gcc/sys_ustat.h.patch

deleted100644 → 0
+0 −63
Original line number Diff line number Diff line
From 9569b61168b963a6cea7b782fd350dee489ad42c Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 21 May 2018 13:17:55 -0700
Subject: [PATCH] libsanitizer: Use pre-computed size of struct ustat for Linux

Cherry-pick compiler-rt revision 333213:

<sys/ustat.h> has been removed from glibc 2.28 by:

commit cf2478d53ad7071e84c724a986b56fe17f4f4ca7
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Sun Mar 18 11:28:59 2018 +0800

    Deprecate ustat syscall interface

This patch uses pre-computed size of struct ustat for Linux.

	PR sanitizer/85835
	* sanitizer_common/sanitizer_platform_limits_posix.cc: Don't
	include <sys/ustat.h> for Linux.
	(SIZEOF_STRUCT_USTAT): New.
	(struct_ustat_sz): Use SIZEOF_STRUCT_USTAT for Linux.
---
 .../sanitizer_platform_limits_posix.cc            | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
index 858bb218450..de18e56d11c 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -157,7 +157,6 @@ typedef struct user_fpregs elf_fpregset_t;
 # include <sys/procfs.h>
 #endif
 #include <sys/user.h>
-#include <sys/ustat.h>
 #include <linux/cyclades.h>
 #include <linux/if_eql.h>
 #include <linux/if_plip.h>
@@ -250,7 +249,19 @@ namespace __sanitizer {
 #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
 
 #if SANITIZER_LINUX && !SANITIZER_ANDROID
-  unsigned struct_ustat_sz = sizeof(struct ustat);
+  // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
+  // has been removed from glibc 2.28.
+#if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
+  || defined(__powerpc64__) || defined(__arch64__) || defined(__sparcv9) \
+  || defined(__x86_64__)
+#define SIZEOF_STRUCT_USTAT 32
+#elif defined(__arm__) || defined(__i386__) || defined(__mips__) \
+  || defined(__powerpc__) || defined(__s390__)
+#define SIZEOF_STRUCT_USTAT 20
+#else
+#error Unknown size of struct ustat
+#endif
+  unsigned struct_ustat_sz = SIZEOF_STRUCT_USTAT;
   unsigned struct_rlimit64_sz = sizeof(struct rlimit64);
   unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
 #endif // SANITIZER_LINUX && !SANITIZER_ANDROID
-- 
2.17.0

+0 −60
Original line number Diff line number Diff line
From 9b9287cde20ea57578cf07efb2a96ed4cc0da36f Mon Sep 17 00:00:00 2001
From: doko <doko@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Thu, 7 Sep 2017 07:22:07 +0000
Subject: [PATCH] 2017-09-07  Matthias Klose  <doko@ubuntu.com>

        * include/x86_64-signal.h (HANDLE_DIVIDE_OVERFLOW): Replace
        'struct ucontext' with ucontext_t.
        * include/i386-signal.h (HANDLE_DIVIDE_OVERFLOW): Likewise.
        * include/s390-signal.h (HANDLE_DIVIDE_OVERFLOW): Likewise.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@251832 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libjava/include/i386-signal.h   | 2 +-
 libjava/include/s390-signal.h   | 2 +-
 libjava/include/x86_64-signal.h | 2 +-
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/libjava/include/i386-signal.h b/libjava/include/i386-signal.h
index c2409b0..ef77e7e 100644
--- a/libjava/include/i386-signal.h
+++ b/libjava/include/i386-signal.h
@@ -29,7 +29,7 @@ static void _Jv_##_name (int, siginfo_t *,			\
 #define HANDLE_DIVIDE_OVERFLOW						\
 do									\
 {									\
-  struct ucontext *_uc = (struct ucontext *)_p;				\
+  ucontext_t *_uc = (ucontext_t *)_p;					\
   gregset_t &_gregs = _uc->uc_mcontext.gregs;				\
   unsigned char *_eip = (unsigned char *)_gregs[REG_EIP];		\
 									\
diff --git a/libjava/include/s390-signal.h b/libjava/include/s390-signal.h
index 4ca4c10..9261b52 100644
--- a/libjava/include/s390-signal.h
+++ b/libjava/include/s390-signal.h
@@ -51,7 +51,7 @@ do									\
   struct                                                                \
   {                                                                     \
     unsigned long int uc_flags;                                         \
-    struct ucontext *uc_link;                                           \
+    ucontext_t *uc_link;                                                \
     stack_t uc_stack;                                                   \
     mcontext_t uc_mcontext;                                             \
     unsigned long sigmask[2];                                           \
diff --git a/libjava/include/x86_64-signal.h b/libjava/include/x86_64-signal.h
index 12383b5..e36c5a3 100644
--- a/libjava/include/x86_64-signal.h
+++ b/libjava/include/x86_64-signal.h
@@ -28,7 +28,7 @@ static void _Jv_##_name (int, siginfo_t *,			\
 #define HANDLE_DIVIDE_OVERFLOW						\
 do									\
 {									\
-  struct ucontext *_uc = (struct ucontext *)_p;				\
+  ucontext_t *_uc = (ucontext_t *)_p;					\
   gregset_t &_gregs = _uc->uc_mcontext.gregs;				\
   unsigned char *_rip = (unsigned char *)_gregs[REG_RIP];		\
 									\
-- 
2.9.3

packages/gcc/zstd.patch

deleted100644 → 0
+0 −43
Original line number Diff line number Diff line
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1075,7 +1075,8 @@ GNATMAKE = @GNATMAKE@
 # Libs needed (at present) just for jcf-dump.
 LDEXP_LIB = @LDEXP_LIB@
 
-ZSTD_LIB = @ZSTD_LIB@
+ZSTD_INC = @ZSTD_CPPFLAGS@
+ZSTD_LIB = @ZSTD_LDFLAGS@ @ZSTD_LIB@
 
 # Likewise, for use in the tools that must run on this machine
 # even if we are cross-building GCC.
@@ -2275,7 +2276,7 @@ CFLAGS-version.o += -DBASEVER=$(BASEVER_s) -DDATESTAMP=$(DATESTAMP_s) \
 version.o: $(REVISION) $(DATESTAMP) $(BASEVER) $(DEVPHASE)
 
 # lto-compress.o needs $(ZLIBINC) added to the include flags.
-CFLAGS-lto-compress.o += $(ZLIBINC)
+CFLAGS-lto-compress.o += $(ZLIBINC) $(ZSTD_INC)
 
 CFLAGS-lto-streamer-in.o += -DTARGET_MACHINE=\"$(target_noncanonical)\"
 
--- a/gcc/configure
+++ b/gcc/configure
@@ -786,6 +786,8 @@ LTLIBICONV
 LIBICONV
 ZSTD_LIB
 ZSTD_INCLUDE
+ZSTD_LDFLAGS
+ZSTD_CPPFLAGS
 DL_LIB
 LDEXP_LIB
 EXTRA_GCC_LIBS
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -1339,6 +1339,8 @@ AC_SUBST(ZSTD_INCLUDE)
 AC_SUBST(ZSTD_LIB)
 ZSTD_CPPFLAGS=
 ZSTD_LDFLAGS=
+AC_SUBST(ZSTD_CPPFLAGS)
+AC_SUBST(ZSTD_LDFLAGS)
 AC_ARG_WITH(zstd,
 	[AS_HELP_STRING([--with-zstd=PATH],
 		[specify prefix directory for installed zstd library.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *
from spack.package import *


class Genpybind(WafPackage):
@@ -21,6 +21,8 @@ class Genpybind(WafPackage):
    version('develop', branch='develop')

    version('visions', branch='master', git='https://github.com/electronicvisions/genpybind')
    # good for ebrains-10.0 too…
    version('ebrains-llvm15', tag='ebrains-9.0-a9', git='https://github.com/electronicvisions/genpybind')
    version('ebrains', tag='ebrains_release-1-rc1', git='https://github.com/electronicvisions/genpybind')

    depends_on(
+61 −0
Original line number Diff line number Diff line
# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class Glfw(CMakePackage):
    """GLFW is an Open Source, multi-platform library for
    OpenGL, OpenGL ES and Vulkan development on the desktop. It
    provides a simple API for creating windows, contexts and
    surfaces, receiving input and events."""

    homepage = "https://www.glfw.org/"
    url = "https://github.com/glfw/glfw/archive/3.3.2.tar.gz"

    license("Zlib")

    # begin EBRAINS (added): new version
    version("3.4", sha256="c038d34200234d071fae9345bc455e4a8f2f544ab60150765d7704e08f3dac01")
    # end EBRAINS
    version("3.3.8", sha256="f30f42e05f11e5fc62483e513b0488d5bceeab7d9c5da0ffe2252ad81816c713")
    version("3.3.2", sha256="98768e12e615fbe9f3386f5bbfeb91b5a3b45a8c4c77159cef06b1f6ff749537")
    version("3.3.1", sha256="6bca16e69361798817a4b62a5239a77253c29577fcd5d52ae8b85096e514177f")
    version("3.3", sha256="81bf5fde487676a8af55cb317830703086bb534c53968d71936e7b48ee5a0f3e")
    version("3.2.1", sha256="e10f0de1384d75e6fc210c53e91843f6110d6c4f3afbfb588130713c2f9d8fe8")
    version("3.2", sha256="cb3aab46757981a39ae108e5207a1ecc4378e68949433a2b040ce2e17d8f6aa6")
    version("3.1.2", sha256="6ac642087682aaf7f8397761a41a99042b2c656498217a1c63ba9706d1eef122")
    version("3.1.1", sha256="4de311ec9bf43bfdc8423ddf93b91dc54dc73dcfbedfb0991b6fbb3a9baf245f")
    version("3.1", sha256="2140f4c532e7ce4c84cb7e4c419d0979d5954fa1ce204b7646491bd2cc5bf308")
    version("3.0.4", sha256="a4e7c57db2086803de4fc853bd472ff8b6d2639b9aa16e6ac6b19ffb53958caf")
    version("3.0.3", sha256="7a182047ba6b1fdcda778b79aac249bb2328b6d141188cb5df29560715d01693")

    depends_on("c", type="build")  # generated

    variant("doc", default=False, description="Build documentation")
    variant("shared", default=False, description="Builds a shared version of the library")

    # dependencies
    depends_on("doxygen", type="build", when="+doc")

    # linux only dependencies
    depends_on("libxrandr", when="platform=linux")
    depends_on("libxinerama", when="platform=linux")
    depends_on("libxcursor", when="platform=linux")
    depends_on("libxdamage", when="platform=linux")
    depends_on("libxft", when="platform=linux")
    depends_on("libxi", when="platform=linux")
    depends_on("libxmu", when="platform=linux")
    depends_on("freetype", when="platform=linux")
    depends_on("fontconfig", when="platform=linux")
    depends_on("pkgconfig", type="build", when="platform=linux")

    # begin EBRAINS (added): missing dependency
    depends_on("wayland", when="platform=linux")
    depends_on("libxkbcommon", when="platform=linux")
    # end EBRAINS

    def cmake_args(self):
        return [self.define_from_variant("BUILD_SHARED_LIBS", "shared")]
Original line number Diff line number Diff line
diff --git a/src/hxtorch/wscript b/src/hxtorch/wscript
index aaf670f..39322c8 100644
--- a/hxtorch/wscript
+++ b/hxtorch/wscript

@@ -45,13 +45,19 @@
     )
 
     site_packages = site.getsitepackages()
-    assert isinstance(site_packages, list) and len(site_packages) == 1
-    includes_torch = [os.path.join(x, 'torch/include') for x in site_packages]
-    includes_torch_csrc_api = [os.path.join(x, 'torch/include/torch/csrc/api/include') for x in site_packages]
+    includes_torch = []
+    includes_torch_csrc_api = []
+    for x in site_packages:
+        torch_inc = os.path.join(x, 'torch/include')
+        if os.path.exists(torch_inc):
+            includes_torch.append(torch_inc)
+        torch_csrc_inc = os.path.join(x, 'torch/include/torch/csrc/api/include')
+        if os.path.exists(torch_csrc_inc):
+            includes_torch_csrc_api.append(torch_csrc_inc)
     libpath_torch = [os.path.join(x, 'torch/lib') for x in site_packages]
     libnames = []
     # if torch isn't available via site-packages, try sys.path/PYTHONPATH
-    if not os.path.exists(libpath_torch[0]):
+    if not any([os.path.exists(x) for x in libpath_torch]):
         # find other possible paths
         libpath_torch = [os.path.join(x, 'torch/lib') for x in sys.path if 'torch' in x]
         # filter on existance of path
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack import *
from spack.package import *


class Inja(CMakePackage):

packages/sleef/package.py

deleted100644 → 0
+0 −63

File deleted.

Preview size limit exceeded, changes collapsed.

+50 −37

File changed.

Preview size limit exceeded, changes collapsed.

File added.

Preview size limit exceeded, changes collapsed.

File added.

Preview size limit exceeded, changes collapsed.