aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-17 04:45:48 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-17 04:45:48 +0200
commit7fa50267d55250c7418e7cc95422270e8a3fcff6 (patch)
treeb2cb3d9dd2aaee473efcd8c9dbb71b79f63b3252
parent92697b523aa53d233c7ddd43c88d38f558fcd3bd (diff)
Get rid of package_skeleton::name(), rename package_skeleton::key to package
-rw-r--r--bpkg/package-configuration.cxx24
-rw-r--r--bpkg/package-skeleton.cxx53
-rw-r--r--bpkg/package-skeleton.hxx5
-rw-r--r--bpkg/pkg-configure.cxx2
4 files changed, 43 insertions, 41 deletions
diff --git a/bpkg/package-configuration.cxx b/bpkg/package-configuration.cxx
index 688d202..42c17ab 100644
--- a/bpkg/package-configuration.cxx
+++ b/bpkg/package-configuration.cxx
@@ -213,13 +213,13 @@ namespace bpkg
for (package_skeleton& depc: depcs)
{
- package_configuration& cfg (cfgs[depc.key]);
+ package_configuration& cfg (cfgs[depc.package]);
for (config_variable_value& v: cfg)
{
if (v.origin == variable_origin::buildfile)
{
- if (*v.dependent == dept.key)
+ if (*v.dependent == dept.package)
{
old_cfgs.push_back (
dependent_config_variable_value {
@@ -241,10 +241,10 @@ namespace bpkg
if (da.prefer)
fail << "unable to negotiate configuration for system dependency "
- << depc.key << " without configuration information" <<
+ << depc.package << " without configuration information" <<
info << "consider specifying system dependency version that has "
<< "corresponding available package" <<
- info << "dependent " << dept.key << " has prefer/accept clauses "
+ info << "dependent " << dept.package << " has prefer/accept clauses "
<< "that cannot be evaluated without configuration information";
if (!cfg.system)
@@ -269,7 +269,7 @@ namespace bpkg
// operator[] (which is really a push_back() into a vector).
//
for (package_skeleton& depc: depcs)
- depc_cfgs.push_back (cfgs[depc.key]);
+ depc_cfgs.push_back (cfgs[depc.package]);
// Step 2: execute the prefer/accept or requires clauses.
//
@@ -281,10 +281,10 @@ namespace bpkg
diag_record dr (fail);
dr << "unable to negotiate acceptable configuration with dependent "
- << dept.key << " for dependencies ";
+ << dept.package << " for dependencies ";
for (size_t i (0); i != depcs.size (); ++i)
- dr << (i == 0 ? "" : ", ") << depcs[i].get ().key;
+ dr << (i == 0 ? "" : ", ") << depcs[i].get ().package;
dr << info << "configuration before negotiation:\n";
@@ -307,7 +307,7 @@ namespace bpkg
for (package_skeleton& depc: depcs)
{
- package_configuration& cfg (cfgs[depc.key]);
+ package_configuration& cfg (cfgs[depc.package]);
for (config_variable_value& v: cfg)
{
@@ -383,7 +383,7 @@ namespace bpkg
dependent_config_variable_values new_cfgs;
for (package_skeleton& depc: depcs)
{
- package_configuration& cfg (cfgs[depc.key]);
+ package_configuration& cfg (cfgs[depc.package]);
for (config_variable_value& v: cfg)
{
@@ -457,7 +457,7 @@ namespace bpkg
diag_record dr (fail);
dr << "unable to negotiate acceptable configuration between dependents "
- << dept.key;
+ << dept.package;
// Analyze the O->N changes and determine the problematic dependent(s).
// Do we actually know for sure they are all problematic? Well, they
@@ -466,7 +466,7 @@ namespace bpkg
small_vector<reference_wrapper<const package_key>, 1> depts; // Duplicates.
for (const dependent_config_variable_value& nv: new_cfgs)
{
- if (nv.dependent == dept.key)
+ if (nv.dependent == dept.package)
{
if (const dependent_config_variable_value* ov = old_cfgs.find (nv.name))
{
@@ -489,7 +489,7 @@ namespace bpkg
dr << " for dependencies ";
for (size_t i (0); i != depcs.size (); ++i)
- dr << (i == 0 ? "" : ", ") << depcs[i].get ().key;
+ dr << (i == 0 ? "" : ", ") << depcs[i].get ().package;
dr << info << "configuration before negotiation:\n";
for (const package_configuration& cfg: depc_cfgs)
diff --git a/bpkg/package-skeleton.cxx b/bpkg/package-skeleton.cxx
index 2ca06cc..3034758 100644
--- a/bpkg/package-skeleton.cxx
+++ b/bpkg/package-skeleton.cxx
@@ -161,7 +161,7 @@ namespace bpkg
package_skeleton::
package_skeleton (package_skeleton&& v)
- : key (move (v.key)),
+ : package (move (v.package)),
system (v.system),
available (move (v.available)),
co_ (v.co_),
@@ -199,7 +199,7 @@ namespace bpkg
{
if (this != &v)
{
- key = move (v.key);
+ package = move (v.package);
system = v.system;
available = move (v.available);
co_ = v.co_;
@@ -237,7 +237,7 @@ namespace bpkg
package_skeleton::
package_skeleton (const package_skeleton& v)
- : key (v.key),
+ : package (v.package),
system (v.system),
available (v.available),
co_ (v.co_),
@@ -312,12 +312,12 @@ namespace bpkg
const vector<config_variable>* css,
optional<dir_path> src_root,
optional<dir_path> out_root)
- : key (move (pk)),
+ : package (move (pk)),
system (sys),
available (move (ap)),
co_ (&co),
- db_ (&key.db.get ()),
- var_prefix_ ("config." + key.name.variable ()),
+ db_ (&package.db.get ()),
+ var_prefix_ ("config." + package.name.variable ()),
config_vars_ (move (cvs)),
disfigure_ (df),
config_srcs_ (df ? nullptr : css)
@@ -868,7 +868,8 @@ namespace bpkg
// of the depends value in questions.
//
if (rs.out_eq_src ())
- dr << info << "in depends manifest value of package " << key.name;
+ dr << info << "in depends manifest value of package "
+ << package.name;
else
depends_location (dr,
rs.src_path () / manifest_file,
@@ -1006,7 +1007,8 @@ namespace bpkg
// of the depends value in questions.
//
if (rs.out_eq_src ())
- dr << info << "in depends manifest value of package " << key.name;
+ dr << info << "in depends manifest value of package "
+ << package.name;
else
depends_location (dr,
rs.src_path () / manifest_file,
@@ -1321,7 +1323,8 @@ namespace bpkg
// location of the depends value in questions.
//
if (rs.out_eq_src ())
- dr << info << "in depends manifest value of package " << key.name;
+ dr << info << "in depends manifest value of package "
+ << package.name;
else
depends_location (dr,
rs.src_path () / manifest_file,
@@ -1356,7 +1359,7 @@ namespace bpkg
fail << "package " << cfg.package.name << " has no "
<< "configuration variable " << var.name <<
info << var.name << " set in prefer clause of dependent "
- << key.string ();
+ << package.string ();
}
}
}
@@ -1381,7 +1384,8 @@ namespace bpkg
// location of the depends value in questions.
//
if (rs.out_eq_src ())
- dr << info << "in depends manifest value of package " << key.name;
+ dr << info << "in depends manifest value of package "
+ << package.name;
else
depends_location (dr,
rs.src_path () / manifest_file,
@@ -1450,7 +1454,7 @@ namespace bpkg
v.origin != variable_origin::override_)
{
fail << "dependency override " << var.name << " specified for "
- << "dependent " << key.string () << " but not dependency" <<
+ << "dependent " << package.string () << " but not dependency" <<
info << "did you mean to specify ?" << cfg.package.name
<< " +{ " << var.name << "=... }";
}
@@ -1487,7 +1491,7 @@ namespace bpkg
v.origin = variable_origin::buildfile;
v.value = move (ns);
- v.dependent = key; // We are the originating dependent.
+ v.dependent = package; // We are the originating dependent.
v.confirmed = true;
break;
}
@@ -1611,7 +1615,8 @@ namespace bpkg
// location of the depends value in questions.
//
if (rs.out_eq_src ())
- dr << info << "in depends manifest value of package " << key.name;
+ dr << info << "in depends manifest value of package "
+ << package.name;
else
depends_location (dr,
rs.src_path () / manifest_file,
@@ -1659,7 +1664,7 @@ namespace bpkg
fail << "package " << cfg.package.name << " has no "
<< "configuration variable " << var.name <<
info << var.name << " set in require clause of dependent "
- << key.string ();
+ << package.string ();
}
if (!v->type || *v->type != "bool")
@@ -1667,7 +1672,7 @@ namespace bpkg
fail << "configuration variable " << var.name << " is not of "
<< "bool type" <<
info << var.name << " set in require clause of dependent "
- << key.string ();
+ << package.string ();
}
}
@@ -1691,7 +1696,7 @@ namespace bpkg
fail << "configuration variable " << var.name << " is not set "
<< "to true" <<
info << var.name << " set in require clause of dependent "
- << key.string ();
+ << package.string ();
}
}
}
@@ -1741,7 +1746,7 @@ namespace bpkg
(v == nullptr || v->origin != variable_origin::override_))
{
fail << "dependency override " << var.name << " specified for "
- << "dependent " << key.string () << " but not dependency" <<
+ << "dependent " << package.string () << " but not dependency" <<
info << "did you mean to specify ?" << cfg.package.name
<< " +{ " << var.name << "=... }";
}
@@ -1812,7 +1817,7 @@ namespace bpkg
// here the value cannot be the default/buildfile (since we don't
// set those; see the load() call above).
//
- optional<names> ns (names {build2::name ("true")});
+ optional<names> ns (names {name ("true")});
// Note: force bool type if system.
//
@@ -1846,7 +1851,7 @@ namespace bpkg
v->origin = variable_origin::buildfile;
v->value = move (ns);
- v->dependent = key; // We are the originating dependent.
+ v->dependent = package; // We are the originating dependent.
v->confirmed = true;
}
}
@@ -1960,7 +1965,7 @@ namespace bpkg
for (const string& v: reflect_vars_)
{
print (v) << " (" << (system ? "expected" : "set") << " by "
- << key.name << ')';
+ << package.name << ')';
}
}
@@ -2117,7 +2122,7 @@ namespace bpkg
// Note: must be quoted to preserve the pattern.
//
v = "config.config.disfigure='config.";
- v += name ().variable ();
+ v += package.name.variable ();
v += "**'";
}
}
@@ -2539,7 +2544,7 @@ namespace bpkg
dir_path d (normalize (i->second, "temporary directory"));
d /= "skeletons";
- d /= skl.name ().string () + '-' + ap.version.string ();
+ d /= skl.package.name.string () + '-' + ap.version.string ();
if (skl.src_root_.empty ())
skl.src_root_ = move (d); // out_root_ is the same.
@@ -2588,7 +2593,7 @@ namespace bpkg
//
{
package_manifest m;
- m.name = skl.name ();
+ m.name = skl.package.name;
m.version = ap.version;
// Note that there is no guarantee that the potential build2
diff --git a/bpkg/package-skeleton.hxx b/bpkg/package-skeleton.hxx
index 88cba76..1e274c0 100644
--- a/bpkg/package-skeleton.hxx
+++ b/bpkg/package-skeleton.hxx
@@ -71,13 +71,10 @@ namespace bpkg
optional<dir_path> out_root);
- package_key key;
+ package_key package;
bool system;
shared_ptr<const available_package> available;
- const package_name&
- name () const {return key.name;} // @@ TMP: get rid (use key.name).
-
// The following functions should be called in the following sequence
// (* -- zero or more, ? -- zero or one):
//
diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx
index 834bdf9..854e5e1 100644
--- a/bpkg/pkg-configure.cxx
+++ b/bpkg/pkg-configure.cxx
@@ -90,7 +90,7 @@ namespace bpkg
//
if (alts == nullptr)
{
- if (toolchain_buildtime_dependency (o, das, &ps.name ()))
+ if (toolchain_buildtime_dependency (o, das, &ps.package.name))
continue;
for (size_t i (0); i != das.size (); ++i)