Merge branch 'develop' into bugfix/compiler-flag-propagation

This commit is contained in:
Richarda Butler 2023-09-05 09:20:32 -07:00 committed by GitHub
commit d882116f75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 744 additions and 128 deletions

View File

@ -22,7 +22,7 @@ jobs:
matrix:
operating_system: ["ubuntu-latest", "macos-latest"]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # @v2
with:
python-version: ${{inputs.python_version}}

View File

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

View File

@ -56,7 +56,7 @@ jobs:
if: github.repository == 'spack/spack'
steps:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
- name: Set Container Tag Normal (Nightly)
run: |

View File

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

View File

@ -14,7 +14,7 @@ jobs:
build-paraview-deps:
runs-on: windows-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1

View File

@ -47,7 +47,7 @@ jobs:
on_develop: false
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # @v2
@ -94,7 +94,7 @@ jobs:
shell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # @v2
@ -133,7 +133,7 @@ jobs:
dnf install -y \
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
make patch tcl unzip which xz
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
- name: Setup repo and non-root user
run: |
git --version
@ -152,7 +152,7 @@ jobs:
clingo-cffi:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # @v2
@ -187,7 +187,7 @@ jobs:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # @v2

View File

@ -18,7 +18,7 @@ jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # @v2
with:
python-version: '3.11'
@ -35,7 +35,7 @@ jobs:
style:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # @v2
@ -68,7 +68,7 @@ jobs:
dnf install -y \
bzip2 curl file gcc-c++ gcc gcc-gfortran git gnupg2 gzip \
make patch tcl unzip which xz
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # @v2
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # @v2
- name: Setup repo and non-root user
run: |
git --version

View File

@ -15,7 +15,7 @@ jobs:
unit-tests:
runs-on: windows-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1
@ -39,7 +39,7 @@ jobs:
unit-tests-cmd:
runs-on: windows-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1
@ -63,7 +63,7 @@ jobs:
build-abseil:
runs-on: windows-latest
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac
with:
fetch-depth: 0
- uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1

View File

@ -39,6 +39,20 @@ function Read-SpackArgs {
return $SpackCMD_params, $SpackSubCommand, $SpackSubCommandArgs
}
function Set-SpackEnv {
# This method is responsible
# for processing the return from $(spack <command>)
# which are returned as System.Object[]'s containing
# a list of env commands
# Invoke-Expression can only handle one command at a time
# so we iterate over the list to invoke the env modification
# expressions one at a time
foreach($envop in $args[0]){
Invoke-Expression $envop
}
}
function Invoke-SpackCD {
if (Compare-CommonArgs $SpackSubCommandArgs) {
python $Env:SPACK_ROOT/bin/spack cd -h
@ -79,7 +93,7 @@ function Invoke-SpackEnv {
}
else {
$SpackEnv = $(python $Env:SPACK_ROOT/bin/spack $SpackCMD_params env activate "--pwsh" $SubCommandSubCommandArgs)
$ExecutionContext.InvokeCommand($SpackEnv)
Set-SpackEnv $SpackEnv
}
}
"deactivate" {
@ -90,8 +104,8 @@ function Invoke-SpackEnv {
python $Env:SPACK_ROOT/bin/spack env deactivate -h
}
else {
$SpackEnv = $(python $Env:SPACK_ROOT/bin/spack $SpackCMD_params env deactivate --pwsh)
$ExecutionContext.InvokeCommand($SpackEnv)
$SpackEnv = $(python $Env:SPACK_ROOT/bin/spack $SpackCMD_params env deactivate "--pwsh")
Set-SpackEnv $SpackEnv
}
}
default {python $Env:SPACK_ROOT/bin/spack $SpackCMD_params $SpackSubCommand $SpackSubCommandArgs}
@ -107,8 +121,9 @@ function Invoke-SpackLoad {
python $Env:SPACK_ROOT/bin/spack $SpackCMD_params $SpackSubCommand $SpackSubCommandArgs
}
else {
# python $Env:SPACK_ROOT/bin/spack $SpackCMD_params $SpackSubCommand "--pwsh" $SpackSubCommandArgs
$SpackEnv = $(python $Env:SPACK_ROOT/bin/spack $SpackCMD_params $SpackSubCommand "--pwsh" $SpackSubCommandArgs)
$ExecutionContext.InvokeCommand($SpackEnv)
Set-SpackEnv $SpackEnv
}
}

View File

@ -6,7 +6,7 @@ python-levenshtein==0.21.1
docutils==0.18.1
pygments==2.16.1
urllib3==2.0.4
pytest==7.4.0
pytest==7.4.1
isort==5.12.0
black==23.7.0
flake8==6.1.0

View File

@ -239,6 +239,13 @@ def env_deactivate_setup_parser(subparser):
const="bat",
help="print bat commands to activate the environment",
)
shells.add_argument(
"--pwsh",
action="store_const",
dest="shell",
const="pwsh",
help="print pwsh commands to activate the environment",
)
def env_deactivate(args):

View File

