aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-05-30 15:33:07 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-05-30 15:33:07 +0300
commit92c607c2ca6960254e69afafc79ea437e0e81942 (patch)
tree98e0507b919b4cb33409f0a73bb92ed659a54362
parent9ad2166f1d268f9bf176a1b9bfeaee9003b0c0c5 (diff)
Factor out skeleton initialization into init_skeleton()
-rw-r--r--bpkg/pkg-build.cxx55
1 files changed, 35 insertions, 20 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index a36ed09..19ce716 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -1050,6 +1050,31 @@ namespace bpkg
// For other cases ("weak system") we don't want to copy system over in
// order not prevent, for example, system to non-system upgrade.
}
+
+ package_skeleton&
+ init_skeleton (const common_options& options)
+ {
+ assert (!skeleton && available != nullptr);
+
+ optional<dir_path> src_root (external_dir ());
+
+ optional<dir_path> out_root (
+ src_root && !disfigure
+ ? dir_path (db.get ().config) /= name ().string ()
+ : optional<dir_path> ());
+
+ skeleton = package_skeleton (
+ options,
+ db,
+ *available,
+ config_vars, // @@ Maybe make optional<strings> and move?
+ disfigure,
+ (selected != nullptr ? &selected->config_variables : nullptr),
+ move (src_root),
+ move (out_root));
+
+ return *skeleton;
+ }
};
using build_package_list = list<reference_wrapper<build_package>>;
@@ -3082,9 +3107,12 @@ namespace bpkg
//
const dependencies& deps (ap->dependencies);
- // Must all be either present or not.
+ // The skeleton can be pre-initialized before the recursive collection
+ // starts (as a part of dependency configuration negotiation, etc). The
+ // dependencies and alternatives members must both be either present or
+ // not.
//
- assert (pkg.dependencies.has_value () == pkg.skeleton.has_value () &&
+ assert ((!pkg.dependencies || pkg.skeleton) &&
pkg.dependencies.has_value () == pkg.alternatives.has_value ());
// Note that the selected alternatives list can be filled partially (see
@@ -3105,21 +3133,8 @@ namespace bpkg
pkg.alternatives->reserve (n);
}
- optional<dir_path> src_root (pkg.external_dir ());
-
- optional<dir_path> out_root (src_root && !pkg.disfigure
- ? dir_path (pdb.config) /= nm.string ()
- : optional<dir_path> ());
-
- pkg.skeleton = package_skeleton (
- options,
- pdb,
- *ap,
- pkg.config_vars, // @@ Maybe make optional<strings> and move?
- pkg.disfigure,
- (sp != nullptr ? &sp->config_variables : nullptr),
- move (src_root),
- move (out_root));
+ if (!pkg.skeleton)
+ pkg.init_skeleton (options);
}
else
l5 ([&]{trace << "resume " << pkg.available_name_version_db ();});
@@ -11745,7 +11760,7 @@ namespace bpkg
}
if (*p.action != build_package::drop &&
- !p.skeleton &&
+ !p.dependencies &&
!sp->prerequisites.empty ())
{
vector<package_name>& ps (previous_prerequisites[&p]);
@@ -12196,9 +12211,9 @@ namespace bpkg
// the package manually). Maybe that a good reason not to allow
// this? Or we could store this information in the database.
//
- if (p.skeleton)
+ if (p.dependencies)
{
- assert (p.dependencies);
+ assert (p.skeleton);
pkg_configure (o,
pdb,