Skip to content

Commit

Permalink
Accumulated tweaks from Marc M.
Browse files Browse the repository at this point in the history
* Be less specific about gettext with ~libxml2

* can use libc+iconv or gettext with or without libxml2

* initial round of ups compatability from prev release

* readonly bootstrap (cvmfs) workaround

* package updates from fnal-develop

* added ups compat files

* more missing files

* moderncmakedomain package

* per_os_scope

* Redo of FNALssi/spack #94

* redo of FNALssi #162

* Revert "redo of FNALssi #162"

* This reverts commit f92ed6e.

  Someone fixed the geant4 recipe with a for loop in the recipe instead,
  so not doing this after all.

* redo of FNALssi #161

* more cleanups from fnal-develop

* More lib64 fun

* speling of startswith

* version

* Style fixes
  • Loading branch information
marcmengel authored and greenc-FNAL committed Sep 21, 2023
1 parent 71ff111 commit 1b614ad
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 22 deletions.
2 changes: 1 addition & 1 deletion lib/spack/llnl/util/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -2351,7 +2351,7 @@ def find_libraries(libraries, root, shared=True, recursive=False, runtime=True):
# perform first non-recursive search in root/lib then in root/lib64 and
# finally search all of root recursively. The search stops when the first
# match is found.
common_lib_dirs = ["lib", "lib64"]
common_lib_dirs = ["lib64", "lib"]
if sys.platform == "win32":
common_lib_dirs.extend(["bin", "Lib"])

Expand Down
9 changes: 9 additions & 0 deletions lib/spack/spack/build_systems/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@
import sys
from typing import List, Optional, Tuple

import archspec.cpu

import llnl.util.filesystem as fs

import spack.build_environment
import spack.builder
import spack.package_base
import spack.util.path
from spack.directives import build_system, conflicts, depends_on, variant
from spack.multimethod import when

Expand Down Expand Up @@ -274,8 +277,13 @@ def std_args(pkg, generator=None):
generator,
define("CMAKE_INSTALL_PREFIX", pathlib.Path(pkg.prefix).as_posix()),
define("CMAKE_BUILD_TYPE", build_type),
define("BUILD_TESTING", pkg.run_tests),
]

# if we're building for a 64 bit system, prefer lib64 paths
if str(archspec.cpu.host().generic).find("_64_") > 0:
args.append(define("FIND_LIBRARY_USE_LIB64_PATHS", True))