@ -52,6 +52,13 @@ def setup_parser(subparser):
const="bat",
help="print bat commands to load the package",
)
shells.add_argument(
"--pwsh",
action="store_const",
dest="shell",
const="pwsh",
help="print pwsh commands to load the package",
)
subparser.add_argument(
"--first",

View File

@ -51,6 +51,13 @@ def setup_parser(subparser):
const="bat",
help="print bat commands to load the package",
)
shells.add_argument(
"--pwsh",
action="store_const",
dest="shell",
const="pwsh",
help="print pwsh commands to load the package",
)
subparser.add_argument(
"-a", "--all", action="store_true", help="unload all loaded Spack packages"

View File

@ -99,6 +99,28 @@ def cxx17_flag(self):
else:
return "-std=c++17"
@property
def cxx20_flag(self):
if self.real_version < Version("8.0"):
raise spack.compiler.UnsupportedCompilerFlag(
self, "the C++20 standard", "cxx20_flag", "< 8.0"
)
elif self.real_version < Version("11.0"):
return "-std=c++2a"
else:
return "-std=c++20"
@property
def cxx23_flag(self):
if self.real_version < Version("11.0"):
raise spack.compiler.UnsupportedCompilerFlag(
self, "the C++23 standard", "cxx23_flag", "< 11.0"
)
elif self.real_version < Version("14.0"):
return "-std=c++2b"
else:
return "-std=c++23"
@property
def c99_flag(self):
if self.real_version < Version("4.5"):

View File

@ -863,6 +863,7 @@ def add(fullpath, scope=None):
has_existing_value = True
path = ""
override = False
value = syaml.load_config(components[-1])
for idx, name in enumerate(components[:-1]):
# First handle double colons in constructing path
colon = "::" if override else ":" if path else ""
@ -883,14 +884,14 @@ def add(fullpath, scope=None):
existing = get_valid_type(path)
# construct value from this point down
value = syaml.load_config(components[-1])
for component in reversed(components[idx + 1 : -1]):
value = {component: value}
break
if override:
path += "::"
if has_existing_value:
path, _, value = fullpath.rpartition(":")
value = syaml.load_config(value)
existing = get(path, scope=scope)
# append values to lists
@ -1231,11 +1232,17 @@ def they_are(t):
return copy.copy(source)
#
# Process a path argument to config.set() that may contain overrides ('::' or
# trailing ':')
#
def process_config_path(path):
"""Process a path argument to config.set() that may contain overrides ('::' or
trailing ':')
Note: quoted value path components will be processed as a single value (escaping colons)
quoted path components outside of the value will be considered ill formed and will
raise.
e.g. `this:is:a:path:'value:with:colon'` will yield:
[this, is, a, path, value:with:colon]
"""
result = []
if path.startswith(":"):
raise syaml.SpackYAMLError("Illegal leading `:' in path `{0}'".format(path), "")
@ -1262,6 +1269,16 @@ def process_config_path(path):
front = syaml.syaml_str(front)
front.append = True
quote = "['\"]"
not_quote = "[^'\"]"
if re.match(f"^{quote}", path):
m = re.match(rf"^{quote}({not_quote}+){quote}$", path)
if not m:
raise ValueError("Quotes indicate value, but there are additional path entries")
result.append(m.group(1))
break
result.append(front)
return result

View File

@ -13,13 +13,13 @@
The module also contains other functions that might be useful across different
detection mechanisms.
"""
import collections
import glob
import itertools
import os
import os.path
import re
import sys
from typing import Dict, List, NamedTuple, Optional, Set, Tuple, Union
import llnl.util.tty
@ -29,12 +29,18 @@
import spack.util.spack_yaml
import spack.util.windows_registry
#: Information on a package that has been detected
DetectedPackage = collections.namedtuple("DetectedPackage", ["spec", "prefix"])
class DetectedPackage(NamedTuple):
"""Information on a package that has been detected."""
#: Spec that was detected
spec: spack.spec.Spec
#: Prefix of the spec
prefix: str
def _externals_in_packages_yaml():
"""Return all the specs mentioned as externals in packages.yaml"""
def _externals_in_packages_yaml() -> Set[spack.spec.Spec]:
"""Returns all the specs mentioned as externals in packages.yaml"""
packages_yaml = spack.config.get("packages")
already_defined_specs = set()
for pkg_name, package_configuration in packages_yaml.items():
@ -43,7 +49,12 @@ def _externals_in_packages_yaml():
return already_defined_specs
def _pkg_config_dict(external_pkg_entries):
ExternalEntryType = Union[str, Dict[str, str]]
def _pkg_config_dict(
external_pkg_entries: List[DetectedPackage],
) -> Dict[str, Union[bool, List[Dict[str, ExternalEntryType]]]]:
"""Generate a package specific config dict according to the packages.yaml schema.
This does not generate the entire packages.yaml. For example, given some
@ -65,7 +76,10 @@ def _pkg_config_dict(external_pkg_entries):
if not _spec_is_valid(e.spec):
continue
external_items = [("spec", str(e.spec)), ("prefix", e.prefix)]
external_items: List[Tuple[str, ExternalEntryType]] = [
("spec", str(e.spec)),
("prefix", e.prefix),
]
if e.spec.external_modules:
external_items.append(("modules", e.spec.external_modules))
@ -83,15 +97,14 @@ def _pkg_config_dict(external_pkg_entries):
return pkg_dict
def _spec_is_valid(spec):
def _spec_is_valid(spec: spack.spec.Spec) -> bool:
try:
str(spec)
except spack.error.SpackError:
# It is assumed here that we can at least extract the package name from
# the spec so we can look up the implementation of
# determine_spec_details
msg = "Constructed spec for {0} does not have a string representation"
llnl.util.tty.warn(msg.format(spec.name))
# It is assumed here that we can at least extract the package name from the spec so we
# can look up the implementation of determine_spec_details
msg = f"Constructed spec for {spec.name} does not have a string representation"
llnl.util.tty.warn(msg)
return False
try:
@ -106,7 +119,7 @@ def _spec_is_valid(spec):
return True
def path_to_dict(search_paths):
def path_to_dict(search_paths: List[str]):
"""Return dictionary[fullpath]: basename from list of paths"""
path_to_lib = {}
# Reverse order of search directories so that a lib in the first
@ -124,7 +137,7 @@ def path_to_dict(search_paths):
return path_to_lib
def is_executable(file_path):
def is_executable(file_path: str) -> bool:
"""Return True if the path passed as argument is that of an executable"""
return os.path.isfile(file_path) and os.access(file_path, os.X_OK)
@ -146,7 +159,7 @@ def _convert_to_iterable(single_val_or_multiple):
return [x]
def executable_prefix(executable_dir):
def executable_prefix(executable_dir: str) -> str:
"""Given a directory where an executable is found, guess the prefix
(i.e. the "root" directory of that installation) and return it.
@ -167,12 +180,12 @@ def executable_prefix(executable_dir):
return os.sep.join(components[:idx])
def library_prefix(library_dir):
"""Given a directory where an library is found, guess the prefix
def library_prefix(library_dir: str) -> str:
"""Given a directory where a library is found, guess the prefix
(i.e. the "root" directory of that installation) and return it.
Args:
library_dir: directory where an library is found
library_dir: directory where a library is found
"""
# Given a prefix where an library is found, assuming that prefix
# contains /lib/ or /lib64/, strip off the 'lib' or 'lib64' directory
@ -195,13 +208,17 @@ def library_prefix(library_dir):
return library_dir
def update_configuration(detected_packages, scope=None, buildable=True):
def update_configuration(
detected_packages: Dict[str, List[DetectedPackage]],
scope: Optional[str] = None,
buildable: bool = True,
) -> List[spack.spec.Spec]:
"""Add the packages passed as arguments to packages.yaml
Args:
detected_packages (list): list of DetectedPackage objects to be added
scope (str): configuration scope where to add the detected packages
buildable (bool): whether the detected packages are buildable or not
detected_packages: list of DetectedPackage objects to be added
scope: configuration scope where to add the detected packages
buildable: whether the detected packages are buildable or not
"""
predefined_external_specs = _externals_in_packages_yaml()
pkg_to_cfg, all_new_specs = {}, []
@ -209,7 +226,10 @@ def update_configuration(detected_packages, scope=None, buildable=True):
new_entries = [e for e in entries if (e.spec not in predefined_external_specs)]
pkg_config = _pkg_config_dict(new_entries)
all_new_specs.extend([spack.spec.Spec(x["spec"]) for x in pkg_config.get("externals", [])])
external_entries = pkg_config.get("externals", [])
assert not isinstance(external_entries, bool), "unexpected value for external entry"
all_new_specs.extend([spack.spec.Spec(x["spec"]) for x in external_entries])
if buildable is False:
pkg_config["buildable"] = False
pkg_to_cfg[package_name] = pkg_config
@ -222,16 +242,19 @@ def update_configuration(detected_packages, scope=None, buildable=True):
return all_new_specs
def _windows_drive():
"""Return Windows drive string extracted from PROGRAMFILES
env var, which is garunteed to be defined for all logins"""
drive = re.match(r"([a-zA-Z]:)", os.environ["PROGRAMFILES"]).group(1)
return drive
def _windows_drive() -> str:
"""Return Windows drive string extracted from the PROGRAMFILES environment variable,
which is guaranteed to be defined for all logins.
"""
match = re.match(r"([a-zA-Z]:)", os.environ["PROGRAMFILES"])
if match is None:
raise RuntimeError("cannot read the PROGRAMFILES environment variable")
return match.group(1)
class WindowsCompilerExternalPaths:
@staticmethod
def find_windows_compiler_root_paths():
def find_windows_compiler_root_paths() -> List[str]:
"""Helper for Windows compiler installation root discovery
At the moment simply returns location of VS install paths from VSWhere
@ -239,7 +262,7 @@ def find_windows_compiler_root_paths():
return list(winOs.WindowsOs.vs_install_paths)
@staticmethod
def find_windows_compiler_cmake_paths():
def find_windows_compiler_cmake_paths() -> List[str]:
"""Semi hard-coded search path for cmake bundled with MSVC"""
return [
os.path.join(
@ -249,7 +272,7 @@ def find_windows_compiler_cmake_paths():
]
@staticmethod
def find_windows_compiler_ninja_paths():
def find_windows_compiler_ninja_paths() -> List[str]:
"""Semi hard-coded search heuristic for locating ninja bundled with MSVC"""
return [
os.path.join(path, "Common7", "IDE", "CommonExtensions", "Microsoft", "CMake", "Ninja")
@ -257,7 +280,7 @@ def find_windows_compiler_ninja_paths():
]
@staticmethod
def find_windows_compiler_bundled_packages():
def find_windows_compiler_bundled_packages() -> List[str]:
"""Return all MSVC compiler bundled packages"""
return (
WindowsCompilerExternalPaths.find_windows_compiler_cmake_paths()
@ -266,14 +289,15 @@ def find_windows_compiler_bundled_packages():
class WindowsKitExternalPaths:
plat_major_ver = None
if sys.platform == "win32":
plat_major_ver = str(winOs.windows_version()[0])
@staticmethod
def find_windows_kit_roots():
def find_windows_kit_roots() -> Optional[str]:
"""Return Windows kit root, typically %programfiles%\\Windows Kits\\10|11\\"""
if sys.platform != "win32":
return []
return None
program_files = os.environ["PROGRAMFILES(x86)"]
kit_base = os.path.join(
program_files, "Windows Kits", WindowsKitExternalPaths.plat_major_ver
@ -281,21 +305,23 @@ def find_windows_kit_roots():
return kit_base
@staticmethod
def find_windows_kit_bin_paths(kit_base=None):
def find_windows_kit_bin_paths(kit_base: Optional[str] = None) -> List[str]:
"""Returns Windows kit bin directory per version"""
kit_base = WindowsKitExternalPaths.find_windows_kit_roots() if not kit_base else kit_base
assert kit_base is not None, "unexpected value for kit_base"
kit_bin = os.path.join(kit_base, "bin")
return glob.glob(os.path.join(kit_bin, "[0-9]*", "*\\"))
@staticmethod
def find_windows_kit_lib_paths(kit_base=None):
def find_windows_kit_lib_paths(kit_base: Optional[str] = None) -> List[str]:
"""Returns Windows kit lib directory per version"""
kit_base = WindowsKitExternalPaths.find_windows_kit_roots() if not kit_base else kit_base
assert kit_base is not None, "unexpected value for kit_base"
kit_lib = os.path.join(kit_base, "Lib")
return glob.glob(os.path.join(kit_lib, "[0-9]*", "*", "*\\"))
@staticmethod
def find_windows_driver_development_kit_paths():
def find_windows_driver_development_kit_paths() -> List[str]:
"""Provides a list of all installation paths
for the WDK by version and architecture
"""
@ -303,7 +329,7 @@ def find_windows_driver_development_kit_paths():
return WindowsKitExternalPaths.find_windows_kit_lib_paths(wdk_content_root)
@staticmethod
def find_windows_kit_reg_installed_roots_paths():
def find_windows_kit_reg_installed_roots_paths() -> List[str]:
reg = spack.util.windows_registry.WindowsRegistryView(
"SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots",
root_key=spack.util.windows_registry.HKEY.HKEY_LOCAL_MACHINE,
@ -316,7 +342,7 @@ def find_windows_kit_reg_installed_roots_paths():
)
@staticmethod
def find_windows_kit_reg_sdk_paths():
def find_windows_kit_reg_sdk_paths() -> List[str]:
reg = spack.util.windows_registry.WindowsRegistryView(
"SOFTWARE\\WOW6432Node\\Microsoft\\Microsoft SDKs\\Windows\\v%s.0"
% WindowsKitExternalPaths.plat_major_ver,
@ -330,7 +356,7 @@ def find_windows_kit_reg_sdk_paths():
)
def find_win32_additional_install_paths():
def find_win32_additional_install_paths() -> List[str]:
"""Not all programs on Windows live on the PATH
Return a list of other potential install locations.
"""
@ -357,13 +383,12 @@ def find_win32_additional_install_paths():
return windows_search_ext
def compute_windows_program_path_for_package(pkg):
"""Given a package, attempt to compute its Windows
program files location, return list of best guesses
def compute_windows_program_path_for_package(pkg: spack.package_base.PackageBase) -> List[str]:
"""Given a package, attempts to compute its Windows program files location,
and returns the list of best guesses.
Args:
pkg (spack.package_base.PackageBase): package for which
Program Files location is to be computed
pkg: package for which Program Files location is to be computed
"""
if sys.platform != "win32":
return []
@ -378,7 +403,7 @@ def compute_windows_program_path_for_package(pkg):
]
def compute_windows_user_path_for_package(pkg):
def compute_windows_user_path_for_package(pkg: spack.package_base.PackageBase) -> List[str]:
"""Given a package attempt to compute its user scoped
install location, return list of potential locations based
on common heuristics. For more info on Windows user specific

View File

@ -11,6 +11,7 @@
import re
import sys
import warnings
from typing import Dict, List, Optional, Set
import llnl.util.filesystem
import llnl.util.tty
@ -18,7 +19,7 @@
import spack.util.environment
import spack.util.ld_so_conf
from .common import ( # find_windows_compiler_bundled_packages,
from .common import (
DetectedPackage,
WindowsCompilerExternalPaths,
WindowsKitExternalPaths,
@ -32,7 +33,7 @@
)
def common_windows_package_paths():
def common_windows_package_paths() -> List[str]:
paths = WindowsCompilerExternalPaths.find_windows_compiler_bundled_packages()
paths.extend(find_win32_additional_install_paths())
paths.extend(WindowsKitExternalPaths.find_windows_kit_bin_paths())
@ -41,7 +42,7 @@ def common_windows_package_paths():
return paths
def executables_in_path(path_hints):
def executables_in_path(path_hints: List[str]) -> Dict[str, str]:
"""Get the paths of all executables available from the current PATH.
For convenience, this is constructed as a dictionary where the keys are
@ -52,7 +53,7 @@ def executables_in_path(path_hints):
assumed there are two different instances of the executable.
Args:
path_hints (list): list of paths to be searched. If None the list will be
path_hints: list of paths to be searched. If None the list will be
constructed based on the PATH environment variable.
"""
if sys.platform == "win32":
@ -61,7 +62,9 @@ def executables_in_path(path_hints):
return path_to_dict(search_paths)
def libraries_in_ld_and_system_library_path(path_hints=None):
def libraries_in_ld_and_system_library_path(
path_hints: Optional[List[str]] = None,
) -> Dict[str, str]:
"""Get the paths of all libraries available from LD_LIBRARY_PATH,
LIBRARY_PATH, DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH, and
standard system library paths.
@ -74,7 +77,7 @@ def libraries_in_ld_and_system_library_path(path_hints=None):
assumed there are two different instances of the library.
Args:
path_hints (list): list of paths to be searched. If None the list will be
path_hints: list of paths to be searched. If None the list will be
constructed based on the set of LD_LIBRARY_PATH, LIBRARY_PATH,
DYLD_LIBRARY_PATH, and DYLD_FALLBACK_LIBRARY_PATH environment
variables as well as the standard system library paths.
@ -90,7 +93,7 @@ def libraries_in_ld_and_system_library_path(path_hints=None):
return path_to_dict(search_paths)
def libraries_in_windows_paths(path_hints):
def libraries_in_windows_paths(path_hints: List[str]) -> Dict[str, str]:
path_hints.extend(spack.util.environment.get_path("PATH"))
search_paths = llnl.util.filesystem.search_paths_for_libraries(*path_hints)
# on Windows, some libraries (.dlls) are found in the bin directory or sometimes
@ -106,17 +109,19 @@ def libraries_in_windows_paths(path_hints):
return path_to_dict(search_paths)
def _group_by_prefix(paths):
def _group_by_prefix(paths: Set[str]) -> Dict[str, Set[str]]:
groups = collections.defaultdict(set)
for p in paths:
groups[os.path.dirname(p)].add(p)
return groups.items()
return groups
# TODO consolidate this with by_executable
# Packages should be able to define both .libraries and .executables in the future
# determine_spec_details should get all relevant libraries and executables in one call
def by_library(packages_to_check, path_hints=None):
def by_library(
packages_to_check: List[spack.package_base.PackageBase], path_hints: Optional[List[str]] = None
) -> Dict[str, List[DetectedPackage]]:
# Techniques for finding libraries is determined on a per recipe basis in
# the determine_version class method. Some packages will extract the
# version number from a shared libraries filename.
@ -127,8 +132,8 @@ def by_library(packages_to_check, path_hints=None):
DYLD_FALLBACK_LIBRARY_PATH, and standard system library paths.
Args:
packages_to_check (list): list of packages to be detected
path_hints (list): list of paths to be searched. If None the list will be
packages_to_check: list of packages to be detected
path_hints: list of paths to be searched. If None the list will be
constructed based on the LD_LIBRARY_PATH, LIBRARY_PATH,
DYLD_LIBRARY_PATH, DYLD_FALLBACK_LIBRARY_PATH environment variables
and standard system library paths.
@ -160,7 +165,7 @@ def by_library(packages_to_check, path_hints=None):
pkg_to_found_libs[pkg].add(path)
pkg_to_entries = collections.defaultdict(list)
resolved_specs = {} # spec -> lib found for the spec
resolved_specs: Dict[spack.spec.Spec, str] = {} # spec -> lib found for the spec
for pkg, libs in pkg_to_found_libs.items():
if not hasattr(pkg, "determine_spec_details"):
@ -171,7 +176,7 @@ def by_library(packages_to_check, path_hints=None):
)
continue
for prefix, libs_in_prefix in sorted(_group_by_prefix(libs)):
for prefix, libs_in_prefix in sorted(_group_by_prefix(libs).items()):
try:
specs = _convert_to_iterable(pkg.determine_spec_details(prefix, libs_in_prefix))
except Exception as e:
@ -225,19 +230,21 @@ def by_library(packages_to_check, path_hints=None):
return pkg_to_entries
def by_executable(packages_to_check, path_hints=None):
def by_executable(
packages_to_check: List[spack.package_base.PackageBase], path_hints: Optional[List[str]] = None
) -> Dict[str, List[DetectedPackage]]:
"""Return the list of packages that have been detected on the system,
searching by path.
Args:
packages_to_check (list): list of package classes to be detected
path_hints (list): list of paths to be searched. If None the list will be
packages_to_check: list of package classes to be detected
path_hints: list of paths to be searched. If None the list will be
constructed based on the PATH environment variable.
"""
path_hints = spack.util.environment.get_path("PATH") if path_hints is None else path_hints
exe_pattern_to_pkgs = collections.defaultdict(list)
for pkg in packages_to_check:
if hasattr(pkg, "executables"):
if hasattr(pkg, "executables") and hasattr(pkg, "platform_executables"):
for exe in pkg.platform_executables():
exe_pattern_to_pkgs[exe].append(pkg)
# Add Windows specific, package related paths to the search paths
@ -254,7 +261,7 @@ def by_executable(packages_to_check, path_hints=None):
pkg_to_found_exes[pkg].add(path)
pkg_to_entries = collections.defaultdict(list)
resolved_specs = {} # spec -> exe found for the spec
resolved_specs: Dict[spack.spec.Spec, str] = {} # spec -> exe found for the spec
for pkg, exes in pkg_to_found_exes.items():
if not hasattr(pkg, "determine_spec_details"):
@ -265,7 +272,7 @@ def by_executable(packages_to_check, path_hints=None):
)
continue
for prefix, exes_in_prefix in sorted(_group_by_prefix(exes)):
for prefix, exes_in_prefix in sorted(_group_by_prefix(exes).items()):
# TODO: multiple instances of a package can live in the same
# prefix, and a package implementation can return multiple specs
# for one prefix, but without additional details (e.g. about the

