From 5e7fadb9ca5413196390fe020b3ee143927b93cc Mon Sep 17 00:00:00 2001 From: vasilito Date: Sat, 1 Aug 2026 05:18:05 +0300 Subject: [PATCH] vendor: add [package].version to vendored recipes (fix 'cannot guess version') Converting [source] git=/tar= to path="source" removed the URL cookbook parsed the package version from, so non-Cargo recipes without an explicit [package].version failed at packaging ('cannot guess version', hit on ninja-build). Add version = "0.3.1" (the branch version, matching the vendored convention e.g. brush) to the 3 affected recipes, and make vendor-recipe.sh add it automatically on future conversions. --- local/recipes/dev/gnu-make/recipe.toml | 1 + local/recipes/dev/libtool/recipe.toml | 1 + local/recipes/dev/ninja-build/recipe.toml | 1 + local/scripts/vendor-recipe.sh | 16 ++++++++++++++++ 4 files changed, 19 insertions(+) diff --git a/local/recipes/dev/gnu-make/recipe.toml b/local/recipes/dev/gnu-make/recipe.toml index e58657b5d3..5f1d9198f1 100644 --- a/local/recipes/dev/gnu-make/recipe.toml +++ b/local/recipes/dev/gnu-make/recipe.toml @@ -16,4 +16,5 @@ cookbook_configure """ [package] +version = "0.3.1" description = "GNU Make build system (mkfifo jobserver enabled)" diff --git a/local/recipes/dev/libtool/recipe.toml b/local/recipes/dev/libtool/recipe.toml index 39828a4d1b..56c67a7b41 100644 --- a/local/recipes/dev/libtool/recipe.toml +++ b/local/recipes/dev/libtool/recipe.toml @@ -21,4 +21,5 @@ cookbook_configure """ [package] +version = "0.3.1" description = "GNU Libtool (shared library support)" diff --git a/local/recipes/dev/ninja-build/recipe.toml b/local/recipes/dev/ninja-build/recipe.toml index f7fb96663a..1d45c157a6 100644 --- a/local/recipes/dev/ninja-build/recipe.toml +++ b/local/recipes/dev/ninja-build/recipe.toml @@ -13,4 +13,5 @@ template = "cmake" cmakeflags = ["-DBUILD_TESTING=OFF"] [package] +version = "0.3.1" description = "Ninja build system" diff --git a/local/scripts/vendor-recipe.sh b/local/scripts/vendor-recipe.sh index 038ae2e10b..f2b412f144 100755 --- a/local/scripts/vendor-recipe.sh +++ b/local/scripts/vendor-recipe.sh @@ -76,6 +76,22 @@ PY # stamp printf '%s\n' "$stamp" > "$dir/source/.redbear-src-version" 2>/dev/null || true + # Ensure [package].version exists: converting git=/tar= to path="source" removes + # the URL cookbook parsed the version from, so a recipe without an explicit + # [package].version fails packaging ("cannot guess version"). Add the branch + # version if missing (matches the vendored convention, e.g. brush = "0.3.1"). + if grep -qE '^\[package\]' "$dir/recipe.toml" \ + && ! awk '/^\[package\]/{p=1;next} /^\[/{p=0} p' "$dir/recipe.toml" | grep -qE '^[[:space:]]*version[[:space:]]*='; then + python3 - "$dir/recipe.toml" <<'PY' +import re,sys +p=sys.argv[1]; s=open(p).read() +m=re.search(r'(\[package\][^\[]*?name\s*=\s*"[^"]*"\s*\n)', s) +if m: s=s[:m.end()]+'version = "0.3.1"\n'+s[m.end():] +else: s=re.sub(r'(\[package\]\s*\n)', r'\1version = "0.3.1"\n', s, count=1) +open(p,'w').write(s) +PY + fi + git -C "$ROOT" add -A "$dir" "$ROOT/.gitignore" >/dev/null 2>&1 nfiles=$(git -C "$ROOT" diff --cached --name-only -- "$dir/source" | wc -l | tr -d ' ') echo "[$name] vendored: $nfiles source files staged, baked $(grep -rlI '__redox__\|Q_OS_REDOX' "$dir/source" 2>/dev/null|wc -l) redox-marked"