vendor: add [package].version to vendored recipes (fix 'cannot guess version')
redbear-ci / check (push) Has been cancelled
redbear-ci / check (push) Has been cancelled
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.
This commit is contained in:
@@ -16,4 +16,5 @@ cookbook_configure
|
||||
"""
|
||||
|
||||
[package]
|
||||
version = "0.3.1"
|
||||
description = "GNU Make build system (mkfifo jobserver enabled)"
|
||||
|
||||
@@ -21,4 +21,5 @@ cookbook_configure
|
||||
"""
|
||||
|
||||
[package]
|
||||
version = "0.3.1"
|
||||
description = "GNU Libtool (shared library support)"
|
||||
|
||||
@@ -13,4 +13,5 @@ template = "cmake"
|
||||
cmakeflags = ["-DBUILD_TESTING=OFF"]
|
||||
|
||||
[package]
|
||||
version = "0.3.1"
|
||||
description = "Ninja build system"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user