View File

@ -43,7 +43,7 @@ def activate_header(env, shell, prompt=None):
# TODO: despacktivate
# TODO: prompt
elif shell == "pwsh":
cmds += "$Env:SPACK_ENV=%s\n" % env.path
cmds += "$Env:SPACK_ENV='%s'\n" % env.path
else:
if "color" in os.getenv("TERM", "") and prompt:
prompt = colorize("@G{%s}" % prompt, color=True, enclose=True)
@ -82,7 +82,7 @@ def deactivate_header(shell):
# TODO: despacktivate
# TODO: prompt
elif shell == "pwsh":
cmds += "Remove-Item Env:SPACK_ENV"
cmds += "Set-Item -Path Env:SPACK_ENV\n"
else:
cmds += "if [ ! -z ${SPACK_ENV+x} ]; then\n"
cmds += "unset SPACK_ENV; export SPACK_ENV;\n"

View File

@ -277,6 +277,12 @@ def test_add_config_path(mutable_config):
compilers = spack.config.get("packages")["all"]["compiler"]
assert "gcc" in compilers
# Try with an escaped colon
path = 'config:install_tree:root:"C:/path/to/config.yaml"'
spack.config.add(path)
set_value = spack.config.get("config")["install_tree"]["root"]
assert set_value == "C:/path/to/config.yaml"
@pytest.mark.regression("17543,23259")
def test_add_config_path_with_enumerated_type(mutable_config):

