Merge branch 'develop' into f/env-location

This commit is contained in:
psakievich 2023-02-13 10:50:53 -07:00 committed by GitHub
commit 51de7ed7ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7929 changed files with 24552 additions and 13205 deletions

View File

@ -19,8 +19,8 @@ jobs:
package-audits: package-audits:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # @v2 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
with: with:
python-version: ${{inputs.python_version}} python-version: ${{inputs.python_version}}
- name: Install Python packages - name: Install Python packages

View File

@ -24,7 +24,7 @@ jobs:
make patch unzip which xz python3 python3-devel tree \ make patch unzip which xz python3 python3-devel tree \
cmake bison bison-devel libstdc++-static cmake bison bison-devel libstdc++-static
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup non-root user - name: Setup non-root user
@ -62,7 +62,7 @@ jobs:
make patch unzip xz-utils python3 python3-dev tree \ make patch unzip xz-utils python3 python3-dev tree \
cmake bison cmake bison
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup non-root user - name: Setup non-root user
@ -99,7 +99,7 @@ jobs:
bzip2 curl file g++ gcc gfortran git gnupg2 gzip \ bzip2 curl file g++ gcc gfortran git gnupg2 gzip \
make patch unzip xz-utils python3 python3-dev tree make patch unzip xz-utils python3 python3-dev tree
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup non-root user - name: Setup non-root user
@ -133,7 +133,7 @@ jobs:
make patch unzip which xz python3 python3-devel tree \ make patch unzip which xz python3 python3-devel tree \
cmake bison cmake bison
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup repo - name: Setup repo
@ -158,7 +158,7 @@ jobs:
run: | run: |
brew install cmake bison@2.7 tree brew install cmake bison@2.7 tree
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Bootstrap clingo - name: Bootstrap clingo
run: | run: |
source share/spack/setup-env.sh source share/spack/setup-env.sh
@ -179,7 +179,7 @@ jobs:
run: | run: |
brew install tree brew install tree
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Bootstrap clingo - name: Bootstrap clingo
run: | run: |
set -ex set -ex
@ -204,7 +204,7 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup repo - name: Setup repo
@ -247,7 +247,7 @@ jobs:
bzip2 curl file g++ gcc patchelf gfortran git gzip \ bzip2 curl file g++ gcc patchelf gfortran git gzip \
make patch unzip xz-utils python3 python3-dev tree make patch unzip xz-utils python3 python3-dev tree
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup non-root user - name: Setup non-root user
@ -283,7 +283,7 @@ jobs:
make patch unzip xz-utils python3 python3-dev tree \ make patch unzip xz-utils python3 python3-dev tree \
gawk gawk
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup non-root user - name: Setup non-root user
@ -316,7 +316,7 @@ jobs:
# Remove GnuPG since we want to bootstrap it # Remove GnuPG since we want to bootstrap it
sudo rm -rf /usr/local/bin/gpg sudo rm -rf /usr/local/bin/gpg
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Bootstrap GnuPG - name: Bootstrap GnuPG
run: | run: |
source share/spack/setup-env.sh source share/spack/setup-env.sh
@ -333,7 +333,7 @@ jobs:
# Remove GnuPG since we want to bootstrap it # Remove GnuPG since we want to bootstrap it
sudo rm -rf /usr/local/bin/gpg sudo rm -rf /usr/local/bin/gpg
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- name: Bootstrap GnuPG - name: Bootstrap GnuPG
run: | run: |
source share/spack/setup-env.sh source share/spack/setup-env.sh

View File

@ -50,7 +50,7 @@ jobs:
if: github.repository == 'spack/spack' if: github.repository == 'spack/spack'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
- name: Set Container Tag Normal (Nightly) - name: Set Container Tag Normal (Nightly)
run: | run: |
@ -80,7 +80,7 @@ jobs:
fi fi
- name: Upload Dockerfile - name: Upload Dockerfile
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
with: with:
name: dockerfiles name: dockerfiles
path: dockerfiles path: dockerfiles
@ -89,7 +89,7 @@ jobs:
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # @v1 uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # @v1
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325 # @v1 uses: docker/setup-buildx-action@f03ac48505955848960e80bbb68046aa35c7b9e7 # @v1
- name: Log in to GitHub Container Registry - name: Log in to GitHub Container Registry
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # @v1 uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # @v1
@ -106,7 +106,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Deploy ${{ matrix.dockerfile[0] }} - name: Build & Deploy ${{ matrix.dockerfile[0] }}
uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5 # @v2 uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 # @v2
with: with:
context: dockerfiles/${{ matrix.dockerfile[0] }} context: dockerfiles/${{ matrix.dockerfile[0] }}
platforms: ${{ matrix.dockerfile[1] }} platforms: ${{ matrix.dockerfile[1] }}

View File

@ -35,7 +35,7 @@ jobs:
core: ${{ steps.filter.outputs.core }} core: ${{ steps.filter.outputs.core }}
packages: ${{ steps.filter.outputs.packages }} packages: ${{ steps.filter.outputs.packages }}
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
if: ${{ github.event_name == 'push' }} if: ${{ github.event_name == 'push' }}
with: with:
fetch-depth: 0 fetch-depth: 0

View File

@ -47,10 +47,10 @@ jobs:
on_develop: false on_develop: false
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # @v2 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install System packages - name: Install System packages
@ -94,10 +94,10 @@ jobs:
shell: shell:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # @v2 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
with: with:
python-version: '3.11' python-version: '3.11'
- name: Install System packages - name: Install System packages
@ -133,7 +133,7 @@ jobs:
dnf install -y \ dnf install -y \
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \ bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
make patch tcl unzip which xz make patch tcl unzip which xz
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
- name: Setup repo and non-root user - name: Setup repo and non-root user
run: | run: |
git --version git --version
@ -151,10 +151,10 @@ jobs:
clingo-cffi: clingo-cffi:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # @v2 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
with: with:
python-version: '3.11' python-version: '3.11'
- name: Install System packages - name: Install System packages
@ -185,10 +185,10 @@ jobs:
matrix: matrix:
python-version: ["3.10"] python-version: ["3.10"]
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # @v2 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
with: with:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- name: Install Python packages - name: Install Python packages

View File

@ -18,8 +18,8 @@ jobs:
validate: validate:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # @v2 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
with: with:
python-version: '3.11' python-version: '3.11'
cache: 'pip' cache: 'pip'
@ -35,16 +35,16 @@ jobs:
style: style:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # @v2 - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # @v2
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # @v2 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # @v2
with: with:
python-version: '3.11' python-version: '3.11'
cache: 'pip' cache: 'pip'
- name: Install Python packages - name: Install Python packages
run: | run: |
python3 -m pip install --upgrade pip six setuptools types-six black mypy isort clingo flake8 python3 -m pip install --upgrade pip six setuptools types-six black==22.12.0 mypy isort clingo flake8
- name: Setup git configuration - name: Setup git configuration
run: | run: |
# Need this for the git tests to succeed. # Need this for the git tests to succeed.

View File

