Skip to content

Commit 78b55bc

Browse files
committed
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 5c4c128 commit 78b55bc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bits_helpers/utilities.py

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

312312

313-
def getRecipeReader(url, dist=None):
313+
def getRecipeReader(url:str , dist=None):
314314
m = re.search(r'^dist:(.*)@([^@]+)$', url)
315315
if m and dist:
316316
return GitReader(url, dist)
@@ -479,6 +479,9 @@ def getPackageList(packages, specs, configDir, preferSystem, noSystem,
479479

480480
filename,pkgdir = resolveFilename(taps, pkg_filename, configDir)
481481

482+
dieOnError(not filename, "Package %s not found in %s" % (p, configDir))
483+
assert(filename is not None)
484+
482485
err, spec, recipe = parseRecipe(getRecipeReader(filename, configDir))
483486
dieOnError(err, err)
484487
# Unless there was an error, both spec and recipe should be valid.

0 commit comments

Comments
 (0)