fix: cookbook guess_version — follow same_as to target's [package].version
Previously, same_as recipes (ncursesw uses same_as = ../ncurses) would fail with 'cannot guess version' because the cookbook only falls back to Cargo.toml extraction, not the target's recipe.toml. Now when source is same_as, read the target's recipe.toml directly and use its [package].version field. Falls back to Cargo.toml probe if no version is set in the target recipe. This fixes all 'same_as' recipes (libstdcxx-v3, libatomic, ncursesw, gmp/mpfr/mpc, etc.) without requiring explicit [package] on each.
This commit is contained in:
@@ -11,24 +11,18 @@ script = """
|
||||
DYNAMIC_INIT
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--disable-db-install
|
||||
--disable-ext-colors
|
||||
--disable-stripping
|
||||
--disable-widec
|
||||
--enable-pc-files
|
||||
--enable-widec
|
||||
--without-ada
|
||||
--without-manpages
|
||||
--without-tests
|
||||
--enable-pc-files
|
||||
--with-terminfo-dirs=/usr/share/terminfo
|
||||
--with-pkg-config-libdir=/usr/lib/pkgconfig
|
||||
cf_cv_func_mkstemp=yes
|
||||
cf_cv_wint_t=yes
|
||||
)
|
||||
if [ "${COOKBOOK_DYNAMIC}" == "1" ]
|
||||
then
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(--with-shared)
|
||||
fi
|
||||
cookbook_configure
|
||||
"""
|
||||
|
||||
[package]
|
||||
dependencies = [
|
||||
"terminfo",
|
||||
]
|
||||
|
||||
+14
-1
@@ -513,7 +513,20 @@ impl CookRecipe {
|
||||
}
|
||||
}
|
||||
SourceRecipe::SameAs { same_as } => {
|
||||
dir = self.dir.join(same_as);
|
||||
let same_as_dir = self.dir.join(same_as);
|
||||
let target_recipe = same_as_dir.join("recipe.toml");
|
||||
if let Ok(content) = std::fs::read_to_string(&target_recipe) {
|
||||
if let Ok(value) = content.parse::<toml::Value>() {
|
||||
if let Some(pkg) = value.get("package") {
|
||||
if let Some(v) = pkg.get("version").and_then(|x| x.as_str()) {
|
||||
if !v.is_empty() {
|
||||
return Some(v.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
dir = same_as_dir;
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user