aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-05-17 09:04:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-05-17 09:04:51 +0200
commitf2dfe3ab13148fd1d3bd5adcfaa1b0ee1af89a1a (patch)
treecaa6a48be4ac21e50c0b386facb2902508769a95
parentdc9bef945c8dfd13cf3753fdcb9c794dd4e65107 (diff)
Diagnose package/project name mismatch in version module
-rw-r--r--build2/file.cxx1
-rw-r--r--build2/scope.hxx1
-rw-r--r--build2/version/init.cxx18
3 files changed, 20 insertions, 0 deletions
diff --git a/build2/file.cxx b/build2/file.cxx
index b12d39c..139cf99 100644
--- a/build2/file.cxx
+++ b/build2/file.cxx
@@ -452,6 +452,7 @@ namespace build2
a ? alt_buildignore_file : std_buildignore_file,
a ? alt_root_dir : std_root_dir,
a ? alt_bootstrap_dir : std_bootstrap_dir,
+ a ? alt_bootstrap_file : std_bootstrap_file,
a ? alt_root_file : std_root_file,
a ? alt_export_file : std_export_file,
a ? alt_src_root_file : std_src_root_file,
diff --git a/build2/scope.hxx b/build2/scope.hxx
index 84e7ffb..83396b4 100644
--- a/build2/scope.hxx
+++ b/build2/scope.hxx
@@ -283,6 +283,7 @@ namespace build2
const dir_path& root_dir; // build[2]/root/
const dir_path& bootstrap_dir; // build[2]/bootstrap/
+ const path& bootstrap_file; // build[2]/bootstrap.build[2]
const path& root_file; // build[2]/root.build[2]
const path& export_file; // build[2]/export.build[2]
const path& src_root_file; // build[2]/bootstrap/src-root.build[2]
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<project_name> (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")