cli: allow using commands from local flakerefs for debugging
This commit is contained in:
@@ -119,6 +119,13 @@ class Packages:
|
|||||||
else:
|
else:
|
||||||
allowed_packages = cls.allowed_packages
|
allowed_packages = cls.allowed_packages
|
||||||
|
|
||||||
|
if "#" in package:
|
||||||
|
log.warning(
|
||||||
|
"Allowing package %s for debugging as it looks like a flakeref",
|
||||||
|
package,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
if package not in allowed_packages:
|
if package not in allowed_packages:
|
||||||
msg = f"Package not allowed: '{package}', allowed packages are:\n{'\n'.join(allowed_packages)}"
|
msg = f"Package not allowed: '{package}', allowed packages are:\n{'\n'.join(allowed_packages)}"
|
||||||
raise ClanError(msg)
|
raise ClanError(msg)
|
||||||
@@ -133,6 +140,9 @@ class Packages:
|
|||||||
os.environ.get("CLAN_PROVIDED_PACKAGES", "").split(":")
|
os.environ.get("CLAN_PROVIDED_PACKAGES", "").split(":")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if "#" in program:
|
||||||
|
return True
|
||||||
|
|
||||||
if program in cls.static_packages:
|
if program in cls.static_packages:
|
||||||
if shutil.which(program) is None:
|
if shutil.which(program) is None:
|
||||||
log.warning(
|
log.warning(
|
||||||
@@ -157,7 +167,7 @@ def nix_shell(packages: list[str], cmd: list[str]) -> list[str]:
|
|||||||
f"nixpkgs#{package}"
|
f"nixpkgs#{package}"
|
||||||
for package in packages
|
for package in packages
|
||||||
if not Packages.is_provided(package)
|
if not Packages.is_provided(package)
|
||||||
]
|
] + [package for package in packages if "#" in package]
|
||||||
if not missing_packages:
|
if not missing_packages:
|
||||||
return cmd
|
return cmd
|
||||||
return [
|
return [
|
||||||
|
|||||||
Reference in New Issue
Block a user