From f2dfe3ab13148fd1d3bd5adcfaa1b0ee1af89a1a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 17 May 2019 09:04:51 +0200 Subject: Diagnose package/project name mismatch in version module --- build2/version/init.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'build2/version') diff --git a/build2/version/init.cxx b/build2/version/init.cxx index 1a5f249..c4a0444 100644 --- a/build2/version/init.cxx +++ b/build2/version/init.cxx @@ -41,6 +41,9 @@ namespace build2 // Extract the version from the manifest file. As well as summary and // url while at it. // + // Also, as a sanity check, verify the package name matches the build + // system project name. + // string sum; string url; @@ -63,6 +66,21 @@ namespace build2 for (nv = p.next (); !nv.empty (); nv = p.next ()) { + if (nv.name == "name") + { + auto& pn (cast (rs.vars[var_project])); + + if (nv.value != pn.string ()) + { + path bf (rs.src_path () / rs.root_extra->bootstrap_file); + location ml (&f, nv.value_line, nv.value_column); + location bl (&bf); + + fail (ml) << "package name " << nv.value << " does not match " + << "build system project name " << pn << + info (bl) << "build system project name specified here"; + } + } if (nv.name == "summary") sum = move (nv.value); else if (nv.name == "url") -- cgit v1.1