# CMAKE_INTERPROCEDURAL_OPTIMIZATION only exists for CMake >= 3.9
if pkg.spec.satisfies("^cmake@3.9:"):
args.append(define("CMAKE_INTERPROCEDURAL_OPTIMIZATION", ipo))
Expand Down Expand Up @@ -450,6 +458,7 @@ def cmake_args(self):
* CMAKE_INSTALL_PREFIX
* CMAKE_BUILD_TYPE
* BUILD_TESTING
which will be set automatically.
"""
Expand Down
11 changes: 7 additions & 4 deletions lib/spack/spack/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ def _write_section(self, section):
with open(filename, "w") as f:
syaml.dump_config(data, stream=f, default_flow_style=False)
except (syaml.SpackYAMLError, IOError) as e:
raise ConfigFileError(f"cannot write to '{filename}'") from e
if hasattr(e, "errno") and e.errno in [13, 30]:
tty.warn("Ignoring write error on readonly %s" % filename)
else:
raise ConfigFileError(f"cannot write to '{filename}'") from e

def clear(self):
"""Empty cached config information."""
Expand Down Expand Up @@ -753,9 +756,9 @@ def _add_platform_scope(cfg, scope_type, name, path):
def _add_os_scope(cfg, scope_type, name, path):
"""Add an os-specific subdirectory for the current platform."""
host_platform = spack.platforms.host()
oss = host_platform.operating_system("frontend")
os_name = "%s/%s" % (name, oss)
os_path = "%s/%s" % (path, oss)
oss = str(host_platform.operating_system("frontend"))
os_name = os.path.join(name, oss)
os_path = os.path.join(path, oss)
cfg.push_scope(scope_type(os_name, os_path))


Expand Down
4 changes: 3 additions & 1 deletion lib/spack/spack/modules/ups_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ def make_configuration(spec, module_set_name, explicit):
try:
return configuration_registry[key]
except KeyError:
return configuration_registry.setdefault(key, UpsTableConfiguration(spec, module_set_name))
return configuration_registry.setdefault(
key, UpsTableConfiguration(spec, module_set_name, explicit)
)


def make_layout(spec, module_set_name, explicit):
Expand Down
2 changes: 1 addition & 1 deletion lib/spack/spack/modules/ups_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def make_configuration(spec, module_set_name, explicit):
return configuration_registry[key]
except KeyError:
return configuration_registry.setdefault(
key, UpsVersionConfiguration(spec, module_set_name)
key, UpsVersionConfiguration(spec, module_set_name, explicit)
)


Expand Down
4 changes: 2 additions & 2 deletions lib/spack/spack/package_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1236,10 +1236,10 @@ def extendee_spec(self):
deps.append(dep)

if deps:
# assert len(deps) == 1
# we may not still need this, but just in case... mengel
if len(deps) == 2:
assert repr(deps[0]) == repr(deps[1])
tty.debug("duplicated extendee deps?! {0}".format(repr(deps[0])))
tty.debug("Duplicated extendee deps?! {0}".format(repr(deps[0])))
else:
assert len(deps) == 1
return deps[0]
Expand Down
2 changes: 1 addition & 1 deletion lib/spack/spack/relocate.py
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ def new_relocate_elf_binaries(binaries, prefix_to_prefix):

# Transform to binary string
prefix_to_prefix = OrderedDict(
(k.encode("utf-8"), v.encode("utf-8")) for (k, v) in prefix_to_prefix.items()
(k.encode("utf-8"), v.encode("utf-8")) for (k, v) in prefix_to_prefix.items() if k and v
)

for path in binaries:
Expand Down
4 changes: 3 additions & 1 deletion lib/spack/spack/relocate_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def encode_path(p: Prefix) -> bytes:


def _prefix_to_prefix_as_bytes(prefix_to_prefix) -> Dict[bytes, bytes]:
return OrderedDict((encode_path(k), encode_path(v)) for (k, v) in prefix_to_prefix.items())
return OrderedDict(
(encode_path(k), encode_path(v)) for (k, v) in prefix_to_prefix.items() if k and v
)


def utf8_path_to_binary_regex(prefix: str):
Expand Down
1 change: 1 addition & 0 deletions lib/spack/spack/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2848,6 +2848,7 @@ def inject_patches_variant(root):
# don't blow up if there is a package in the buildcache we do not have
# a recipe for -- mengel
continue

if dspec.spec.name not in pkg_deps:
continue

Expand Down
2 changes: 1 addition & 1 deletion share/spack/templates/modules/modulefile.ups_table
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ QUALIFIERS=""


{%set spack_root = os.environ['SPACK_ROOT'] %}
{%set install_root = spack_root[0:spack_root.find('/spack/')] %}
{%set install_root = spack_root[0:spack_root.find('/spack/')] %}
{%if spec.prefix.startswith(install_root) %}

Action = setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def setup_run_environment(self, env):
def setup_dependent_build_environment(self, env, dependent_spec):
env.prepend_path("XDG_DATA_DIRS", self.prefix.share)
env.prepend_path("GI_TYPELIB_PATH", join_path(self.prefix.lib, "girepository-1.0"))
env.prepend_path("LD_LIBRARY_PATH", self.spec['glib'].prefix.lib)
env.prepend_path("LD_LIBRARY_PATH", self.spec["glib"].prefix.lib)

def setup_dependent_run_environment(self, env, dependent_spec):
env.prepend_path("XDG_DATA_DIRS", self.prefix.share)
Expand Down
14 changes: 8 additions & 6 deletions var/spack/repos/builtin/packages/hdf5/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ class Hdf5(CMakePackage):
variant("hl", default=False, description="Enable the high-level library")
variant("cxx", default=False, description="Enable C++ support")
variant(
"cxxstd",
default="11",
values=("11","14","17","20","23"),
multi=False,
sticky=True,
"cxxstd",
default="11",
values=("11", "14", "17", "20", "23"),
multi=False,
sticky=True,
description="C++ standard",
)
variant("map", when="@1.14:", default=False, description="Enable MAP API support")
Expand Down Expand Up @@ -606,7 +606,9 @@ def cmake_args(self):
spec.satisfies("@1.8.22+shared+tools"),
),
self.define("CXX_STANDARD_REQUIRED", True),
self.define("CMAKE_CXX_FLAGS", "-std=c++{0}".format(self.spec.variants["cxxstd"].value)),
self.define(
"CMAKE_CXX_FLAGS", "-std=c++{0}".format(self.spec.variants["cxxstd"].value)
),
self.define_from_variant("CMAKE_CXX_STANDARD", "cxxstd"),
self.define_from_variant("HDF5_ENABLE_MAP_API", "map"),
self.define("HDF5_ENABLE_Z_LIB_SUPPORT", True),
Expand Down
3 changes: 3 additions & 0 deletions var/spack/repos/builtin/packages/libgd/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,6 @@ def patch(self):
"configure",
string=True,
)
filter_file(
"#include *<string.h>", "#include <string.h>\n#include <limits.h>", "src/gd_gd2.c"
)
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ class PerlHttpMessage(PerlPackage):
depends_on("perl-encode-locale@1:", type="run")
depends_on("perl-extutils-makemaker", type=("build", "test"))
depends_on("perl-http-date@6:", type="run")
depends_on(
"perl-io-uncompress-brotli@0.4.1:", type=("build", "run", "test")
)
depends_on("perl-io-uncompress-brotli@0.4.1:", type=("build", "run", "test"))
depends_on("perl-io-compress-bzip2@2.21:", type="run")
depends_on("perl-io-compress-deflate", type="run")
depends_on("perl-io-compress-gzip", type="run")
Expand Down

0 comments on commit 1b614ad

Please sign in to comment.