Compare commits

...

2 Commits

Author SHA1 Message Date
Harmen Stoppels
6866270bcf perl: remove a few imports 2025-05-21 11:32:12 +02:00
Harmen Stoppels
bfc52d6f50 spack repo migrate: fix order of if-elif (#50579) 2025-05-21 11:31:26 +02:00
2 changed files with 14 additions and 27 deletions

View File

@@ -201,7 +201,19 @@ def repo_migrate(args: Any) -> int:
repo_v2 = None
exit_code = 0
if exit_code == 0 and isinstance(repo_v2, spack.repo.Repo):
if not args.fix:
tty.error(
f"No changes were made to the repository {repo.root} with namespace "
f"'{repo.namespace}'. Run with --fix to apply the above changes."
)
elif exit_code == 1:
tty.error(
f"Repository '{repo.namespace}' could not be migrated to the latest Package API. "
"Please check the error messages above."
)
elif isinstance(repo_v2, spack.repo.Repo):
tty.info(
f"Repository '{repo_v2.namespace}' was successfully migrated from "
f"package API {repo.package_api_str} to {repo_v2.package_api_str}."
@@ -212,15 +224,9 @@ def repo_migrate(args: Any) -> int:
f" spack repo add {shlex.quote(repo_v2.root)}"
)
elif exit_code == 0:
else:
tty.info(f"Repository '{repo.namespace}' was successfully migrated")
elif not args.fix and exit_code == 1:
tty.error(
f"No changes were made to the repository {repo.root} with namespace "
f"'{repo.namespace}'. Run with --fix to apply the above changes."
)
return exit_code

View File

@@ -10,8 +10,6 @@
from spack_repo.builtin.build_systems.generic import Package
from llnl.util.filesystem import windows_sfn
from llnl.util.lang import match_predicate
from llnl.util.symlink import symlink
from spack.operating_systems.mac_os import macos_version
from spack.package import *
@@ -580,23 +578,6 @@ def make_briefly_writable(self, path):
yield
os.chmod(path, perm)
# ========================================================================
# Handle specifics of activating and deactivating perl modules.
# ========================================================================
def perl_ignore(self, ext_pkg, args):
"""Add some ignore files to activate/deactivate args."""
ignore_arg = args.get("ignore", lambda f: False)
# Many perl packages describe themselves in a perllocal.pod file,
# so the files conflict when multiple packages are activated.
# We could merge the perllocal.pod files in activated packages,
# but this is unnecessary for correct operation of perl.
# For simplicity, we simply ignore all perllocal.pod files:
patterns = [r"perllocal\.pod$"]
return match_predicate(ignore_arg, patterns)
@property
def command(self):
"""Returns the Perl command, which may vary depending on the version