aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-build.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2021-04-22 15:32:09 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2021-07-09 13:12:35 +0300
commitce6b3c9c1f0b550181ca1f5a89d732fc3df8fdf4 (patch)
tree08ac876e3abdfc74436e11ad60d9ca0654a00731 /bpkg/pkg-build.cxx
parentbc681a6c20dcd5aa048309aab6aa022019b7c98c (diff)
Various cleanups
Diffstat (limited to 'bpkg/pkg-build.cxx')
-rw-r--r--bpkg/pkg-build.cxx27
1 files changed, 17 insertions, 10 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index 082696e..32a680f 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -107,7 +107,7 @@ namespace bpkg
return r;
}
- // As above but only look for packages from the specified list fo repository
+ // As above but only look for packages from the specified list of repository
// fragments, their prerequisite repositories, and their complements,
// recursively (note: recursivity applies to complements, not
// prerequisites).
@@ -284,6 +284,8 @@ namespace bpkg
{
enum action_type
{
+ // Available package is not NULL.
+ //
build,
// Selected package is not NULL, available package is NULL.
@@ -1067,9 +1069,9 @@ namespace bpkg
// Add our constraint, if we have one.
//
- // Note that we always add the constraint implied by the dependent. The
- // user-implied constraint, if present, will be added when merging from
- // the pre-entered entry. So we will have both constraints for
+ // Note that we always add the constraint implied by the dependent.
+ // The user-implied constraint, if present, will be added when merging
+ // from the pre-entered entry. So we will have both constraints for
// completeness.
//
if (dp.constraint)
@@ -1549,8 +1551,12 @@ namespace bpkg
return p.available_name_version ();
};
- for (chain.push_back (name); i != chain.end () - 1; ++i)
- dr << info << nv (*i) << " depends on " << nv (*(i + 1));
+ // Note: push_back() can invalidate the iterator.
+ //
+ size_t j (i - chain.begin ());
+
+ for (chain.push_back (name); j != chain.size () - 1; ++j)
+ dr << info << nv (chain[j]) << " depends on " << nv (chain[j + 1]);
}
}
@@ -3180,8 +3186,8 @@ namespace bpkg
//
map<package_name, pkg_arg> package_map;
- auto check_dup = [&package_map, &arg_string, arg_parsed] (
- const pkg_arg& pa) -> bool
+ auto check_dup = [&package_map, &arg_string, &arg_parsed]
+ (const pkg_arg& pa) -> bool
{
assert (arg_parsed (pa));
@@ -3904,7 +3910,6 @@ namespace bpkg
if (scratch)
{
pkgs.clear ();
- postponed.clear ();
// Pre-enter dependencies to keep track of the desired versions and
// options specified on the command line. In particular, if the
@@ -4169,7 +4174,7 @@ namespace bpkg
// make sure that the unsatisfiable dependency, if left, is
// reported.
//
- auto need_refinement = [&eval_dep, &deps, rec_pkgs, &db, &o] (
+ auto need_refinement = [&eval_dep, &deps, &rec_pkgs, &db, &o] (
bool diag = false) -> bool
{
// Examine the new dependency set for any up/down-grade/drops.
@@ -4654,6 +4659,8 @@ namespace bpkg
//
if (sp != nullptr)
{
+ assert (!sp->system ());
+
transaction t (db, !simulate /* start */);
pkg_purge (c, t, sp, simulate); // Commits the transaction.