From 1b614ad0338bcd6bf6eb3dd40e9843bddee7809a Mon Sep 17 00:00:00 2001 From: Marc Mengel Date: Wed, 13 Sep 2023 11:12:21 -0500 Subject: [PATCH] Accumulated tweaks from Marc M. * 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 f92ed6e74a6e755d5314774ea2197148d24c8d60. 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 --- lib/spack/llnl/util/filesystem.py | 2 +- lib/spack/spack/build_systems/cmake.py | 9 +++++++++ lib/spack/spack/config.py | 11 +++++++---- lib/spack/spack/modules/ups_table.py | 4 +++- lib/spack/spack/modules/ups_version.py | 2 +- lib/spack/spack/package_base.py | 4 ++-- lib/spack/spack/relocate.py | 2 +- lib/spack/spack/relocate_text.py | 4 +++- lib/spack/spack/spec.py | 1 + share/spack/templates/modules/modulefile.ups_table | 2 +- .../packages/gobject-introspection/package.py | 2 +- var/spack/repos/builtin/packages/hdf5/package.py | 14 ++++++++------ var/spack/repos/builtin/packages/libgd/package.py | 3 +++ .../builtin/packages/perl-http-message/package.py | 4 +--- 14 files changed, 42 insertions(+), 22 deletions(-) diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index bd203ef200dfe1..6ad314a2125791 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -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"]) diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py index 20c3f64aaee5d6..2fb626c2425439 100644 --- a/lib/spack/spack/build_systems/cmake.py +++ b/lib/spack/spack/build_systems/cmake.py @@ -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 @@ -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)) @@ -450,6 +458,7 @@ def cmake_args(self): * CMAKE_INSTALL_PREFIX * CMAKE_BUILD_TYPE + * BUILD_TESTING which will be set automatically. """ diff --git a/lib/spack/spack/config.py b/lib/spack/spack/config.py index 97197be6e53b75..9c6fb6366e0460 100644 --- a/lib/spack/spack/config.py +++ b/lib/spack/spack/config.py @@ -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.""" @@ -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)) diff --git a/lib/spack/spack/modules/ups_table.py b/lib/spack/spack/modules/ups_table.py index 41e5bb736c6b5c..8a06eaaf65ee96 100644 --- a/lib/spack/spack/modules/ups_table.py +++ b/lib/spack/spack/modules/ups_table.py @@ -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): diff --git a/lib/spack/spack/modules/ups_version.py b/lib/spack/spack/modules/ups_version.py index 2e09bc427e9b7b..6ec882e3c03311 100644 --- a/lib/spack/spack/modules/ups_version.py +++ b/lib/spack/spack/modules/ups_version.py @@ -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) ) diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index 2cbc106e36c575..c78c6a74f91510 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -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] diff --git a/lib/spack/spack/relocate.py b/lib/spack/spack/relocate.py index 756e3fa9dc60d1..af5f56595cc1c6 100644 --- a/lib/spack/spack/relocate.py +++ b/lib/spack/spack/relocate.py @@ -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: diff --git a/lib/spack/spack/relocate_text.py b/lib/spack/spack/relocate_text.py index fced612d7b64e6..0b8d81cc891222 100644 --- a/lib/spack/spack/relocate_text.py +++ b/lib/spack/spack/relocate_text.py @@ -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): diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 4fc44e79582336..a93fd9dba33eca 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -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 diff --git a/share/spack/templates/modules/modulefile.ups_table b/share/spack/templates/modules/modulefile.ups_table index 271fc45ed55b6c..fbb08b06e83fc0 100644 --- a/share/spack/templates/modules/modulefile.ups_table +++ b/share/spack/templates/modules/modulefile.ups_table @@ -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 diff --git a/var/spack/repos/builtin/packages/gobject-introspection/package.py b/var/spack/repos/builtin/packages/gobject-introspection/package.py index 0ecc1531f8fbc7..7a64fe9cce08fd 100644 --- a/var/spack/repos/builtin/packages/gobject-introspection/package.py +++ b/var/spack/repos/builtin/packages/gobject-introspection/package.py @@ -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) diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index 883b1c65238deb..59756e87dcd8a8 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -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") @@ -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), diff --git a/var/spack/repos/builtin/packages/libgd/package.py b/var/spack/repos/builtin/packages/libgd/package.py index e4e6ae19923e2e..c1a30f42813d72 100644 --- a/var/spack/repos/builtin/packages/libgd/package.py +++ b/var/spack/repos/builtin/packages/libgd/package.py @@ -47,3 +47,6 @@ def patch(self): "configure", string=True, ) + filter_file( + "#include *", "#include \n#include ", "src/gd_gd2.c" + ) diff --git a/var/spack/repos/builtin/packages/perl-http-message/package.py b/var/spack/repos/builtin/packages/perl-http-message/package.py index 6ba1aa0533aafd..98526728c4bb1f 100644 --- a/var/spack/repos/builtin/packages/perl-http-message/package.py +++ b/var/spack/repos/builtin/packages/perl-http-message/package.py @@ -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")