@ -15,10 +15,10 @@ jobs:
unit-tests: unit-tests:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435
with: with:
python-version: 3.9 python-version: 3.9
- name: Install Python packages - name: Install Python packages
@ -39,10 +39,10 @@ jobs:
unit-tests-cmd: unit-tests-cmd:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435
with: with:
python-version: 3.9 python-version: 3.9
- name: Install Python packages - name: Install Python packages
@ -63,10 +63,10 @@ jobs:
build-abseil: build-abseil:
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
with: with:
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435
with: with:
python-version: 3.9 python-version: 3.9
- name: Install Python packages - name: Install Python packages
@ -87,10 +87,10 @@ jobs:
# git config --global core.symlinks false # git config --global core.symlinks false
# shell: # shell:
# powershell # powershell
# - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b # - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
# with: # with:
# fetch-depth: 0 # fetch-depth: 0
# - uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435
# with: # with:
# python-version: 3.9 # python-version: 3.9
# - name: Install Python packages # - name: Install Python packages
@ -121,7 +121,7 @@ jobs:
# run: # run:
# shell: pwsh # shell: pwsh
# steps: # steps:
# - uses: actions/setup-python@5ccb29d8773c3f3f653e1705f474dfaa8a06a912 # - uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435
# with: # with:
# python-version: 3.9 # python-version: 3.9
# - name: Install Python packages # - name: Install Python packages

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2013-2022 LLNS, LLC and other Spack Project Developers. Copyright (c) 2013-2023 LLNS, LLC and other Spack Project Developers.
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,4 +1,4 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -10,6 +10,7 @@ def getpywin():
try: try:
import win32con # noqa: F401 import win32con # noqa: F401
except ImportError: except ImportError:
print("pyWin32 not installed but is required...\nInstalling via pip:")
subprocess.check_call([sys.executable, "-m", "pip", "-q", "install", "--upgrade", "pip"]) subprocess.check_call([sys.executable, "-m", "pip", "-q", "install", "--upgrade", "pip"])
subprocess.check_call([sys.executable, "-m", "pip", "-q", "install", "pywin32"]) subprocess.check_call([sys.executable, "-m", "pip", "-q", "install", "pywin32"])

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# sbang project developers. See the top-level COPYRIGHT file for details. # sbang project developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# -*- python -*- # -*- python -*-
# #
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# #
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
:: Copyright 2013-2021 Lawrence Livermore National Security, LLC and other :: Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
:: Spack Project Developers. See the top-level COPYRIGHT file for details. :: Spack Project Developers. See the top-level COPYRIGHT file for details.
:: ::
:: SPDX-License-Identifier: (Apache-2.0 OR MIT) :: SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -83,6 +83,16 @@ if defined _sp_flags (
exit /B 0 exit /B 0
) )
) )
if not defined _sp_subcommand (
if not defined _sp_args (
if not defined _sp_flags (
python "%spack%" --help
exit /B 0
)
)
)
:: pass parsed variables outside of local scope. Need to do :: pass parsed variables outside of local scope. Need to do
:: this because delayedexpansion can only be set by setlocal :: this because delayedexpansion can only be set by setlocal
echo %_sp_flags%>flags echo %_sp_flags%>flags
@ -92,24 +102,24 @@ endlocal
set /p _sp_subcommand=<subcmd set /p _sp_subcommand=<subcmd
set /p _sp_flags=<flags set /p _sp_flags=<flags
set /p _sp_args=<args set /p _sp_args=<args
set str_subcommand=%_sp_subcommand:"='% if "%_sp_subcommand%"=="ECHO is off." (set "_sp_subcommand=")
set str_flags=%_sp_flags:"='% if "%_sp_subcommand%"=="ECHO is on." (set "_sp_subcommand=")
set str_args=%_sp_args:"='% if "%_sp_flags%"=="ECHO is off." (set "_sp_flags=")
if "%str_subcommand%"=="ECHO is off." (set "_sp_subcommand=") if "%_sp_flags%"=="ECHO is on." (set "_sp_flags=")
if "%str_flags%"=="ECHO is off." (set "_sp_flags=") if "%_sp_args%"=="ECHO is off." (set "_sp_args=")
if "%str_args%"=="ECHO is off." (set "_sp_args=") if "%_sp_args%"=="ECHO is on." (set "_sp_args=")
del subcmd del subcmd
del flags del flags
del args del args
:: Filter out some commands. For any others, just run the command. :: Filter out some commands. For any others, just run the command.
if "%_sp_subcommand%" == "cd" ( if %_sp_subcommand% == "cd" (
goto :case_cd goto :case_cd
) else if "%_sp_subcommand%" == "env" ( ) else if %_sp_subcommand% == "env" (
goto :case_env goto :case_env
) else if "%_sp_subcommand%" == "load" ( ) else if %_sp_subcommand% == "load" (
goto :case_load goto :case_load
) else if "%_sp_subcommand%" == "unload" ( ) else if %_sp_subcommand% == "unload" (
goto :case_load goto :case_load
) else ( ) else (
goto :default_case goto :default_case
@ -143,19 +153,21 @@ goto :end_switch
:: If no args or args contain --bat or -h/--help: just execute. :: If no args or args contain --bat or -h/--help: just execute.
if NOT defined _sp_args ( if NOT defined _sp_args (
goto :default_case goto :default_case
)else if NOT "%_sp_args%"=="%_sp_args:--help=%" ( )
set args_no_quote=%_sp_args:"=%
if NOT "%args_no_quote%"=="%args_no_quote:--help=%" (
goto :default_case goto :default_case
) else if NOT "%_sp_args%"=="%_sp_args: -h=%" ( ) else if NOT "%args_no_quote%"=="%args_no_quote: -h=%" (
goto :default_case goto :default_case
) else if NOT "%_sp_args%"=="%_sp_args:--bat=%" ( ) else if NOT "%args_no_quote%"=="%args_no_quote:--bat=%" (
goto :default_case goto :default_case
) else if NOT "%_sp_args%"=="%_sp_args:deactivate=%" ( ) else if NOT "%args_no_quote%"=="%args_no_quote:deactivate=%" (
for /f "tokens=* USEBACKQ" %%I in ( for /f "tokens=* USEBACKQ" %%I in (
`call python "%spack%" %_sp_flags% env deactivate --bat %_sp_args:deactivate=%` `call python %spack% %_sp_flags% env deactivate --bat %args_no_quote:deactivate=%`
) do %%I ) do %%I
) else if NOT "%_sp_args%"=="%_sp_args:activate=%" ( ) else if NOT "%args_no_quote%"=="%args_no_quote:activate=%" (
for /f "tokens=* USEBACKQ" %%I in ( for /f "tokens=* USEBACKQ" %%I in (
`call python "%spack%" %_sp_flags% env activate --bat %_sp_args:activate=%` `python %spack% %_sp_flags% env activate --bat %args_no_quote:activate=%`
) do %%I ) do %%I
) else ( ) else (
goto :default_case goto :default_case

View File

@ -52,7 +52,6 @@ if defined py_path (
if defined py_exe ( if defined py_exe (
"%py_exe%" "%SPACK_ROOT%\bin\haspywin.py" "%py_exe%" "%SPACK_ROOT%\bin\haspywin.py"
"%py_exe%" "%SPACK_ROOT%\bin\spack" external find python >NUL
) )
set "EDITOR=notepad" set "EDITOR=notepad"

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -54,6 +54,11 @@ config:
# are that it precludes its use as a system package and its ability to be # are that it precludes its use as a system package and its ability to be
# pip installable. # pip installable.
# #
# In Spack environment files, chaining onto existing system Spack
# installations, the $env variable can be used to download, cache and build
# into user-writable paths that are relative to the currently active
# environment.
#
# In any case, if the username is not already in the path, Spack will append # In any case, if the username is not already in the path, Spack will append
# the value of `$user` in an attempt to avoid potential conflicts between # the value of `$user` in an attempt to avoid potential conflicts between
# users in shared temporary spaces. # users in shared temporary spaces.

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -13,49 +13,51 @@ Some sites may encourage users to set up their own test environments
before carrying out central installations, or some users may prefer to set before carrying out central installations, or some users may prefer to set
up these environments on their own motivation. To reduce the load of up these environments on their own motivation. To reduce the load of
recompiling otherwise identical package specs in different installations, recompiling otherwise identical package specs in different installations,
installed packages can be put into build cache tarballs, uploaded to installed packages can be put into build cache tarballs, pushed to
your Spack mirror and then downloaded and installed by others. your Spack mirror and then downloaded and installed by others.
Whenever a mirror provides prebuilt packages, Spack will take these packages
into account during concretization and installation, making ``spack install``
signficantly faster.
--------------------------
Creating build cache files
--------------------------
A compressed tarball of an installed package is created. Tarballs are created .. note::
for all of its link and run dependency packages as well. Compressed tarballs are
signed with gpg and signature and tarball and put in a ``.spack`` file. Optionally, We use the terms "build cache" and "mirror" often interchangeably. Mirrors
the rpaths (and ids and deps on macOS) can be changed to paths relative to are used during installation both for sources and prebuilt packages. Build
the Spack install tree before the tarball is created. caches refer to mirrors that provide prebuilt packages.
----------------------
Creating a build cache
----------------------
Build caches are created via: Build caches are created via:
.. code-block:: console .. code-block:: console
$ spack buildcache create <spec> $ spack buildcache create <path/url/mirror name> <spec>
This command takes the locally installed spec and its dependencies, and
creates tarballs of their install prefixes. It also generates metadata files,
signed with GPG. These tarballs and metadata files are then pushed to the
provided binary cache, which can be a local directory or a remote URL.
If you wanted to create a build cache in a local directory, you would provide Here is an example where a build cache is created in a local directory named
the ``-d`` argument to target that directory, again also specifying the spec. "spack-cache", to which we push the "ninja" spec:
Here is an example creating a local directory, "spack-cache" and creating
build cache files for the "ninja" spec:
.. code-block:: console .. code-block:: console
$ mkdir -p ./spack-cache $ spack buildcache create --allow-root ./spack-cache ninja
$ spack buildcache create -d ./spack-cache ninja ==> Pushing binary packages to file:///home/spackuser/spack/spack-cache/build_cache
==> Buildcache files will be output to file:///home/spackuser/spack/spack-cache/build_cache
gpgconf: socketdir is '/run/user/1000/gnupg'
gpg: using "E6DF6A8BD43208E4D6F392F23777740B7DBD643D" as default secret key for signing
Note that the targeted spec must already be installed. Once you have a build cache, Not that ``ninja`` must be installed locally for this to work.
you can add it as a mirror, discussed next.
.. warning:: We're using the ``--allow-root`` flag to tell Spack that is OK when any of
the binaries we're pushing contain references to the local Spack install
directory.
Spack improved the format used for binary caches in v0.18. The entire v0.18 series Once you have a build cache, you can add it as a mirror, discussed next.
will be able to verify and install binary caches both in the new and in the old format.
Support for using the old format is expected to end in v0.19, so we advise users to
recreate relevant buildcaches using Spack v0.18 or higher.
--------------------------------------- ---------------------------------------
Finding or installing build cache files Finding or installing build cache files
@ -66,10 +68,10 @@ with:
.. code-block:: console .. code-block:: console
$ spack mirror add <name> <url> $ spack mirror add <name> <url or path>
Note that the url can be a web url _or_ a local filesystem location. In the previous Both web URLs and local paths on the filesystem can be specified. In the previous
example, you might add the directory "spack-cache" and call it ``mymirror``: example, you might add the directory "spack-cache" and call it ``mymirror``:
@ -94,7 +96,7 @@ this new build cache as follows:
.. code-block:: console .. code-block:: console
$ spack buildcache update-index -d spack-cache/ $ spack buildcache update-index ./spack-cache
Now you can use list: Now you can use list:
@ -105,46 +107,38 @@ Now you can use list:
-- linux-ubuntu20.04-skylake / gcc@9.3.0 ------------------------ -- linux-ubuntu20.04-skylake / gcc@9.3.0 ------------------------
ninja@1.10.2 ninja@1.10.2
With ``mymirror`` configured and an index available, Spack will automatically
Great! So now let's say you have a different spack installation, or perhaps just use it during concretization and installation. That means that you can expect
a different environment for the same one, and you want to install a package from ``spack install ninja`` to fetch prebuilt packages from the mirror. Let's
that build cache. Let's first uninstall the actual library "ninja" to see if we can verify by re-installing ninja:
re-install it from the cache.
.. code-block:: console .. code-block:: console
$ spack uninstall ninja $ spack uninstall ninja
$ spack install ninja
==> Installing ninja-1.11.1-yxferyhmrjkosgta5ei6b4lqf6bxbscz
And now reinstall from the buildcache ==> Fetching file:///home/spackuser/spack/spack-cache/build_cache/linux-ubuntu20.04-skylake-gcc-9.3.0-ninja-1.10.2-yxferyhmrjkosgta5ei6b4lqf6bxbscz.spec.json.sig
gpg: Signature made Do 12 Jan 2023 16:01:04 CET
.. code-block:: console gpg: using RSA key 61B82B2B2350E171BD17A1744E3A689061D57BF6
gpg: Good signature from "example (GPG created for Spack) <example@example.com>" [ultimate]
$ spack buildcache install ninja ==> Fetching file:///home/spackuser/spack/spack-cache/build_cache/linux-ubuntu20.04-skylake/gcc-9.3.0/ninja-1.10.2/linux-ubuntu20.04-skylake-gcc-9.3.0-ninja-1.10.2-yxferyhmrjkosgta5ei6b4lqf6bxbscz.spack
==> buildcache spec(s) matching ninja ==> Extracting ninja-1.10.2-yxferyhmrjkosgta5ei6b4lqf6bxbscz from binary cache
==> Fetching file:///home/spackuser/spack/spack-cache/build_cache/linux-ubuntu20.04-skylake/gcc-9.3.0/ninja-1.10.2/linux-ubuntu20.04-skylake-gcc-9.3.0-ninja-1.10.2-i4e5luour7jxdpc3bkiykd4imke3mkym.spack ==> ninja: Successfully installed ninja-1.11.1-yxferyhmrjkosgta5ei6b4lqf6bxbscz
####################################################################################################################################### 100.0% Search: 0.00s. Fetch: 0.17s. Install: 0.12s. Total: 0.29s
==> Installing buildcache for spec ninja@1.10.2%gcc@9.3.0 arch=linux-ubuntu20.04-skylake [+] /home/harmen/spack/opt/spack/linux-ubuntu20.04-skylake/gcc-9.3.0/ninja-1.11.1-yxferyhmrjkosgta5ei6b4lqf6bxbscz
gpgconf: socketdir is '/run/user/1000/gnupg'
gpg: Signature made Tue 23 Mar 2021 10:16:29 PM MDT
gpg: using RSA key E6DF6A8BD43208E4D6F392F23777740B7DBD643D
gpg: Good signature from "spackuser (GPG created for Spack) <spackuser@noreply.users.github.com>" [ultimate]
It worked! You've just completed a full example of creating a build cache with It worked! You've just completed a full example of creating a build cache with
a spec of interest, adding it as a mirror, updating it's index, listing the contents, a spec of interest, adding it as a mirror, updating its index, listing the contents,
and finally, installing from it. and finally, installing from it.
By default Spack falls back to building from sources when the mirror is not available
Note that the above command is intended to install a particular package to a or when the package is simply not already available. To force Spack to only install
build cache you have created, and not to install a package from a build cache. prebuilt packages, you can use
For the latter, once a mirror is added, by default when you do ``spack install`` the ``--use-cache``
flag is set, and you will install a package from a build cache if it is available.
If you want to always use the cache, you can do:
.. code-block:: console .. code-block:: console
$ spack install --cache-only <package> $ spack install --use-buildcache only <package>
For example, to combine all of the commands above to add the E4S build cache For example, to combine all of the commands above to add the E4S build cache
and then install from it exclusively, you would do: and then install from it exclusively, you would do:
@ -153,7 +147,7 @@ and then install from it exclusively, you would do:
$ spack mirror add E4S https://cache.e4s.io $ spack mirror add E4S https://cache.e4s.io
$ spack buildcache keys --install --trust $ spack buildcache keys --install --trust
$ spack install --cache-only <package> $ spack install --use-buildache only <package>
We use ``--install`` and ``--trust`` to say that we are installing keys to our We use ``--install`` and ``--trust`` to say that we are installing keys to our
keyring, and trusting all downloaded keys. keyring, and trusting all downloaded keys.

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2021 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -272,7 +272,7 @@ Selection of the target microarchitectures
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The options under the ``targets`` attribute control which targets are considered during a solve. The options under the ``targets`` attribute control which targets are considered during a solve.
Currently the options in this section are only configurable from the ``concretization.yaml`` file Currently the options in this section are only configurable from the ``concretizer.yaml`` file
and there are no corresponding command line arguments to enable them for a single solve. and there are no corresponding command line arguments to enable them for a single solve.
The ``granularity`` option can take two possible values: ``microarchitectures`` and ``generic``. The ``granularity`` option can take two possible values: ``microarchitectures`` and ``generic``.

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2021 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2021 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -163,7 +163,7 @@ def setup(sphinx):
# General information about the project. # General information about the project.
project = "Spack" project = "Spack"
copyright = "2013-2021, Lawrence Livermore National Laboratory." copyright = "2013-2023, Lawrence Livermore National Laboratory."
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -1040,7 +1040,7 @@ gets installed and is available for use in the ``env`` target.
$(SPACK) -e . concretize -f $(SPACK) -e . concretize -f
env.mk: spack.lock env.mk: spack.lock
$(SPACK) -e . env depfile -o $@ --make-target-prefix spack $(SPACK) -e . env depfile -o $@ --make-prefix spack
env: spack/env env: spack/env
$(info Environment installed!) $(info Environment installed!)
@ -1063,9 +1063,9 @@ the include is conditional.
.. note:: .. note::
When including generated ``Makefile``\s, it is important to use When including generated ``Makefile``\s, it is important to use
the ``--make-target-prefix`` flag and use the non-phony target the ``--make-prefix`` flag and use the non-phony target
``<target-prefix>/env`` as prerequisite, instead of the phony target ``<prefix>/env`` as prerequisite, instead of the phony target
``<target-prefix>/all``. ``<prefix>/all``.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Building a subset of the environment Building a subset of the environment
@ -1091,3 +1091,51 @@ output (``spack install --verbose``) while its dependencies are installed silent
# Install the root spec with verbose output. # Install the root spec with verbose output.
$ make -j16 install/python-3.11.0-<hash> SPACK_INSTALL_FLAGS=--verbose $ make -j16 install/python-3.11.0-<hash> SPACK_INSTALL_FLAGS=--verbose
^^^^^^^^^^^^^^^^^^^^^^^^^
Adding post-install hooks
^^^^^^^^^^^^^^^^^^^^^^^^^
Another advanced use-case of generated ``Makefile``\s is running a post-install
command for each package. These "hooks" could be anything from printing a
post-install message, running tests, or pushing just-built binaries to a buildcache.
This can be accomplished through the generated ``[<prefix>/]SPACK_PACKAGE_IDS``
variable. Assuming we have an active and concrete environment, we generate the
associated ``Makefile`` with a prefix ``example``:
.. code:: console
$ spack env depfile -o env.mk --make-prefix example
And we now include it in a different ``Makefile``, in which we create a target
``example/push/%`` with ``%`` referring to a package identifier. This target
depends on the particular package installation. In this target we automatically
have the target-specific ``HASH`` and ``SPEC`` variables at our disposal. They
are respectively the spec hash (excluding leading ``/``), and a human-readable spec.
Finally, we have an entrypoint target ``push`` that will update the buildcache
index once every package is pushed. Note how this target uses the generated
``example/SPACK_PACKAGE_IDS`` variable to define its prerequisites.
.. code:: Makefile
SPACK ?= spack
BUILDCACHE_DIR = $(CURDIR)/tarballs
.PHONY: all
all: push
include env.mk
example/push/%: example/install/%
@mkdir -p $(dir $@)
$(info About to push $(SPEC) to a buildcache)
$(SPACK) -e . buildcache create --allow-root --only=package --directory $(BUILDCACHE_DIR) /$(HASH)
@touch $@
push: $(addprefix example/push/,$(example/SPACK_PACKAGE_IDS))
$(info Updating the buildcache index)
$(SPACK) -e . buildcache update-index --directory $(BUILDCACHE_DIR)
$(info Done!)
@touch $@

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -116,7 +116,7 @@ creates a simple python file:
# FIXME: Add a list of GitHub accounts to # FIXME: Add a list of GitHub accounts to
# notify when the package is updated. # notify when the package is updated.
# maintainers = ["github_user1", "github_user2"] # maintainers("github_user1", "github_user2")
version("0.8.13", sha256="591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d") version("0.8.13", sha256="591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d")

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -1700,29 +1700,15 @@ If in the previous step, you did not have CMake or Ninja installed, running the
Windows Compatible Packages Windows Compatible Packages
""""""""""""""""""""""""""" """""""""""""""""""""""""""
Many Spack packages are not currently compatible with Windows, due to Unix Not all spack packages currently have Windows support. Some are inherently incompatible with the
dependencies or incompatible build tools like autoconf. Here are several platform, and others simply have yet to be ported. To view the current set of packages with Windows
packages known to work on Windows: support, the list command should be used via `spack list -t windows`. If there's a package you'd like
to install on Windows but is not in that list, feel free to reach out to request the port or contribute
* abseil-cpp the port yourself.
* bzip2
* clingo
* cpuinfo
* cmake
* hdf5
* glm
* nasm
* netlib-lapack (requires Intel Fortran)
* ninja
* openssl
* perl
* python
* ruby
* wrf
* zlib
.. note:: .. note::
This is by no means a comprehensive list This is by no means a comprehensive list, some packages may have ports that were not tagged
while others may just work out of the box on Windows and have not been tagged as such.
^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^
For developers For developers
@ -1734,3 +1720,4 @@ Instructions for creating the installer are at
https://github.com/spack/spack/blob/develop/lib/spack/spack/cmd/installer/README.md https://github.com/spack/spack/blob/develop/lib/spack/spack/cmd/installer/README.md
Alternatively a pre-built copy of the Windows installer is available as an artifact of Spack's Windows CI Alternatively a pre-built copy of the Windows installer is available as an artifact of Spack's Windows CI
available at each run of the CI on develop or any PR.

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -34,6 +34,15 @@ ubiquitous in the scientific software community. Second, it's a modern
language and has many powerful features to help make package writing language and has many powerful features to help make package writing
easy. easy.
.. warning::
As a general rule, packages should install the software *from source*.
The only exception is for proprietary software (e.g., vendor compilers).
If a special build system needs to be added in order to support building
a package from source, then the associated code and recipe need to be added
first.
.. _installation_procedure: .. _installation_procedure:
@ -225,7 +234,7 @@ generates a boilerplate template for your package, and opens up the new
.. code-block:: python .. code-block:: python
:linenos: :linenos:
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -259,7 +268,7 @@ generates a boilerplate template for your package, and opens up the new
# FIXME: Add a list of GitHub accounts to # FIXME: Add a list of GitHub accounts to
# notify when the package is updated. # notify when the package is updated.
# maintainers = ["github_user1", "github_user2"] # maintainers("github_user1", "github_user2")
version("6.2.1", sha256="eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c") version("6.2.1", sha256="eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c")
@ -310,14 +319,8 @@ The rest of the tasks you need to do are as follows:
#. Add a comma-separated list of maintainers. #. Add a comma-separated list of maintainers.
The ``maintainers`` field is a list of GitHub accounts of people Add a list of Github accounts of people who want to be notified
who want to be notified any time the package is modified. When a any time the package is modified. See :ref:`package_maintainers`.
pull request is submitted that updates the package, these people
will be requested to review the PR. This is useful for developers
who maintain a Spack package for their own software, as well as
users who rely on a piece of software and want to ensure that the
package doesn't break. It also gives users a list of people to
contact for help when someone reports a build error with the package.
#. Add ``depends_on()`` calls for the package's dependencies. #. Add ``depends_on()`` calls for the package's dependencies.
@ -488,6 +491,31 @@ some examples:
In general, you won't have to remember this naming convention because In general, you won't have to remember this naming convention because
:ref:`cmd-spack-create` and :ref:`cmd-spack-edit` handle the details for you. :ref:`cmd-spack-create` and :ref:`cmd-spack-edit` handle the details for you.
.. _package_maintainers:
-----------
Maintainers
-----------
Each package in Spack may have one or more maintainers, i.e. one or more
GitHub accounts of people who want to be notified any time the package is
modified.
When a pull request is submitted that updates the package, these people will
be requested to review the PR. This is useful for developers who maintain a
Spack package for their own software, as well as users who rely on a piece of
software and want to ensure that the package doesn't break. It also gives users
a list of people to contact for help when someone reports a build error with
the package.
To add maintainers to a package, simply declare them with the ``maintainers`` directive:
.. code-block:: python
maintainers("user1", "user2")
The list of maintainers is additive, and includes all the accounts eventually declared in base classes.
----------------- -----------------
Trusted Downloads Trusted Downloads
----------------- -----------------

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
.. Copyright 2013-2022 Lawrence Livermore National Security, LLC and other .. Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
Spack Project Developers. See the top-level COPYRIGHT file for details. Spack Project Developers. See the top-level COPYRIGHT file for details.
SPDX-License-Identifier: (Apache-2.0 OR MIT) SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

2
lib/spack/env/cc vendored
View File

@ -1,7 +1,7 @@
#!/bin/sh -f #!/bin/sh -f
# shellcheck disable=SC2034 # evals in this script fool shellcheck # shellcheck disable=SC2034 # evals in this script fool shellcheck
# #
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -17,12 +17,13 @@
import tempfile import tempfile
from contextlib import contextmanager from contextlib import contextmanager
from sys import platform as _platform from sys import platform as _platform
from typing import Callable, List, Match, Optional, Tuple, Union
from llnl.util import tty from llnl.util import tty
from llnl.util.lang import dedupe, memoized from llnl.util.lang import dedupe, memoized
from llnl.util.symlink import islink, symlink from llnl.util.symlink import islink, symlink
from spack.util.executable import CommandNotFoundError, Executable, which from spack.util.executable import Executable, which
from spack.util.path import path_to_os_path, system_path_filter from spack.util.path import path_to_os_path, system_path_filter
is_windows = _platform == "win32" is_windows = _platform == "win32"
@ -116,13 +117,7 @@ def path_contains_subdirectory(path, root):
@memoized @memoized
def file_command(*args): def file_command(*args):
"""Creates entry point to `file` system command with provided arguments""" """Creates entry point to `file` system command with provided arguments"""
try:
file_cmd = which("file", required=True) file_cmd = which("file", required=True)
except CommandNotFoundError as e:
if is_windows:
raise CommandNotFoundError("`file` utility is not available on Windows")
else:
raise e
for arg in args: for arg in args:
file_cmd.add_default_arg(arg) file_cmd.add_default_arg(arg)
return file_cmd return file_cmd
@ -133,6 +128,10 @@ def _get_mime_type():
"""Generate method to call `file` system command to aquire mime type """Generate method to call `file` system command to aquire mime type
for a specified path for a specified path
""" """
if is_windows:
# -h option (no-dereference) does not exist in Windows
return file_command("-b", "--mime-type")
else:
return file_command("-b", "-h", "--mime-type") return file_command("-b", "-h", "--mime-type")
@ -214,7 +213,16 @@ def same_path(path1, path2):
return norm1 == norm2 return norm1 == norm2
def filter_file(regex, repl, *filenames, **kwargs): def filter_file(
regex: str,
repl: Union[str, Callable[[Match], str]],
*filenames: str,
string: bool = False,
backup: bool = False,
ignore_absent: bool = False,
start_at: Optional[str] = None,
stop_at: Optional[str] = None,
) -> None:
r"""Like sed, but uses python regular expressions. r"""Like sed, but uses python regular expressions.
Filters every line of each file through regex and replaces the file Filters every line of each file through regex and replaces the file
@ -226,12 +234,10 @@ def filter_file(regex, repl, *filenames, **kwargs):
can contain ``\1``, ``\2``, etc. to represent back-substitution can contain ``\1``, ``\2``, etc. to represent back-substitution
as sed would allow. as sed would allow.
Parameters: Args:
regex (str): The regular expression to search for regex (str): The regular expression to search for
repl (str): The string to replace matches with repl (str): The string to replace matches with
*filenames: One or more files to search and replace *filenames: One or more files to search and replace
Keyword Arguments:
string (bool): Treat regex as a plain string. Default it False string (bool): Treat regex as a plain string. Default it False
backup (bool): Make backup file(s) suffixed with ``~``. Default is False backup (bool): Make backup file(s) suffixed with ``~``. Default is False
ignore_absent (bool): Ignore any files that don't exist. ignore_absent (bool): Ignore any files that don't exist.
@ -246,17 +252,11 @@ def filter_file(regex, repl, *filenames, **kwargs):
file is copied verbatim. Default is to filter until the end of the file is copied verbatim. Default is to filter until the end of the
file. file.
""" """
string = kwargs.get("string", False)
backup = kwargs.get("backup", False)
ignore_absent = kwargs.get("ignore_absent", False)
start_at = kwargs.get("start_at", None)
stop_at = kwargs.get("stop_at", None)
# Allow strings to use \1, \2, etc. for replacement, like sed # Allow strings to use \1, \2, etc. for replacement, like sed
if not callable(repl): if not callable(repl):
unescaped = repl.replace(r"\\", "\\") unescaped = repl.replace(r"\\", "\\")
def replace_groups_with_groupid(m): def replace_groups_with_groupid(m: Match) -> str:
def groupid_to_group(x): def groupid_to_group(x):
return m.group(int(x.group(1))) return m.group(int(x.group(1)))
@ -290,15 +290,14 @@ def groupid_to_group(x):
shutil.copy(filename, tmp_filename) shutil.copy(filename, tmp_filename)
try: try:
# To avoid translating line endings (\n to \r\n and vis versa) # Open as a text file and filter until the end of the file is
# reached, or we found a marker in the line if it was specified
#
# To avoid translating line endings (\n to \r\n and vice-versa)
# we force os.open to ignore translations and use the line endings # we force os.open to ignore translations and use the line endings
# the file comes with # the file comes with
extra_kwargs = {"errors": "surrogateescape", "newline": ""} with open(tmp_filename, mode="r", errors="surrogateescape", newline="") as input_file:
with open(filename, mode="w", errors="surrogateescape", newline="") as output_file:
# Open as a text file and filter until the end of the file is
# reached or we found a marker in the line if it was specified
with open(tmp_filename, mode="r", **extra_kwargs) as input_file:
with open(filename, mode="w", **extra_kwargs) as output_file:
do_filtering = start_at is None do_filtering = start_at is None
# Using iter and readline is a workaround needed not to # Using iter and readline is a workaround needed not to
# disable input_file.tell(), which will happen if we call # disable input_file.tell(), which will happen if we call
@ -321,10 +320,10 @@ def groupid_to_group(x):
# If we stopped filtering at some point, reopen the file in # If we stopped filtering at some point, reopen the file in
# binary mode and copy verbatim the remaining part # binary mode and copy verbatim the remaining part
if current_position and stop_at: if current_position and stop_at:
with open(tmp_filename, mode="rb") as input_file: with open(tmp_filename, mode="rb") as input_binary_buffer:
input_file.seek(current_position) input_binary_buffer.seek(current_position)
with open(filename, mode="ab") as output_file: with open(filename, mode="ab") as output_binary_buffer:
output_file.writelines(input_file.readlines()) output_binary_buffer.writelines(input_binary_buffer.readlines())
except BaseException: except BaseException:
# clean up the original file on failure. # clean up the original file on failure.
@ -343,8 +342,26 @@ class FileFilter(object):
def __init__(self, *filenames): def __init__(self, *filenames):
self.filenames = filenames self.filenames = filenames
def filter(self, regex, repl, **kwargs): def filter(
return filter_file(regex, repl, *self.filenames, **kwargs) self,
regex: str,
repl: Union[str, Callable[[Match], str]],
string: bool = False,
backup: bool = False,
ignore_absent: bool = False,
start_at: Optional[str] = None,
stop_at: Optional[str] = None,
) -> None:
return filter_file(
regex,
repl,
*self.filenames,
string=string,
backup=backup,
ignore_absent=ignore_absent,
start_at=start_at,
stop_at=stop_at,
)
def change_sed_delimiter(old_delim, new_delim, *filenames): def change_sed_delimiter(old_delim, new_delim, *filenames):
@ -652,7 +669,13 @@ def resolve_link_target_relative_to_the_link(link):
@system_path_filter @system_path_filter
def copy_tree(src, dest, symlinks=True, ignore=None, _permissions=False): def copy_tree(
src: str,
dest: str,
symlinks: bool = True,
ignore: Optional[Callable[[str], bool]] = None,
_permissions: bool = False,
):
"""Recursively copy an entire directory tree rooted at *src*. """Recursively copy an entire directory tree rooted at *src*.
If the destination directory *dest* does not already exist, it will If the destination directory *dest* does not already exist, it will
@ -710,7 +733,7 @@ def copy_tree(src, dest, symlinks=True, ignore=None, _permissions=False):
abs_src, abs_src,
abs_dest, abs_dest,
order="pre", order="pre",
follow_symlinks=not symlinks, follow_links=not symlinks,
ignore=ignore, ignore=ignore,
follow_nonexisting=True, follow_nonexisting=True,
): ):
@ -812,45 +835,32 @@ def chgrp_if_not_world_writable(path, group):
chgrp(path, group) chgrp(path, group)
def mkdirp(*paths, **kwargs): def mkdirp(
*paths: str,
mode: Optional[int] = None,
group: Optional[Union[str, int]] = None,
default_perms: Optional[str] = None,
):
"""Creates a directory, as well as parent directories if needed. """Creates a directory, as well as parent directories if needed.
Arguments: Arguments:
paths (str): paths to create with mkdirp paths: paths to create with mkdirp
mode: optional permissions to set on the created directory -- use OS default
Keyword Aguments: if not provided
mode (permission bits or None): optional permissions to set group: optional group for permissions of final created directory -- use OS
on the created directory -- use OS default if not provided default if not provided. Only used if world write permissions are not set
group (group name or None): optional group for permissions of default_perms: one of 'parents' or 'args'. The default permissions that are set for
final created directory -- use OS default if not provided. Only directories that are not themselves an argument for mkdirp. 'parents' means
used if world write permissions are not set intermediate directories get the permissions of their direct parent directory,
default_perms (str or None): one of 'parents' or 'args'. The default permissions 'args' means intermediate get the same permissions specified in the arguments to
that are set for directories that are not themselves an argument
for mkdirp. 'parents' means intermediate directories get the
permissions of their direct parent directory, 'args' means
intermediate get the same permissions specified in the arguments to
mkdirp -- default value is 'args' mkdirp -- default value is 'args'
""" """
mode = kwargs.get("mode", None) default_perms = default_perms or "args"
group = kwargs.get("group", None)
default_perms = kwargs.get("default_perms", "args")
paths = path_to_os_path(*paths) paths = path_to_os_path(*paths)
for path in paths: for path in paths:
if not os.path.exists(path): if not os.path.exists(path):
try: try:
# detect missing intermediate folders last_parent, intermediate_folders = longest_existing_parent(path)
intermediate_folders = []
last_parent = ""
intermediate_path = os.path.dirname(path)
while intermediate_path:
if os.path.exists(intermediate_path):
last_parent = intermediate_path
break
intermediate_folders.append(intermediate_path)
intermediate_path = os.path.dirname(intermediate_path)
# create folders # create folders
os.makedirs(path) os.makedirs(path)
@ -884,7 +894,10 @@ def mkdirp(*paths, **kwargs):
os.chmod(intermediate_path, intermediate_mode) os.chmod(intermediate_path, intermediate_mode)
if intermediate_group is not None: if intermediate_group is not None:
chgrp_if_not_world_writable(intermediate_path, intermediate_group) chgrp_if_not_world_writable(intermediate_path, intermediate_group)
os.chmod(intermediate_path, intermediate_mode) # reset sticky bit after if intermediate_mode is not None:
os.chmod(
intermediate_path, intermediate_mode
) # reset sticky bit after
except OSError as e: except OSError as e:
if e.errno != errno.EEXIST or not os.path.isdir(path): if e.errno != errno.EEXIST or not os.path.isdir(path):
@ -893,6 +906,27 @@ def mkdirp(*paths, **kwargs):
raise OSError(errno.EEXIST, "File already exists", path) raise OSError(errno.EEXIST, "File already exists", path)
def longest_existing_parent(path: str) -> Tuple[str, List[str]]:
"""Return the last existing parent and a list of all intermediate directories
to be created for the directory passed as input.
Args:
path: directory to be created
"""
# detect missing intermediate folders
intermediate_folders = []
last_parent = ""
intermediate_path = os.path.dirname(path)
while intermediate_path:
if os.path.lexists(intermediate_path):
last_parent = intermediate_path
break
intermediate_folders.append(intermediate_path)
intermediate_path = os.path.dirname(intermediate_path)
return last_parent, intermediate_folders
@system_path_filter @system_path_filter
def force_remove(*paths): def force_remove(*paths):
"""Remove files without printing errors. Like ``rm -f``, does NOT """Remove files without printing errors. Like ``rm -f``, does NOT
@ -906,8 +940,8 @@ def force_remove(*paths):
@contextmanager @contextmanager
@system_path_filter @system_path_filter
def working_dir(dirname, **kwargs): def working_dir(dirname: str, *, create: bool = False):
if kwargs.get("create", False): if create:
mkdirp(dirname) mkdirp(dirname)
orig_dir = os.getcwd() orig_dir = os.getcwd()
@ -1118,7 +1152,16 @@ def can_access(file_name):
@system_path_filter @system_path_filter
def traverse_tree(source_root, dest_root, rel_path="", **kwargs): def traverse_tree(
source_root: str,
dest_root: str,
rel_path: str = "",
*,
order: str = "pre",
ignore: Optional[Callable[[str], bool]] = None,
follow_nonexisting: bool = True,
follow_links: bool = False,
):
"""Traverse two filesystem trees simultaneously. """Traverse two filesystem trees simultaneously.
Walks the LinkTree directory in pre or post order. Yields each Walks the LinkTree directory in pre or post order. Yields each
@ -1150,16 +1193,11 @@ def traverse_tree(source_root, dest_root, rel_path="", **kwargs):
``src`` that do not exit in ``dest``. Default is True ``src`` that do not exit in ``dest``. Default is True
follow_links (bool): Whether to descend into symlinks in ``src`` follow_links (bool): Whether to descend into symlinks in ``src``
""" """
follow_nonexisting = kwargs.get("follow_nonexisting", True)
follow_links = kwargs.get("follow_link", False)
# Yield in pre or post order?
order = kwargs.get("order", "pre")
if order not in ("pre", "post"): if order not in ("pre", "post"):
raise ValueError("Order must be 'pre' or 'post'.") raise ValueError("Order must be 'pre' or 'post'.")
# List of relative paths to ignore under the src root. # List of relative paths to ignore under the src root.
ignore = kwargs.get("ignore", None) or (lambda filename: False) ignore = ignore or (lambda filename: False)
# Don't descend into ignored directories # Don't descend into ignored directories
if ignore(rel_path): if ignore(rel_path):
@ -1186,7 +1224,15 @@ def traverse_tree(source_root, dest_root, rel_path="", **kwargs):
# When follow_nonexisting isn't set, don't descend into dirs # When follow_nonexisting isn't set, don't descend into dirs
# in source that do not exist in dest # in source that do not exist in dest
if follow_nonexisting or os.path.exists(dest_child): if follow_nonexisting or os.path.exists(dest_child):
tuples = traverse_tree(source_root, dest_root, rel_child, **kwargs) tuples = traverse_tree(
source_root,
dest_root,
rel_child,
order=order,
ignore=ignore,
follow_nonexisting=follow_nonexisting,
follow_links=follow_links,
)
for t in tuples: for t in tuples:
yield t yield t
@ -2573,13 +2619,15 @@ def keep_modification_time(*filenames):
@contextmanager @contextmanager
def temporary_dir(*args, **kwargs): def temporary_dir(
suffix: Optional[str] = None, prefix: Optional[str] = None, dir: Optional[str] = None
):
"""Create a temporary directory and cd's into it. Delete the directory """Create a temporary directory and cd's into it. Delete the directory
on exit. on exit.
Takes the same arguments as tempfile.mkdtemp() Takes the same arguments as tempfile.mkdtemp()
""" """
tmp_dir = tempfile.mkdtemp(*args, **kwargs) tmp_dir = tempfile.mkdtemp(suffix=suffix, prefix=prefix, dir=dir)
try: try:
with working_dir(tmp_dir): with working_dir(tmp_dir):
yield tmp_dir yield tmp_dir

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -107,6 +107,64 @@ def __init__(self, message):
_force_color = None _force_color = None
def try_enable_terminal_color_on_windows():
"""Turns coloring in Windows terminal by enabling VTP in Windows consoles (CMD/PWSH/CONHOST)
Method based on the link below
https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences#example-of-enabling-virtual-terminal-processing
Note: No-op on non windows platforms
"""
if sys.platform == "win32":
import ctypes
import msvcrt
from ctypes import wintypes
try:
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
DISABLE_NEWLINE_AUTO_RETURN = 0x0008
kernel32 = ctypes.WinDLL("kernel32")
def _err_check(result, func, args):
if not result:
raise ctypes.WinError(ctypes.get_last_error())
return args
kernel32.GetConsoleMode.errcheck = _err_check
kernel32.GetConsoleMode.argtypes = (
wintypes.HANDLE, # hConsoleHandle, i.e. GetStdHandle output type
ctypes.POINTER(wintypes.DWORD), # result of GetConsoleHandle
)
kernel32.SetConsoleMode.errcheck = _err_check
kernel32.SetConsoleMode.argtypes = (
wintypes.HANDLE, # hConsoleHandle, i.e. GetStdHandle output type
wintypes.DWORD, # result of GetConsoleHandle
)
# Use conout$ here to handle a redirectired stdout/get active console associated
# with spack
with open(r"\\.\CONOUT$", "w") as conout:
# Link above would use kernel32.GetStdHandle(-11) however this would not handle
# a redirected stdout appropriately, so we always refer to the current CONSOLE out
# which is defined as conout$ on Windows.
# linked example is follow more or less to the letter beyond this point
con_handle = msvcrt.get_osfhandle(conout.fileno())
dw_orig_mode = wintypes.DWORD()
kernel32.GetConsoleMode(con_handle, ctypes.byref(dw_orig_mode))
dw_new_mode_request = (
ENABLE_VIRTUAL_TERMINAL_PROCESSING | DISABLE_NEWLINE_AUTO_RETURN
)
dw_new_mode = dw_new_mode_request | dw_orig_mode.value
kernel32.SetConsoleMode(con_handle, wintypes.DWORD(dw_new_mode))
except OSError:
# We failed to enable color support for associated console
# report and move on but spack will no longer attempt to
# color
global _force_color
_force_color = False
from . import debug
debug("Unable to support color on Windows terminal")
def _color_when_value(when): def _color_when_value(when):
"""Raise a ValueError for an invalid color setting. """Raise a ValueError for an invalid color setting.

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,13 +1,11 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import codecs import codecs
import collections import collections
import gzip
import hashlib import hashlib
import io
import json import json
import multiprocessing.pool import multiprocessing.pool
import os import os
@ -49,7 +47,7 @@
import spack.util.url as url_util import spack.util.url as url_util
import spack.util.web as web_util import spack.util.web as web_util
from spack.caches import misc_cache_location from spack.caches import misc_cache_location
from spack.relocate import utf8_paths_to_single_binary_regex from spack.relocate_text import utf8_paths_to_single_binary_regex
from spack.spec import Spec from spack.spec import Spec
from spack.stage import Stage from spack.stage import Stage
from spack.util.executable import which from spack.util.executable import which
@ -296,10 +294,12 @@ def update_spec(self, spec, found_list):
cur_entry["spec"] = new_entry["spec"] cur_entry["spec"] = new_entry["spec"]
break break
else: else:
current_list.append = { current_list.append(
{
"mirror_url": new_entry["mirror_url"], "mirror_url": new_entry["mirror_url"],
"spec": new_entry["spec"], "spec": new_entry["spec"],
} }
)
def update(self, with_cooldown=False): def update(self, with_cooldown=False):
"""Make sure local cache of buildcache index files is up to date. """Make sure local cache of buildcache index files is up to date.
@ -512,9 +512,9 @@ class NoOverwriteException(spack.error.SpackError):
""" """
def __init__(self, file_path): def __init__(self, file_path):
err_msg = "\n%s\nexists\n" % file_path super(NoOverwriteException, self).__init__(
err_msg += "Use -f option to overwrite." '"{}" exists in buildcache. Use --force flag to overwrite.'.format(file_path)
super(NoOverwriteException, self).__init__(err_msg) )
class NoGpgException(spack.error.SpackError): class NoGpgException(spack.error.SpackError):
@ -615,28 +615,6 @@ def read_buildinfo_file(prefix):
return buildinfo return buildinfo
def transparently_decompress_bytes(binary_stream):
"""Wrap stream in a decompress wrapper if gzip compressed"""
# Get magic bytes
if isinstance(binary_stream, io.BytesIO):
# Not peekable... Alternatively io.BufferedReader(io.BytesIO(...))
# but to add yet another wrapper just to read two bytes that are
# already in memory... sigh.
magic = binary_stream.read(2)
binary_stream.seek(0)
else:
magic = binary_stream.peek(2)
# Verify magic
if magic.startswith(b"\x1f\x8b"):
return gzip.GzipFile(fileobj=binary_stream)
return binary_stream
def transparently_decompress_bytes_to_string(binary_stream, encoding="utf-8"):
return codecs.getreader(encoding)(transparently_decompress_bytes(binary_stream))
class BuildManifestVisitor(BaseDirectoryVisitor): class BuildManifestVisitor(BaseDirectoryVisitor):
"""Visitor that collects a list of files and symlinks """Visitor that collects a list of files and symlinks
that can be checked for need of relocation. It knows how that can be checked for need of relocation. It knows how
@ -869,42 +847,6 @@ def sign_specfile(key, force, specfile_path):
spack.util.gpg.sign(key, specfile_path, signed_specfile_path, clearsign=True) spack.util.gpg.sign(key, specfile_path, signed_specfile_path, clearsign=True)
def _load_clearsigned_json(stream):
# Skip the PGP header
stream.readline()
stream.readline()
json = stream.read()
footer_index = json.rfind("-----BEGIN PGP SIGNATURE-----")
if footer_index == -1 or not json[footer_index - 1].isspace():
raise ValueError("Could not find PGP signature in clearsigned json file.")
return sjson.load(json[:footer_index])
def _load_possibly_clearsigned_json(stream):
if _is_clearsigned_stream(stream):
return _load_clearsigned_json(stream)
return sjson.load(stream)
def _is_clearsigned_stream(stream):
curr = stream.tell()
header = stream.read(34)
stream.seek(curr)
return header == "-----BEGIN PGP SIGNED MESSAGE-----"
def is_clearsigned_file(path):
with open(path, "r") as f:
return _is_clearsigned_stream(f)
def load_possibly_clearsigned_json(s):
"""Deserialize JSON from a string or stream s, removing any clearsign
header/footer."""
s = io.StringIO(s) if isinstance(s, str) else s
return _load_possibly_clearsigned_json(s)
def _read_specs_and_push_index(file_list, read_method, cache_prefix, db, temp_dir, concurrency): def _read_specs_and_push_index(file_list, read_method, cache_prefix, db, temp_dir, concurrency):
"""Read all the specs listed in the provided list, using thread given thread parallelism, """Read all the specs listed in the provided list, using thread given thread parallelism,
generate the index, and push it to the mirror. generate the index, and push it to the mirror.
@ -927,7 +869,11 @@ def _fetch_spec_from_mirror(spec_url):
if spec_file_contents: if spec_file_contents:
# Need full spec.json name or this gets confused with index.json. # Need full spec.json name or this gets confused with index.json.
return Spec.from_dict(load_possibly_clearsigned_json(spec_file_contents)) if spec_url.endswith(".json.sig"):
specfile_json = Spec.extract_json_from_clearsig(spec_file_contents)
return Spec.from_dict(specfile_json)
if spec_url.endswith(".json"):
return Spec.from_json(spec_file_contents)
tp = multiprocessing.pool.ThreadPool(processes=concurrency) tp = multiprocessing.pool.ThreadPool(processes=concurrency)
try: try:
@ -989,8 +935,8 @@ def _specs_from_cache_aws_cli(cache_prefix):
aws = which("aws") aws = which("aws")
def file_read_method(file_path): def file_read_method(file_path):
with open(file_path, "rb") as f: with open(file_path) as fd:
return transparently_decompress_bytes_to_string(f).read() return fd.read()
tmpspecsdir = tempfile.mkdtemp() tmpspecsdir = tempfile.mkdtemp()
sync_command_args = [ sync_command_args = [
@ -1037,7 +983,7 @@ def url_read_method(url):
contents = None contents = None
try: try:
_, _, spec_file = web_util.read_from_url(url) _, _, spec_file = web_util.read_from_url(url)
contents = transparently_decompress_bytes_to_string(spec_file).read() contents = codecs.getreader("utf-8")(spec_file).read()
except (URLError, web_util.SpackWebError) as url_err: except (URLError, web_util.SpackWebError) as url_err:
tty.error("Error reading specfile: {0}".format(url)) tty.error("Error reading specfile: {0}".format(url))
tty.error(url_err) tty.error(url_err)
@ -1106,7 +1052,7 @@ def generate_package_index(cache_prefix, concurrency=32):
try: try:
file_list, read_fn = _spec_files_from_cache(cache_prefix) file_list, read_fn = _spec_files_from_cache(cache_prefix)
except ListMirrorSpecsError as err: except ListMirrorSpecsError as err:
tty.error("Unabled to generate package index, {0}".format(err)) tty.error("Unable to generate package index, {0}".format(err))
return return
tty.debug("Retrieving spec descriptor files from {0} to build index".format(cache_prefix)) tty.debug("Retrieving spec descriptor files from {0} to build index".format(cache_prefix))
@ -1435,7 +1381,7 @@ def try_verify(specfile_path):
return True return True
def try_fetch(url_to_fetch, try_decompress=False): def try_fetch(url_to_fetch):
"""Utility function to try and fetch a file from a url, stage it """Utility function to try and fetch a file from a url, stage it
locally, and return the path to the staged file. locally, and return the path to the staged file.
@ -1454,21 +1400,6 @@ def try_fetch(url_to_fetch, try_decompress=False):
stage.destroy() stage.destroy()
return None return None
if not try_decompress:
return stage
# Stage has some logic for automatically expanding
# archives, but it is based on file extensions. So instead,
# we more or less repeat the logic.
try:
tmp = stage.save_filename + ".tmp"
with gzip.open(stage.save_filename, "rb") as compressed:
with open(tmp, "wb") as decompressed:
shutil.copyfileobj(compressed, decompressed)
os.rename(tmp, stage.save_filename)
except OSError:
pass
return stage return stage
@ -1538,45 +1469,61 @@ def download_tarball(spec, unsigned=False, mirrors_for_spec=None):
} }
) )
verification_failure = False tried_to_verify_sigs = []
# Assumes we care more about finding a spec file by preferred ext
# than by mirrory priority. This can be made less complicated as
# we remove support for deprecated spec formats and buildcache layouts.
for ext in ["json.sig", "json"]: for ext in ["json.sig", "json"]:
for mirror in mirrors_to_try: for mirror_to_try in mirrors_to_try:
# Try to download the specfile. For any legacy version of Spack's buildcache specfile_url = "{0}.{1}".format(mirror_to_try["specfile"], ext)
# we definitely require this file. spackfile_url = mirror_to_try["spackfile"]
specfile_url = "{0}.{1}".format(mirror["specfile"], ext) local_specfile_stage = try_fetch(specfile_url)
specfile_stage = try_fetch(specfile_url, try_decompress=True) if local_specfile_stage:
if not specfile_stage: local_specfile_path = local_specfile_stage.save_filename
continue signature_verified = False
specfile_path = specfile_stage.save_filename if ext.endswith(".sig") and not unsigned:
# If we found a signed specfile at the root, try to verify
# If it is a clearsign file, we must verify it (unless disabled) # the signature immediately. We will not download the
should_verify = not unsigned and is_clearsigned_file(specfile_path) # tarball if we could not verify the signature.
if should_verify and not try_verify(specfile_path): tried_to_verify_sigs.append(specfile_url)
verification_failure = True signature_verified = try_verify(local_specfile_path)
if not signature_verified:
tty.warn("Failed to verify: {0}".format(specfile_url)) tty.warn("Failed to verify: {0}".format(specfile_url))
specfile_stage.destroy()
continue
# In case the spec.json is not clearsigned, it means it's a legacy if unsigned or signature_verified or not ext.endswith(".sig"):
# format, where either the signature is in the tarball with binaries, or # We will download the tarball in one of three cases:
# the package is unsigned. Verification # 1. user asked for --no-check-signature
# is then postponed. # 2. user didn't ask for --no-check-signature, but we
spackfile_url = mirror["spackfile"] # found a spec.json.sig and verified the signature already
# 3. neither of the first two cases are true, but this file
# is *not* a signed json (not a spec.json.sig file). That
# means we already looked at all the mirrors and either didn't
# find any .sig files or couldn't verify any of them. But it
# is still possible to find an old style binary package where
# the signature is a detached .asc file in the outer archive
# of the tarball, and in that case, the only way to know is to
# download the tarball. This is a deprecated use case, so if
# something goes wrong during the extraction process (can't
# verify signature, checksum doesn't match) we will fail at
# that point instead of trying to download more tarballs from
# the remaining mirrors, looking for one we can use.
tarball_stage = try_fetch(spackfile_url) tarball_stage = try_fetch(spackfile_url)
if tarball_stage: if tarball_stage:
return { return {
"tarball_stage": tarball_stage, "tarball_stage": tarball_stage,
"specfile_stage": specfile_stage, "specfile_stage": local_specfile_stage,
"signature_verified": should_verify, # should_verify implies it was verified "signature_verified": signature_verified,
} }
specfile_stage.destroy()
local_specfile_stage.destroy()
# Falling through the nested loops meeans we exhaustively searched # Falling through the nested loops meeans we exhaustively searched
# for all known kinds of spec files on all mirrors and did not find # for all known kinds of spec files on all mirrors and did not find
# an acceptable one for which we could download a tarball. # an acceptable one for which we could download a tarball.
if verification_failure: if tried_to_verify_sigs:
raise NoVerifyException( raise NoVerifyException(
( (
"Spack found new style signed binary packages, " "Spack found new style signed binary packages, "
@ -1785,16 +1732,16 @@ def is_backup_file(file):
# For all buildcaches # For all buildcaches
# relocate the install prefixes in text files including dependencies # relocate the install prefixes in text files including dependencies
relocate.unsafe_relocate_text(text_names, prefix_to_prefix_text) relocate.relocate_text(text_names, prefix_to_prefix_text)
# relocate the install prefixes in binary files including dependencies # relocate the install prefixes in binary files including dependencies
relocate.unsafe_relocate_text_bin(files_to_relocate, prefix_to_prefix_bin) relocate.relocate_text_bin(files_to_relocate, prefix_to_prefix_bin)
# If we are installing back to the same location # If we are installing back to the same location
# relocate the sbang location if the spack directory changed # relocate the sbang location if the spack directory changed
else: else:
if old_spack_prefix != new_spack_prefix: if old_spack_prefix != new_spack_prefix:
relocate.unsafe_relocate_text(text_names, prefix_to_prefix_text) relocate.relocate_text(text_names, prefix_to_prefix_text)
def _extract_inner_tarball(spec, filename, extract_to, unsigned, remote_checksum): def _extract_inner_tarball(spec, filename, extract_to, unsigned, remote_checksum):
@ -1857,7 +1804,11 @@ def extract_tarball(spec, download_result, allow_root=False, unsigned=False, for
specfile_path = download_result["specfile_stage"].save_filename specfile_path = download_result["specfile_stage"].save_filename
with open(specfile_path, "r") as inputfile: with open(specfile_path, "r") as inputfile:
spec_dict = load_possibly_clearsigned_json(inputfile) content = inputfile.read()
if specfile_path.endswith(".json.sig"):
spec_dict = Spec.extract_json_from_clearsig(content)
else:
spec_dict = sjson.load(content)
bchecksum = spec_dict["binary_cache_checksum"] bchecksum = spec_dict["binary_cache_checksum"]
filename = download_result["tarball_stage"].save_filename filename = download_result["tarball_stage"].save_filename
@ -2022,26 +1973,46 @@ def try_direct_fetch(spec, mirrors=None):
""" """
specfile_name = tarball_name(spec, ".spec.json") specfile_name = tarball_name(spec, ".spec.json")
signed_specfile_name = tarball_name(spec, ".spec.json.sig") signed_specfile_name = tarball_name(spec, ".spec.json.sig")
specfile_is_signed = False
found_specs = [] found_specs = []
for mirror in spack.mirror.MirrorCollection(mirrors=mirrors).values(): for mirror in spack.mirror.MirrorCollection(mirrors=mirrors).values():
for file in (specfile_name, signed_specfile_name): buildcache_fetch_url_json = url_util.join(
url = url_util.join(mirror.fetch_url, _build_cache_relative_path, file) mirror.fetch_url, _build_cache_relative_path, specfile_name
)
buildcache_fetch_url_signed_json = url_util.join(
mirror.fetch_url, _build_cache_relative_path, signed_specfile_name
)
try: try:
_, _, fs = web_util.read_from_url(url) _, _, fs = web_util.read_from_url(buildcache_fetch_url_signed_json)
specfile_is_signed = True
except (URLError, web_util.SpackWebError, HTTPError) as url_err: except (URLError, web_util.SpackWebError, HTTPError) as url_err:
try:
_, _, fs = web_util.read_from_url(buildcache_fetch_url_json)
except (URLError, web_util.SpackWebError, HTTPError) as url_err_x:
tty.debug( tty.debug(
"Did not find {0} on {1}".format(specfile_name, url), "Did not find {0} on {1}".format(
specfile_name, buildcache_fetch_url_signed_json
),
url_err, url_err,
level=2, level=2,
) )
tty.debug(
"Did not find {0} on {1}".format(specfile_name, buildcache_fetch_url_json),
url_err_x,
level=2,
)
continue continue
specfile_contents = codecs.getreader("utf-8")(fs).read()
# read the spec from the build cache file. All specs in build caches # read the spec from the build cache file. All specs in build caches
# are concrete (as they are built) so we need to mark this spec # are concrete (as they are built) so we need to mark this spec
# concrete on read-in. # concrete on read-in.
stream = transparently_decompress_bytes_to_string(fs) if specfile_is_signed:
fetched_spec = Spec.from_dict(load_possibly_clearsigned_json(stream)) specfile_json = Spec.extract_json_from_clearsig(specfile_contents)
fetched_spec = Spec.from_dict(specfile_json)
else:
fetched_spec = Spec.from_json(specfile_contents)
fetched_spec._mark_concrete() fetched_spec._mark_concrete()
found_specs.append( found_specs.append(
@ -2050,7 +2021,6 @@ def try_direct_fetch(spec, mirrors=None):
"spec": fetched_spec, "spec": fetched_spec,
} }
) )
break
return found_specs return found_specs
@ -2129,7 +2099,7 @@ def get_keys(install=False, trust=False, force=False, mirrors=None):
try: try:
_, _, json_file = web_util.read_from_url(keys_index) _, _, json_file = web_util.read_from_url(keys_index)
json_index = sjson.load(transparently_decompress_bytes_to_string(json_file)) json_index = sjson.load(codecs.getreader("utf-8")(json_file))
except (URLError, web_util.SpackWebError) as url_err: except (URLError, web_util.SpackWebError) as url_err:
if web_util.url_exists(keys_index): if web_util.url_exists(keys_index):
err_msg = [ err_msg = [
@ -2454,15 +2424,11 @@ def conditional_fetch(self):
raise FetchIndexError("Could not fetch index from {}".format(url_index), e) raise FetchIndexError("Could not fetch index from {}".format(url_index), e)
try: try:
binary_result = response.read() result = codecs.getreader("utf-8")(response).read()
except ValueError as e: except ValueError as e:
return FetchCacheError("Remote index {} is invalid".format(url_index), e) return FetchCacheError("Remote index {} is invalid".format(url_index), e)
# The hash is computed on the raw bytes computed_hash = compute_hash(result)
computed_hash = compute_hash(binary_result)
# Only then decode as string, possibly decompress
result = transparently_decompress_bytes_to_string(io.BytesIO(binary_result)).read()
# We don't handle computed_hash != remote_hash here, which can happen # We don't handle computed_hash != remote_hash here, which can happen
# when remote index.json and index.json.hash are out of sync, or if # when remote index.json and index.json.hash are out of sync, or if
@ -2516,21 +2482,15 @@ def conditional_fetch(self):
raise FetchIndexError("Could not fetch index {}".format(url), e) from e raise FetchIndexError("Could not fetch index {}".format(url), e) from e
try: try:
binary_result = response.read() result = codecs.getreader("utf-8")(response).read()
except ValueError as e: except ValueError as e:
raise FetchIndexError("Remote index {} is invalid".format(url), e) from e raise FetchIndexError("Remote index {} is invalid".format(url), e) from e
# The hash is computed on the raw bytes
computed_hash = compute_hash(binary_result)
# Only then decode as string, possibly decompress
result = transparently_decompress_bytes_to_string(io.BytesIO(binary_result)).read()
headers = response.headers headers = response.headers
etag_header_value = headers.get("Etag", None) or headers.get("etag", None) etag_header_value = headers.get("Etag", None) or headers.get("etag", None)
return FetchIndexResult( return FetchIndexResult(
etag=web_util.parse_etag(etag_header_value), etag=web_util.parse_etag(etag_header_value),
hash=computed_hash, hash=compute_hash(result),
data=result, data=result,
fresh=False, fresh=False,
) )

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -94,22 +94,15 @@ class Bootstrapper:
def __init__(self, conf): def __init__(self, conf):
self.conf = conf self.conf = conf
self.name = conf["name"] self.name = conf["name"]
self.url = conf["info"]["url"]
self.metadata_dir = spack.util.path.canonicalize_path(conf["metadata"]) self.metadata_dir = spack.util.path.canonicalize_path(conf["metadata"])
@property # Promote (relative) paths to file urls
def mirror_url(self): url = conf["info"]["url"]
"""Mirror url associated with this bootstrapper""" if spack.util.url.is_path_instead_of_url(url):
# Absolute paths if not os.path.isabs(url):
if os.path.isabs(self.url): url = os.path.join(self.metadata_dir, url)
return spack.util.url.format(self.url) url = spack.util.url.path_to_file_url(url)
self.url = url
# Check for :// and assume it's an url if we find it
if "://" in self.url:
return self.url
# Otherwise, it's a relative path
return spack.util.url.format(os.path.join(self.metadata_dir, self.url))
@property @property
def mirror_scope(self): def mirror_scope(self):
@ -117,7 +110,7 @@ def mirror_scope(self):
this bootstrapper. this bootstrapper.
""" """
return spack.config.InternalConfigScope( return spack.config.InternalConfigScope(
self.config_scope_name, {"mirrors:": {self.name: self.mirror_url}} self.config_scope_name, {"mirrors:": {self.name: self.url}}
) )
def try_import(self, module: str, abstract_spec_str: str) -> bool: def try_import(self, module: str, abstract_spec_str: str) -> bool:

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -171,7 +171,7 @@ def mypy_root_spec():
def black_root_spec(): def black_root_spec():
"""Return the root spec used to bootstrap black""" """Return the root spec used to bootstrap black"""
return _root_spec("py-black") return _root_spec("py-black@:22.12.0")
def flake8_root_spec(): def flake8_root_spec():

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -584,14 +584,19 @@ def set_module_variables_for_package(pkg):
m.make = MakeExecutable("make", jobs) m.make = MakeExecutable("make", jobs)
m.gmake = MakeExecutable("gmake", jobs) m.gmake = MakeExecutable("gmake", jobs)
m.ninja = MakeExecutable("ninja", jobs, supports_jobserver=False) m.ninja = MakeExecutable("ninja", jobs, supports_jobserver=False)
# TODO: johnwparent: add package or builder support to define these build tools
# for now there is no entrypoint for builders to define these on their
# own
if sys.platform == "win32":
m.nmake = Executable("nmake")
m.msbuild = Executable("msbuild")
# analog to configure for win32
m.cscript = Executable("cscript")
# Find the configure script in the archive path # Find the configure script in the archive path
# Don't use which for this; we want to find it in the current dir. # Don't use which for this; we want to find it in the current dir.
m.configure = Executable("./configure") m.configure = Executable("./configure")
if sys.platform == "win32":
m.nmake = Executable("nmake")
m.msbuild = Executable("msbuild")
# Standard CMake arguments # Standard CMake arguments
m.std_cmake_args = spack.build_systems.cmake.CMakeBuilder.std_args(pkg) m.std_cmake_args = spack.build_systems.cmake.CMakeBuilder.std_args(pkg)
m.std_meson_args = spack.build_systems.meson.MesonBuilder.std_args(pkg) m.std_meson_args = spack.build_systems.meson.MesonBuilder.std_args(pkg)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -427,15 +427,15 @@ def _do_patch_libtool(self):
x.filter(regex="-nostdlib", repl="", string=True) x.filter(regex="-nostdlib", repl="", string=True)
rehead = r"/\S*/" rehead = r"/\S*/"
for o in [ for o in [
"fjhpctag.o", r"fjhpctag\.o",
"fjcrt0.o", r"fjcrt0\.o",
"fjlang08.o", r"fjlang08\.o",
"fjomp.o", r"fjomp\.o",
"crti.o", r"crti\.o",
"crtbeginS.o", r"crtbeginS\.o",
"crtendS.o", r"crtendS\.o",
]: ]:
x.filter(regex=(rehead + o), repl="", string=True) x.filter(regex=(rehead + o), repl="")
elif self.pkg.compiler.name == "dpcpp": elif self.pkg.compiler.name == "dpcpp":
# Hack to filter out spurious predep_objects when building with Intel dpcpp # Hack to filter out spurious predep_objects when building with Intel dpcpp
# (see https://github.com/spack/spack/issues/32863): # (see https://github.com/spack/spack/issues/32863):

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)

View File

@ -1,4 +1,4 @@
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -137,10 +137,11 @@ def cuda_flags(arch_list):
conflicts("%gcc@11:", when="+cuda ^cuda@:11.4.0") conflicts("%gcc@11:", when="+cuda ^cuda@:11.4.0")
conflicts("%gcc@11.2:", when="+cuda ^cuda@:11.5") conflicts("%gcc@11.2:", when="+cuda ^cuda@:11.5")
conflicts("%gcc@12:", when="+cuda ^cuda@:11.8") conflicts("%gcc@12:", when="+cuda ^cuda@:11.8")
conflicts("%gcc@13:", when="+cuda ^cuda@:12.0")
conflicts("%clang@12:", when="+cuda ^cuda@:11.4.0") conflicts("%clang@12:", when="+cuda ^cuda@:11.4.0")
conflicts("%clang@13:", when="+cuda ^cuda@:11.5") conflicts("%clang@13:", when="+cuda ^cuda@:11.5")
conflicts("%clang@14:", when="+cuda ^cuda@:11.7") conflicts("%clang@14:", when="+cuda ^cuda@:11.7")
conflicts("%clang@15:", when="+cuda ^cuda@:11.8") conflicts("%clang@15:", when="+cuda ^cuda@:12.0")
# https://gist.github.com/ax3l/9489132#gistcomment-3860114 # https://gist.github.com/ax3l/9489132#gistcomment-3860114
conflicts("%gcc@10", when="+cuda ^cuda@:11.4.0") conflicts("%gcc@10", when="+cuda ^cuda@:11.4.0")

Some files were not shown because too many files have changed in this diff Show More