Skip to content

Commit 42ab2a4

Browse files
authored
Make sure recipe file exists before accessing it (#916)
Looks like a regression in #897 ```bash [root@56a05890a2a6 ~]# uvx aliBuild@1.17.14 build bogus ERROR: [Errno 2] No such file or directory: 'alidist/bogus.sh' [root@56a05890a2a6 ~]# uvx aliBuild@1.17.15 build bogus Traceback (most recent call last): File "/root/.cache/uv/archive-v0/GyJkpyQa9tPugmoKbsZ3N/bin/aliBuild", line 132, in <module> doMain(args, parser) File "/root/.cache/uv/archive-v0/GyJkpyQa9tPugmoKbsZ3N/bin/aliBuild", line 85, in doMain doBuild(args, parser) File "/root/.cache/uv/archive-v0/GyJkpyQa9tPugmoKbsZ3N/lib64/python3.9/site-packages/alibuild_helpers/build.py", line 490, in doBuild getPackageList(packages = packages, File "/root/.cache/uv/archive-v0/GyJkpyQa9tPugmoKbsZ3N/lib64/python3.9/site-packages/alibuild_helpers/utilities.py", line 457, in getPackageList err, spec, recipe = parseRecipe(getRecipeReader(filename, configDir)) File "/root/.cache/uv/archive-v0/GyJkpyQa9tPugmoKbsZ3N/lib64/python3.9/site-packages/alibuild_helpers/utilities.py", line 311, in getRecipeReader m = re.search(r'^dist:(.*)@([^@]+)$', url) File "/usr/lib64/python3.9/re.py", line 201, in search return _compile(pattern, flags).search(string) TypeError: expected string or bytes-like object ```
1 parent 3a0f2a0 commit 42ab2a4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

alibuild_helpers/utilities.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def readDefaults(configDir, defaults, error, architecture):
307307
return (defaultsMeta, defaultsBody)
308308

309309

310-
def getRecipeReader(url, dist=None):
310+
def getRecipeReader(url:str , dist=None):
311311
m = re.search(r'^dist:(.*)@([^@]+)$', url)
312312
if m and dist:
313313
return GitReader(url, dist)
@@ -454,6 +454,9 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem,
454454

455455
filename, pkgdir = resolveFilename(taps, pkg_filename, configDir)
456456

457+
dieOnError(not filename, "Package %s not found in %s" % (p, configDir))
458+
assert(filename is not None)
459+
457460
err, spec, recipe = parseRecipe(getRecipeReader(filename, configDir))
458461
dieOnError(err, err)
459462
# Unless there was an error, both spec and recipe should be valid.

0 commit comments

Comments
 (0)