View File

@ -172,8 +172,8 @@ def test_escape_double_quotes_in_shell_modifications():
assert r'set "VAR=$PATH;$ANOTHER_PATH"' in cmds
assert r'set "QUOTED_VAR="MY_VAL"' in cmds
cmds = to_validate.shell_modifications(shell="pwsh")
assert r"$Env:VAR=$PATH;$ANOTHER_PATH" in cmds
assert r'$Env:QUOTED_VAR="MY_VAL"' in cmds
assert "$Env:VAR='$PATH;$ANOTHER_PATH'" in cmds
assert "$Env:QUOTED_VAR='\"MY_VAL\"'" in cmds
else:
cmds = to_validate.shell_modifications()
assert 'export VAR="$PATH:$ANOTHER_PATH"' in cmds

View File

@ -432,6 +432,47 @@ def get_rpaths(path):
return rpath.split(":")
def delete_rpath(path):
"""Modifies a binary to remove the rpath. It zeros out the rpath string
and also drops the DT_R(UN)PATH entry from the dynamic section, so it doesn't
show up in 'readelf -d file', nor in 'strings file'."""
with open(path, "rb+") as f:
elf = parse_elf(f, interpreter=False, dynamic_section=True)
if not elf.has_rpath:
return
# Zero out the rpath *string* in the binary
new_rpath_string = b"\x00" * len(elf.dt_rpath_str)
rpath_offset = elf.pt_dynamic_strtab_offset + elf.rpath_strtab_offset
f.seek(rpath_offset)
f.write(new_rpath_string)
# Next update the dynamic array
f.seek(elf.pt_dynamic_p_offset)
dynamic_array_fmt = elf.byte_order + ("qQ" if elf.is_64_bit else "lL")
dynamic_array_size = calcsize(dynamic_array_fmt)
new_offset = elf.pt_dynamic_p_offset # points to the new dynamic array
old_offset = elf.pt_dynamic_p_offset # points to the current dynamic array
for _ in range(elf.pt_dynamic_p_filesz // dynamic_array_size):
data = read_exactly(f, dynamic_array_size, "Malformed dynamic array entry")
tag, _ = unpack(dynamic_array_fmt, data)
# Overwrite any entry that is not DT_RPATH or DT_RUNPATH, including DT_NULL
if tag != ELF_CONSTANTS.DT_RPATH and tag != ELF_CONSTANTS.DT_RUNPATH:
if new_offset != old_offset:
f.seek(new_offset)
f.write(data)
f.seek(old_offset + dynamic_array_size)
new_offset += dynamic_array_size
# End of the dynamic array
if tag == ELF_CONSTANTS.DT_NULL:
break
old_offset += dynamic_array_size
def replace_rpath_in_place_or_raise(path, substitutions):
regex = re.compile(b"|".join(re.escape(p) for p in substitutions.keys()))

View File

@ -47,7 +47,7 @@
"csh": "setenv {0} {1};\n",
"fish": "set -gx {0} {1};\n",
"bat": 'set "{0}={1}"\n',
"pwsh": "$Env:{0}={1}\n",
"pwsh": "$Env:{0}='{1}'\n",
}
@ -56,7 +56,7 @@
"csh": "unsetenv {0};\n",
"fish": "set -e {0};\n",
"bat": 'set "{0}="\n',
"pwsh": "Remove-Item Env:{0}\n",
"pwsh": "Set-Item -Path Env:{0}\n",
}
@ -429,7 +429,7 @@ class RemovePath(NameValueModifier):
def execute(self, env: MutableMapping[str, str]):
tty.debug(f"RemovePath: {self.name}-{str(self.value)}", level=3)
environment_value = env.get(self.name, "")
directories = environment_value.split(self.separator) if environment_value else []
directories = environment_value.split(self.separator)
directories = [
path_to_os_path(os.path.normpath(x)).pop()
for x in directories
@ -724,11 +724,10 @@ def shell_modifications(
cmds += _SHELL_UNSET_STRINGS[shell].format(name)
else:
if sys.platform != "win32":
cmd = _SHELL_SET_STRINGS[shell].format(
name, double_quote_escape(new_env[name])
)
new_env_name = double_quote_escape(new_env[name])
else:
cmd = _SHELL_SET_STRINGS[shell].format(name, new_env[name])
new_env_name = new_env[name]
cmd = _SHELL_SET_STRINGS[shell].format(name, new_env_name)
cmds += cmd
return cmds

View File

@ -138,6 +138,7 @@ default:
KUBERNETES_MEMORY_REQUEST: 16G
# avoid moving targets like branches and tags
SPACK_CONCRETIZER_REQUIRE_CHECKSUM: 1
SPACK_BACKTRACE: 1
interruptible: true
timeout: 60 minutes
retry:

View File

@ -1012,7 +1012,7 @@ _spack_env_activate() {
}
_spack_env_deactivate() {
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat"
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh"
}
_spack_env_create() {
@ -1304,7 +1304,7 @@ _spack_list() {
_spack_load() {
if $list_options
then
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --first --only --list"
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh --first --only --list"
else
_installed_packages
fi
@ -1922,7 +1922,7 @@ _spack_unit_test() {
_spack_unload() {
if $list_options
then
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat -a --all"
SPACK_COMPREPLY="-h --help --sh --csh --fish --bat --pwsh -a --all"
else
_installed_packages
fi

View File

@ -1442,7 +1442,7 @@ complete -c spack -n '__fish_spack_using_command env activate' -s d -l dir -r -f
complete -c spack -n '__fish_spack_using_command env activate' -s d -l dir -r -d 'activate the environment in this directory'
# spack env deactivate
set -g __fish_spack_optspecs_spack_env_deactivate h/help sh csh fish bat
set -g __fish_spack_optspecs_spack_env_deactivate h/help sh csh fish bat pwsh
complete -c spack -n '__fish_spack_using_command env deactivate' -s h -l help -f -a help
complete -c spack -n '__fish_spack_using_command env deactivate' -s h -l help -d 'show this help message and exit'
complete -c spack -n '__fish_spack_using_command env deactivate' -l sh -f -a shell
@ -1453,6 +1453,8 @@ complete -c spack -n '__fish_spack_using_command env deactivate' -l fish -f -a s
complete -c spack -n '__fish_spack_using_command env deactivate' -l fish -d 'print fish commands to activate the environment'
complete -c spack -n '__fish_spack_using_command env deactivate' -l bat -f -a shell
complete -c spack -n '__fish_spack_using_command env deactivate' -l bat -d 'print bat commands to activate the environment'
complete -c spack -n '__fish_spack_using_command env deactivate' -l pwsh -f -a shell
complete -c spack -n '__fish_spack_using_command env deactivate' -l pwsh -d 'print pwsh commands to activate the environment'
# spack env create
set -g __fish_spack_optspecs_spack_env_create h/help d/dir keep-relative without-view with-view=
@ -1972,7 +1974,7 @@ complete -c spack -n '__fish_spack_using_command list' -l update -r -f -a update
complete -c spack -n '__fish_spack_using_command list' -l update -r -d 'write output to the specified file, if any package is newer'
# spack load
set -g __fish_spack_optspecs_spack_load h/help sh csh fish bat first only= list
set -g __fish_spack_optspecs_spack_load h/help sh csh fish bat pwsh first only= list
complete -c spack -n '__fish_spack_using_command_pos_remainder 0 load' -f -a '(__fish_spack_installed_specs)'
complete -c spack -n '__fish_spack_using_command load' -s h -l help -f -a help
complete -c spack -n '__fish_spack_using_command load' -s h -l help -d 'show this help message and exit'
@ -1984,6 +1986,8 @@ complete -c spack -n '__fish_spack_using_command load' -l fish -f -a shell
complete -c spack -n '__fish_spack_using_command load' -l fish -d 'print fish commands to load the package'
complete -c spack -n '__fish_spack_using_command load' -l bat -f -a shell
complete -c spack -n '__fish_spack_using_command load' -l bat -d 'print bat commands to load the package'
complete -c spack -n '__fish_spack_using_command load' -l pwsh -f -a shell
complete -c spack -n '__fish_spack_using_command load' -l pwsh -d 'print pwsh commands to load the package'
complete -c spack -n '__fish_spack_using_command load' -l first -f -a load_first
complete -c spack -n '__fish_spack_using_command load' -l first -d 'load the first match if multiple packages match the spec'
complete -c spack -n '__fish_spack_using_command load' -l only -r -f -a 'package dependencies'
@ -2845,7 +2849,7 @@ complete -c spack -n '__fish_spack_using_command unit-test' -l showlocals -f -a
complete -c spack -n '__fish_spack_using_command unit-test' -l showlocals -d 'show local variable values in tracebacks'
# spack unload
set -g __fish_spack_optspecs_spack_unload h/help sh csh fish bat a/all
set -g __fish_spack_optspecs_spack_unload h/help sh csh fish bat pwsh a/all
complete -c spack -n '__fish_spack_using_command_pos_remainder 0 unload' -f -a '(__fish_spack_installed_specs)'
complete -c spack -n '__fish_spack_using_command unload' -s h -l help -f -a help
complete -c spack -n '__fish_spack_using_command unload' -s h -l help -d 'show this help message and exit'
@ -2857,6 +2861,8 @@ complete -c spack -n '__fish_spack_using_command unload' -l fish -f -a shell
complete -c spack -n '__fish_spack_using_command unload' -l fish -d 'print fish commands to load the package'
complete -c spack -n '__fish_spack_using_command unload' -l bat -f -a shell
complete -c spack -n '__fish_spack_using_command unload' -l bat -d 'print bat commands to load the package'
complete -c spack -n '__fish_spack_using_command unload' -l pwsh -f -a shell
complete -c spack -n '__fish_spack_using_command unload' -l pwsh -d 'print pwsh commands to load the package'
complete -c spack -n '__fish_spack_using_command unload' -s a -l all -f -a all
complete -c spack -n '__fish_spack_using_command unload' -s a -l all -d 'unload all loaded Spack packages'

View File

@ -11,6 +11,7 @@ class BioconductorDupradar(RPackage):
homepage = "https://bioconductor.org/packages/3.16/bioc/html/dupRadar.html"
url = "https://bioconductor.org/packages/release/bioc/src/contrib/dupRadar_1.30.0.tar.gz"
maintainers("pabloaledo")
bioc = "dupradar"

View File

@ -19,6 +19,7 @@ class BioconductorEbseq(RPackage):
homepage = "https://www.biostat.wisc.edu/~kendzior/EBSEQ/"
url = "https://bioconductor.org/packages/release/bioc/src/contrib/EBSeq_1.40.0.tar.gz"
maintainers("pabloaledo")
bioc = "ebseq"

View File

@ -178,6 +178,7 @@ def libs(self):
conditional("17", when="@1.63.0:"),
# C++20/2a is not support by Boost < 1.73.0
conditional("2a", when="@1.73.0:"),
conditional("20", when="@1.77.0:"),
),
multi=False,
description="Use the specified C++ standard when building.",

View File

@ -53,13 +53,16 @@ class Clhep(CMakePackage):
variant(
"cxxstd",
default="11",
values=("11", "14", "17"),
values=(
"11",
"14",
conditional("17", when="@2.3.4.3:"),
conditional("20", when="@2.4.6.4:"),
),
multi=False,
description="Use the specified C++ standard when building.",
)
conflicts("cxxstd=17", when="@:2.3.4.2")
depends_on("cmake@2.8.12.2:", when="@2.2.0.4:2.3.0.0", type="build")
depends_on("cmake@3.2:", when="@2.3.0.1:", type="build")

View File

@ -125,6 +125,7 @@ def cmake_args(self):
return args
def setup_run_environment(self, env):
env.prepend_path("LD_LIBRARY_PATH", self.spec["edm4hep"].libs.directories[0])
env.prepend_path("PYTHONPATH", self.prefix.python)
def url_for_version(self, version):

View File

@ -13,6 +13,7 @@ class Fq(Package):
homepage = "https://github.com/stjude-rust-labs/fq"
url = "https://github.com/stjude-rust-labs/fq/archive/refs/tags/v0.10.0.tar.gz"
maintainers("pabloaledo")
version("0.10.0", sha256="34007ab71a873e1b066d910e90c5bdac3dcc4299ae6c9891ac6d8233cffeabb8")

View File

@ -0,0 +1,21 @@
From 32cf40699346d37fabfa887bbd95e95004799ae1 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Mon, 6 Sep 2010 14:55:59 +0200
Subject: [PATCH] Don't mix pattern rules with normal rules
diff --git a/manual/Makefile b/manual/Makefile
index c5866eb9def..b1f5fa73e5e 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -232,7 +232,10 @@ ifdef objpfx
.PHONY: stubs
stubs: $(objpfx)stubs
endif
-$(objpfx)stubs ../po/manual.pot $(objpfx)stamp%:
+$(objpfx)stubs ../po/manual.pot:
+ $(make-target-directory)
+ touch $@
+$(objpfx)stamp%:
$(make-target-directory)
touch $@

View File

@ -0,0 +1,13 @@
diff --git a/malloc/obstack.c b/malloc/obstack.c
index 25a90514f78..c3c7db4a96b 100644
--- a/malloc/obstack.c
+++ b/malloc/obstack.c
@@ -115,7 +115,7 @@ int obstack_exit_failure = EXIT_FAILURE;
/* A looong time ago (before 1994, anyway; we're not sure) this global variable
was used by non-GNU-C macros to avoid multiple evaluation. The GNU C
library still exports it because somebody might use it. */
-struct obstack *_obstack_compat;
+struct obstack *_obstack_compat = 0;
compat_symbol (libc, _obstack_compat, _obstack, GLIBC_2_0);
# endif
# endif

View File

@ -0,0 +1,123 @@
commit 4a531bb0b3b582cb693de9f76d2d97d970f9a5d5
Author: H.J. Lu <hongjiu.lu@intel.com>
Date: Fri Dec 24 20:14:37 2010 -0500
Remove `.ctors' and `.dtors' output sections
diff --git a/config.h.in b/config.h.in
index 18bf01a38c..9e797eb5b7 100644
--- a/config.h.in
+++ b/config.h.in
@@ -201,6 +201,9 @@
/* Define if multi-arch DSOs should be generated. */
#undef USE_MULTIARCH
+/* Define if `.ctors' and `.dtors' sections shouldn't be used. */
+#define NO_CTORS_DTORS_SECTIONS
+
/*
^L */
diff --git a/elf/sofini.c b/elf/sofini.c
index 5e06f0ca92..13e74b7903 100644
--- a/elf/sofini.c
+++ b/elf/sofini.c
@@ -1,12 +1,14 @@
/* Finalizer module for ELF shared C library. This provides terminating
null pointer words in the `.ctors' and `.dtors' sections. */
+#ifndef NO_CTORS_DTORS_SECTIONS
static void (*const __CTOR_END__[1]) (void)
__attribute__ ((used, section (".ctors")))
= { 0 };
static void (*const __DTOR_END__[1]) (void)
__attribute__ ((used, section (".dtors")))
= { 0 };
+#endif
/* Terminate the frame unwind info section with a 4byte 0 as a sentinel;
this would be the 'length' field in a real FDE. */
diff --git a/elf/soinit.c b/elf/soinit.c
index 6fecbb5674..1db676af01 100644
--- a/elf/soinit.c
+++ b/elf/soinit.c
@@ -3,6 +3,7 @@
the `.ctors' and `.dtors' sections so the lists are terminated, and
calling those lists of functions. */
+#ifndef NO_CTORS_DTORS_SECTIONS
#include <libc-internal.h>
#include <stdlib.h>
@@ -40,3 +41,4 @@ __libc_fini (void)
void (*_fini_ptr) (void) __attribute__ ((section (".fini_array")))
= &__libc_fini;
+#endif
diff --git a/sysdeps/i386/init-first.c b/sysdeps/i386/init-first.c
index c6355a8b7b..2af042fe4b 100644
--- a/sysdeps/i386/init-first.c
+++ b/sysdeps/i386/init-first.c
@@ -59,7 +59,9 @@ _init (int argc, ...)
{
init (&argc);
+#ifndef NO_CTORS_DTORS_SECTIONS
__libc_global_ctors ();
+#endif
}
#endif
diff --git a/sysdeps/mach/hurd/i386/init-first.c b/sysdeps/mach/hurd/i386/init-first.c
index f9a7a58deb..60823bd789 100644
--- a/sysdeps/mach/hurd/i386/init-first.c
+++ b/sysdeps/mach/hurd/i386/init-first.c
@@ -92,7 +92,7 @@ posixland_init (int argc, char **argv, char **envp)
__getopt_clean_environment (envp);
#endif
-#ifdef SHARED
+#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
__libc_global_ctors ();
#endif
}
diff --git a/sysdeps/mach/hurd/powerpc/init-first.c b/sysdeps/mach/hurd/powerpc/init-first.c
index 20fa1d4f12..21b5054b0a 100644
--- a/sysdeps/mach/hurd/powerpc/init-first.c
+++ b/sysdeps/mach/hurd/powerpc/init-first.c
@@ -82,7 +82,7 @@ posixland_init (int argc, char **argv, char **envp)
__getopt_clean_environment (__environ);
#endif
-#ifdef SHARED
+#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
__libc_global_ctors ();
#endif
}
diff --git a/sysdeps/sh/init-first.c b/sysdeps/sh/init-first.c
index d816625ef4..1f3a821fea 100644
--- a/sysdeps/sh/init-first.c
+++ b/sysdeps/sh/init-first.c
@@ -59,7 +59,9 @@ _init (int argc, ...)
{
init (&argc);
+#ifndef NO_CTORS_DTORS_SECTIONS
__libc_global_ctors ();
+#endif
}
#endif
diff --git a/sysdeps/unix/sysv/linux/init-first.c b/sysdeps/unix/sysv/linux/init-first.c
index 7b2333d4bf..a60212f4ed 100644
--- a/sysdeps/unix/sysv/linux/init-first.c
+++ b/sysdeps/unix/sysv/linux/init-first.c
@@ -93,7 +93,7 @@ _init (int argc, char **argv, char **envp)
__getopt_clean_environment (envp);
#endif
-#ifdef SHARED
+#if defined SHARED && !defined NO_CTORS_DTORS_SECTIONS
__libc_global_ctors ();
#endif
}

View File

@ -0,0 +1,21 @@
commit 7c8a67320e26b8c11108bf0a3410d3aef9cf3486
Author: Ulrich Drepper <drepper@redhat.com>
Date: Sat Jan 31 00:21:15 2009 +0000
* elf/Makefile (ld.so): Adjust the sed script to insert _begin in to
newer linker scripts.
diff --git a/elf/Makefile b/elf/Makefile
index 8079fe9f96..e44ff1d382 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -304,7 +304,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld-map)
$(LDFLAGS-rtld) -Wl,-z,defs -Wl,--verbose 2>&1 | \
LC_ALL=C \
sed -e '/^=========/,/^=========/!d;/^=========/d' \
- -e 's/\. = 0 + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
+ -e 's/\. = .* + SIZEOF_HEADERS;/& _begin = . - SIZEOF_HEADERS;/' \
> $@.lds
$(LINK.o) -nostdlib -nostartfiles -shared -o $@ \
$(LDFLAGS-rtld) -Wl,-z,defs $(z-now-$(bind-now)) \

View File

@ -0,0 +1,13 @@
diff --git a/sunrpc/rpc_clntout.c b/sunrpc/rpc_clntout.c
index ec040c775e2..ce4d2a4c953 100644
--- a/sunrpc/rpc_clntout.c
+++ b/sunrpc/rpc_clntout.c
@@ -31,7 +31,7 @@
*/
#include <stdio.h>
#include <string.h>
-#include <rpc/types.h>
+#include "rpc/types.h"
#include "rpc_parse.h"
#include "rpc_util.h"
#include "proto.h"

View File

@ -0,0 +1,19 @@
diff --git a/misc/regexp.c b/misc/regexp.c
index ee7d572..e0b4b47 100644
--- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -23,11 +23,11 @@
#include <regex.h>
/* Define the variables used for the interface. */
-char *loc1;
-char *loc2;
+char *loc1 __attribute__ ((nocommon));
+char *loc2 __attribute__ ((nocommon));
/* Although we do not support the use we define this variable as well. */
-char *locs;
+char *locs __attribute__ ((nocommon));
/* Find the next match in STRING. The compiled regular expression is

View File

@ -0,0 +1,20 @@
--- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -29,14 +29,15 @@
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
-/* Define the variables used for the interface. */
-char *loc1;
-char *loc2;
+/* Define the variables used for the interface. Avoid .symver on common
+ symbol, which just creates a new common symbol, not an alias. */
+char *loc1 __attribute__ ((nocommon));
+char *loc2 __attribute__ ((nocommon));
compat_symbol (libc, loc1, loc1, GLIBC_2_0);
compat_symbol (libc, loc2, loc2, GLIBC_2_0);
/* Although we do not support the use we define this variable as well. */
-char *locs;
+char *locs __attribute__ ((nocommon));
compat_symbol (libc, locs, locs, GLIBC_2_0);

View File

@ -0,0 +1,140 @@
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
from spack.package import *
from spack.util.elf import delete_rpath
class Glibc(AutotoolsPackage, GNUMirrorPackage):
"""The GNU C Library provides many of the low-level components used
directly by programs written in the C or C++ languages."""
homepage = "https://www.gnu.org/software/libc/"
gnu_mirror_path = "libc/glibc-2.33.tar.gz"
git = "https://sourceware.org/git/glibc.git"
maintainers("haampie")
build_directory = "build"
version("master", branch="master")
version("2.38", sha256="16e51e0455e288f03380b436e41d5927c60945abd86d0c9852b84be57dd6ed5e")
version("2.37", sha256="e3a790c2f84eed5c5d569ed6172c253c607dd3962135437da413aa39aa4fd352")
version("2.36", sha256="02efa6ffbbaf3e10e88f16818a862608d04b0ef838c66f6025ae120530792c9c")
version("2.35", sha256="3e8e0c6195da8dfbd31d77c56fb8d99576fb855fafd47a9e0a895e51fd5942d4")
version("2.34", sha256="255b7632746b5fdd478cb7b36bebd1ec1f92c2b552ee364c940f48eb38d07f62")
version("2.33", sha256="ad7dbed6b0cde9ddc90e84856da7e2c1f976a5e791cdee947d8dbb0392fc76cf")
version("2.32", sha256="f52e5bdc6607cb692c0f7134b75b3ba34b5121628a1750c03e3c9aa0b9d9e65a")
version("2.31", sha256="cb2d64fb808affff30d8a99a85de9d2aa67dc2cbac4ae99af4500d6cfea2bda7")
version("2.30", sha256="decb0a29f1410735bed0e8e7247361da2bbf0dcfef7ac15bf26e7f910cb964c0")
version("2.29", sha256="2fc8c555fd0e5dab5b91e7dd0422865c1885be89ff080b2c1357041afbbc717f")
version("2.28", sha256="f318d6e3f1f4ed0b74d2832ac4f491d0fb928e451c9eda594cbf1c3bee7af47c")
version("2.27", sha256="881ca905e6b5eec724de7948f14d66a07d97bdee8013e1b2a7d021ff5d540522")
version("2.26", sha256="dcc2482b00fdb1c316f385f8180e182bbd37c065dc7d8281a4339d2834ef1be7")
version("2.25", sha256="ad984bac07844ecc222039d43bd5f1f1e1571590ea28045232ae3fa404cefc32")
version("2.24", sha256="7e01959a42d37739e40d8ce58f9c14750cc68bc8a8669889ed586f9f03b91fbe")
version("2.23", sha256="2bd08abb24811cda62e17e61e9972f091f02a697df550e2e44ddcfb2255269d2")
version("2.22", sha256="a62610c4084a0fd8cec58eee12ef9e61fdf809c31e7cecbbc28feb8719f08be5")
version("2.21", sha256="8d8f78058f2e9c7237700f76fe4e0ae500db31470290cd0b8a9739c0c8ce9738")
version("2.20", sha256="37e1de410d572a19b707b99786db9822bb4775e9d70517d88937ab12e6d6debc")
version("2.19", sha256="18ad6db70724699d264add80b1f813630d0141cf3a3558b4e1a7c15f6beac796")
version("2.18", sha256="c8e727b5feef883184241a4767725ec280c0288794bc5cd4432497370db47734")
version("2.17", sha256="a3b2086d5414e602b4b3d5a8792213feb3be664ffc1efe783a829818d3fca37a")
version("2.16.0", sha256="a75be51658cc1cfb6324ec6dbdbed416526c44c14814823129f0fcc74c279f6e")
version("2.15", sha256="da6b95d14b722539c2ec02e7ae1221318dba3d27f19c098a882ffa71bb429c20")
version("2.14.1", sha256="f80c40897df49c463a6d5a45f734acbfe1bf42ef209a92a5c217aeb383631bdb")
version("2.13", sha256="bd90d6119bcc2898befd6e1bbb2cb1ed3bb1c2997d5eaa6fdbca4ee16191a906")
version("2.12.2", sha256="6b7392a7b339a3f2db6e4bc8d5418cf29116d9e7e36b313e845cb65e449c5346")
version("2.11.3", sha256="ddc3210f4029991f5142fda7f269f9bfb197917e5d9445ba2d90d31f74cc2765")
version("2.10.1", sha256="cd9743db33389e7b4eb2942a4f365d12fc015f115113b230152280c43ccc7e3f")
version("2.9", sha256="e0210dec2a4ca0a03d8ee26e2a4ebccc915d99f4cdb1489ff0f9f4ce7bda3e30")
version("2.8", sha256="a5b91339355a7bbafc5f44b524556f7f25de83dd56f2c00ef9240dabd6865663")
version("2.7", sha256="f5ef515cb70f8d4cfcee0b3aac05b73def60d897bdb7a71f4356782febfe415a")
version("2.6.1", sha256="6be7639ccad715d25eef560ce9d1637ef206fb9a162714f6ab8167fc0d971cae")
# Fix for newer GCC, related to -fno-common
patch("locs.patch", when="@2.23:2.25")
patch("locs-2.22.patch", when="@:2.22")
# _obstack_compat symbol is not initialized
patch("39b1f61.patch", when="@:2.17")
# docs: install fails with "unknown command hsep / vsep"
patch("texi.patch", when="@2.16.0")
# rpc/types.h include issue, should be from local version, not system.
patch("fb21f89.patch", when="@:2.16")
# Use init_array (modified commit 4a531bb to unconditionally define
# NO_CTORS_DTORS_SECTIONS)
patch("4a531bb.patch", when="@:2.12")
# make: mixed implicit and static pattern rules (trivial issue in docs)
patch("32cf406.patch", when="@:2.10")
# linker flag output regex
patch("7c8a673.patch", when="@:2.9")
def patch(self):
# Support gmake >= 4
filter_file(
" 3.79* | 3.[89]*)",
" 3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*)",
"configure",
string=True,
)
# Suport gcc >= 5
filter_file(
"3.4* | 4.[0-9]* )",
"3.4* | 4.[0-9]* | [5-9].* | [1-9][0-9]*)",
"configure",
string=True,
)
# Support gcc >= 10
filter_file(
"4.[4-9].* | 4.[1-9][0-9].* | [5-9].* )",
"4.[4-9].* | 4.[1-9][0-9].* | [5-9].* | [1-9][0-9]*)",
"configure",
string=True,
)
# Support binutils
filter_file(
"2.1[3-9]*)",
"2.1[3-9]*|2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*)",
"configure",
string=True,
)
depends_on("bison", type="build")
depends_on("texinfo", type="build")
depends_on("gettext", type="build")
depends_on("perl", type="build")
depends_on("linux-headers")
with when("@master"):
depends_on("autoconf", type="build")
depends_on("automake", type="build")
depends_on("libtool", type="build")
def configure_args(self):
return [
"--enable-kernel=4.4.1",
"--with-headers={}".format(self.spec["linux-headers"].prefix.include),
]
def build(self, spec, prefix):
# 1. build just ld.so
# 2. drop the rpath from ld.so -- otherwise it cannot be executed
# 3. do the rest of the build that may directly run ld.so
with working_dir(self.build_directory):
make("-C", "..", f"objdir={os.getcwd()}", "lib")
delete_rpath(join_path("elf", "ld.so"))
make()

View File

@ -0,0 +1,15 @@
diff --git a/manual/stdio.texi b/manual/stdio.texi
index be769a5..7b436f0 100644
--- a/manual/stdio.texi
+++ b/manual/stdio.texi
@@ -3137,7 +3137,7 @@ The postfix tag corresponds to bytes, kilobytes, megabytes, gigabytes,
etc. The full table is:
@ifinfo
-@multitable @hsep @vsep {' '} {2^10 (1024)} {zetta} {Upper} {10^24 (1000)}
+@multitable {' '} {2^10 (1024)} {zetta} {Upper} {10^24 (1000)}
@item low @tab Multiplier @tab From @tab Upper @tab Multiplier
@item ' ' @tab 1 @tab @tab ' ' @tab 1
@item k @tab 2^10 (1024) @tab kilo @tab K @tab 10^3 (1000)
--
1.8.0.1

View File

@ -3,6 +3,8 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import llnl.util.filesystem as fs
from spack.package import *
@ -11,9 +13,11 @@ class HpxKokkos(CMakePackage, CudaPackage, ROCmPackage):
homepage = "https://github.com/STEllAR-GROUP/hpx-kokkos"
url = "https://github.com/STEllAR-GROUP/hpx-kokkos/archive/0.0.0.tar.gz"
git = "https://github.com/STEllAR-GROUP/hpx-kokkos.git"
maintainers("G-071", "msimberg")
version("master", git="https://github.com/STEllAR-GROUP/hpx-kokkos.git", branch="master")
version("master", branch="master")
version("0.4.0", sha256="dafef55521cf4bf7ab28ebad546ea1d3fb83fac3a9932e292db4ab3666cd833f")
version("0.3.0", sha256="83c1d11dab95552ad0abdae767c71f757811d7b51d82bd231653dc942e89a45d")
version("0.2.0", sha256="289b711cea26afe80be002fc521234c9194cd0e8f69863f3b08b654674dbe5d5")
version("0.1.0", sha256="24edb817d0969f4aea1b68eab4984c2ea9a58f4760a9b8395e20f85b178f0850")
@ -26,6 +30,14 @@ class HpxKokkos(CMakePackage, CudaPackage, ROCmPackage):
description="Use the specified C++ standard when building.",
)
future_types_map = {"polling": "event", "callback": "callback"}
variant(
"future_type",
default="polling",
values=future_types_map.keys(),
description="Integration type for GPU futures",
)
depends_on("cmake@3.19:", type="build")
depends_on("hpx")
@ -52,3 +64,29 @@ class HpxKokkos(CMakePackage, CudaPackage, ROCmPackage):
depends_on("hpx +rocm", when="+rocm")
depends_on("kokkos +rocm", when="+rocm")
def cmake_args(self):
spec, args = self.spec, []
args += [
self.define(
"HPX_KOKKOS_CUDA_FUTURE_TYPE",
self.future_types_map[spec.variants["future_type"].value],
),
self.define("HPX_KOKKOS_ENABLE_TESTS", self.run_tests),
self.define("HPX_KOKKOS_ENABLE_BENCHMARKS", self.run_tests),
]
if "+rocm" in self.spec:
args += [self.define("CMAKE_CXX_COMPILER", self.spec["hip"].hipcc)]
return args
build_directory = "spack-build"
def check(self):
if self.run_tests:
with fs.working_dir(self.build_directory):
cmake("--build", ".", "--target", "tests")
cmake("--build", ".", "--target", "benchmarks")
ctest("--output-on-failure")

View File

@ -16,7 +16,7 @@ class Lcio(CMakePackage):
tags = ["hep"]
maintainers("gaede", "vvolkl")
maintainers("gaede", "vvolkl", "jmcarcell")
version("master", branch="master")
version("2.20", sha256="5ef92c9ef04ce468ffb48be0ec6010377a400b064e352cb50f9f4c9599e7e990")
@ -107,6 +107,7 @@ def setup_run_environment(self, env):
env.prepend_path("PYTHONPATH", self.prefix.python)
# needed for the python bindings to find "Exceptions.h"
env.prepend_path("CPATH", self.prefix)
env.prepend_path("LD_LIBRARY_PATH", self.spec["lcio"].libs.directories[0])
@run_after("install")
def install_source(self):

View File

@ -0,0 +1,20 @@
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack.package import *
class PyDataclassesJson(PythonPackage):
"""Easily serialize dataclasses to and from JSON."""
homepage = "https://github.com/lidatong/dataclasses-json"
pypi = "dataclasses_json/dataclasses_json-0.5.12.tar.gz"
version("0.5.12", sha256="70e28da52e36f4be6b724e1f1e77fbcd19e0e0a6bf9a4c4c6e5abf713d4dab5a")
depends_on("python@3.7:3.11", type=("build", "run"))
depends_on("py-poetry-core@1.2:", type="build")
depends_on("py-typing-inspect@0.4:0", type=("build", "run"))
depends_on("py-marshmallow@3.18:3", type=("build", "run"))

View File

@ -13,8 +13,10 @@ class PyPreshed(PythonPackage):
homepage = "https://github.com/explosion/preshed"
pypi = "preshed/preshed-3.0.2.tar.gz"
version("3.0.8", sha256="6c74c70078809bfddda17be96483c41d06d717934b07cab7921011d81758b357")
version("3.0.2", sha256="61d73468c97c1d6d5a048de0b01d5a6fd052123358aca4823cdb277e436436cb")
depends_on("py-setuptools", type="build")
depends_on("py-cython@0.28:", when="@3.0.8:", type="build")
depends_on("py-cymem@2.0.2:2.0", type=("build", "run"))
depends_on("py-murmurhash@0.28:1.0", type=("build", "run"))

View File

@ -11,6 +11,7 @@ class UcscBedclip(Package):
homepage = "http://hgdownload.cse.ucsc.edu/admin/exe/"
url = "http://hgdownload.cse.ucsc.edu/admin/exe/userApps.archive/userApps.v449.src.tgz"
maintainers("pabloaledo")
version("377", sha256="932f149c19641064a9cd3f2382cbb54b45a9292b8444792872d531346925d676")
version("449", sha256="b5a86863d6cfe2120f6c796a13b1572ad05b22622f6534b95c9d26ccbede09b7")

View File

@ -11,6 +11,7 @@ class UcscBedgraphtobigwig(Package):
homepage = "http://hgdownload.cse.ucsc.edu/admin/exe/"
url = "https://hgdownload.cse.ucsc.edu/admin/exe/userApps.archive/userApps.v445.src.tgz"
maintainers("pabloaledo")
version("449", sha256="b5a86863d6cfe2120f6c796a13b1572ad05b22622f6534b95c9d26ccbede09b7")
version("445", sha256="c7abb5db6a5e16a79aefcee849d2b59dbc71ee112ca1e41fea0afb25229cf56c")

View File

@ -31,7 +31,7 @@ class XercesC(AutotoolsPackage):
variant(
"cxxstd",
default="default",
values=("default", "98", "11", "14", "17"),
values=("default", "98", "11", "14", "17", "20"),
multi=False,
description="Use the specified C++ standard when building",
)