restore toml cache regression

This commit is contained in:
2026-01-20 05:33:44 -06:00
parent b3c0837d49
commit c051a99e75
2 changed files with 14 additions and 4 deletions

View File

@@ -5,6 +5,9 @@ var json = use('json')
var os = use('os')
var link = use('link')
// Cache for loaded configs to avoid toml re-parsing corruption
var config_cache = {}
// Convert package name to a safe directory name
// For absolute paths (local packages), replace / with _
// For remote packages, keep slashes as they use nested directories
@@ -43,6 +46,10 @@ package.load_config = function(name)
{
var config_path = get_path(name) + '/cell.toml'
// Return cached config if available
if (config_cache[config_path])
return config_cache[config_path]
if (!fd.is_file(config_path)) {
throw Error(`${config_path} does not exist`)
}
@@ -56,6 +63,10 @@ package.load_config = function(name)
return {}
}
// Deep copy to avoid toml module's shared state bug and cache it
result = json.decode(json.encode(result))
config_cache[config_path] = result
return result
}

View File

@@ -120,7 +120,7 @@ if (target_pkg) {
}
}
if (length(updated_packages)) > 0) {
if (length(updated_packages) > 0) {
log.console("Updated " + text(length(updated_packages)) + " package" + (length(updated_packages) == 1 ? "" : "s") + ".")
} else {
log.console("All packages are up to date.")
@@ -135,13 +135,12 @@ if (run_build && length(updated_packages) > 0) {
arrfor(updated_packages, function(pkg) {
try {
var lib = build.build_dynamic(pkg, target_triple, 'release')
if (lib) {
if (lib)
log.console(" Built: " + lib)
}
} catch (e) {
log.error(" Failed to build " + pkg + ": " + e)
}
}, null, null)
})
}
$stop()