summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2024-08-22 23:22:54 +0200
committerGitHub <noreply@github.com>2024-08-22 14:22:54 -0700
commitead25b1e9ea26063ad6ca5b30fd9afe63b7b8191 (patch)
tree9f1924afbff2e5df6b2c90b28e3d1348cec7c84b
parentd5eefcba87927edededca767bc8550daa0343bb7 (diff)
downloadspack-ead25b1e9ea26063ad6ca5b30fd9afe63b7b8191.tar.gz
spack-ead25b1e9ea26063ad6ca5b30fd9afe63b7b8191.tar.bz2
spack-ead25b1e9ea26063ad6ca5b30fd9afe63b7b8191.tar.xz
spack-ead25b1e9ea26063ad6ca5b30fd9afe63b7b8191.zip
Add a new audit to find missing package.py files (#45868)
* Add a new audit to find missing package.py files * Remove directory without package.py
-rw-r--r--lib/spack/spack/audit.py29
-rw-r--r--var/spack/repos/builtin/packages/miopen-tensile/0002-Improve-compilation-by-using-local-tensile-path.patch48
2 files changed, 28 insertions, 49 deletions
diff --git a/lib/spack/spack/audit.py b/lib/spack/spack/audit.py
index c5e12017e2..e4947f05a0 100644
--- a/lib/spack/spack/audit.py
+++ b/lib/spack/spack/audit.py
@@ -42,6 +42,7 @@ import glob
import inspect
import io
import itertools
+import os
import pathlib
import pickle
import re
@@ -210,6 +211,11 @@ config_packages = AuditClass(
group="configs", tag="CFG-PACKAGES", description="Sanity checks on packages.yaml", kwargs=()
)
+#: Sanity checks on packages.yaml
+config_repos = AuditClass(
+ group="configs", tag="CFG-REPOS", description="Sanity checks on repositories", kwargs=()
+)
+
@config_packages
def _search_duplicate_specs_in_externals(error_cls):
@@ -367,6 +373,27 @@ def _ensure_all_virtual_packages_have_default_providers(error_cls):
]
+@config_repos
+def _ensure_no_folders_without_package_py(error_cls):
+ """Check that we don't leave any folder without a package.py in repos"""
+ errors = []
+ for repository in spack.repo.PATH.repos:
+ missing = []
+ for entry in os.scandir(repository.packages_path):
+ if not entry.is_dir():
+ continue
+ package_py = pathlib.Path(entry.path) / spack.repo.package_file_name
+ if not package_py.exists():
+ missing.append(entry.path)
+ if missing:
+ summary = (
+ f"The '{repository.namespace}' repository misses a package.py file"
+ f" in the following folders"
+ )
+ errors.append(error_cls(summary=summary, details=[f"{x}" for x in missing]))
+ return errors
+
+
def _make_config_error(config_data, summary, error_cls):
s = io.StringIO()
s.write("Occurring in the following file:\n")
@@ -527,7 +554,7 @@ def _ensure_all_package_names_are_lowercase(pkgs, error_cls):
badname_regex, errors = re.compile(r"[_A-Z]"), []
for pkg_name in pkgs:
if badname_regex.search(pkg_name):
- error_msg = "Package name '{}' is either lowercase or conatine '_'".format(pkg_name)
+ error_msg = f"Package name '{pkg_name}' should be lowercase and must not contain '_'"
errors.append(error_cls(error_msg, []))
return errors
diff --git a/var/spack/repos/builtin/packages/miopen-tensile/0002-Improve-compilation-by-using-local-tensile-path.patch b/var/spack/repos/builtin/packages/miopen-tensile/0002-Improve-compilation-by-using-local-tensile-path.patch
deleted file mode 100644
index be92505c18..0000000000
--- a/var/spack/repos/builtin/packages/miopen-tensile/0002-Improve-compilation-by-using-local-tensile-path.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-diff --git a/CMakeLists.txt b/CMakeLists.txt
-index e98d74d..de8740e 100644
---- a/CMakeLists.txt
-+++ b/CMakeLists.txt
-@@ -55,7 +55,7 @@ macro(add_library NAME)
- endif()
- endmacro()
- find_package(hip)
--
-+set( Tensile_TEST_LOCAL_PATH "" CACHE PATH "Use local Tensile directory instead of fetching a GitHub branch" )
- if(CMAKE_CXX_COMPILER MATCHES ".*/hcc$")
- set(TENSILE_USE_LLVM ON CACHE BOOL "Use LLVM for parsing config files.")
- set(TENSILE_USE_MSGPACK OFF CACHE BOOL "Use msgpack for parsing config files.")
-@@ -79,11 +79,30 @@ endif()
- # set(MIOPEN_TENSILE_SRC dev)
- # endif()
- # Use the virtual-env setup and download package from specified repo:
--virtualenv_install(wheel)
--virtualenv_install("git+https://github.com/ROCmSoftwarePlatform/Tensile.git@${MIOPEN_TENSILE_TAG}")
--list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR})
-
--find_package(Tensile REQUIRED COMPONENTS HIP)
-+option(BUILD_USING_LOCAL_TENSILE "Build as a shared library" ON )
-+
-+if (WIN32)
-+ set( Tensile_ROOT "${CMAKE_BINARY_DIR}/virtualenv/Lib/site-packages/Tensile" )
-+endif()
-+
-+include(virtualenv)
-+if (BUILD_USING_LOCAL_TENSILE)
-+ virtualenv_install(${Tensile_TEST_LOCAL_PATH})
-+ message (STATUS "using local Tensile from ${Tensile_TEST_LOCAL_PATH}, copied to ${Tensile_ROOT}")
-+else()
-+ # Use the virtual-env setup and download package from specified repot:
-+ set( tensile_fork "ROCmSoftwarePlatform" CACHE STRING "Tensile fork to use" )
-+ virtualenv_install("git+https://github.com/${tensile_fork}/Tensile.git@${MIOPEN_TENSILE_TAG}")
-+ message (STATUS "using GIT Tensile fork=${tensile_fork} from branch=${MIOPEN_TENSILE_TAG}")
-+endif()
-+message(STATUS "Adding ${VIRTUALENV_HOME_DIR} to CMAKE_PREFIX_PATH")
-+list(APPEND CMAKE_PREFIX_PATH ${VIRTUALENV_HOME_DIR})
-+if (TENSILE_VERSION)
-+ find_package(Tensile ${TENSILE_VERSION} EXACT REQUIRED HIP LLVM PATHS "${INSTALLED_TENSILE_PATH}")
-+else()
-+ find_package(Tensile 4.28.0 EXACT REQUIRED HIP LLVM PATHS "${INSTALLED_TENSILE_PATH}")
-+endif()
-
- set_target_properties( TensileHost PROPERTIES POSITION_INDEPENDENT_CODE ON )
-