From 141dd9fe0f04fab25c8bda8d831c818b62a6dbb0 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 19 May 2022 14:24:18 +0300 Subject: Pass config variables sources to skeleton constructor --- bpkg/package-skeleton.cxx | 8 +++++--- bpkg/package-skeleton.hxx | 2 +- bpkg/pkg-build.cxx | 28 +++++++++++++++++++--------- bpkg/pkg-configure.cxx | 5 +++++ 4 files changed, 30 insertions(+), 13 deletions(-) diff --git a/bpkg/package-skeleton.cxx b/bpkg/package-skeleton.cxx index 385a4fd..ba74853 100644 --- a/bpkg/package-skeleton.cxx +++ b/bpkg/package-skeleton.cxx @@ -101,14 +101,14 @@ namespace bpkg database& db, const available_package& ap, strings cvs, - /*const vector* css,*/ // @@ TMP + const vector* css, optional src_root, optional out_root) : co_ (&co), db_ (&db), available_ (&ap), config_vars_ (move (cvs)), - config_srcs_ (/*css*/ nullptr) // @@ TMP + config_srcs_ (css) { // Should not be created for stubs. // @@ -599,7 +599,9 @@ namespace bpkg if (!reflect_vars_.empty ()) { - assert (config_srcs_ == nullptr); // Should have been merged. + // @@ TMP Uncomment when the merge is implemented. + // + //assert (config_srcs_ == nullptr); // Should have been merged. vars = move (reflect_vars_); diff --git a/bpkg/package-skeleton.hxx b/bpkg/package-skeleton.hxx index 3e0da50..6030bdd 100644 --- a/bpkg/package-skeleton.hxx +++ b/bpkg/package-skeleton.hxx @@ -54,7 +54,7 @@ namespace bpkg database&, const available_package&, strings config_vars, - /*const vector* config_srcs,*/ // @@ TMP + const vector* config_srcs, optional src_root, optional out_root); diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 1d814b7..4d04f7a 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -2790,6 +2790,9 @@ namespace bpkg pdb, *ap, pkg.config_vars, + (sp != nullptr && !pkg.disfigure + ? &sp->config_variables + : nullptr), move (src_root), move (out_root)); } @@ -5077,12 +5080,14 @@ namespace bpkg const shared_ptr& ap (b->available); - b->skeleton = package_skeleton (o, - b->db, - *ap, - b->config_vars, - move (src_root), - move (out_root)); + b->skeleton = + package_skeleton (o, + b->db, + *ap, + b->config_vars, + nullptr /* config_srcs */, // @@ TMP + move (src_root), + move (out_root)); const auto& pos (ed.dependency_position); @@ -11413,6 +11418,9 @@ namespace bpkg pdb, *ap, move (p.config_vars), + (!p.disfigure + ? &sp->config_variables + : nullptr), move (src_root), move (out_root)), prereqs (), @@ -11427,9 +11435,8 @@ namespace bpkg // assert (sp->state == package_state::unpacked); - // Note that we don't use find_available*() here since we don't care - // about the repository fragment the package comes from and only need - // its manifest information. + // Note that here we don't care about the repository fragment the + // package comes from and only need its manifest information. // shared_ptr dap (find_available (o, pdb, sp)); @@ -11455,6 +11462,9 @@ namespace bpkg pdb, *dap, move (p.config_vars), + (!p.disfigure + ? &sp->config_variables + : nullptr), move (src_root), move (out_root)), prereqs (), diff --git a/bpkg/pkg-configure.cxx b/bpkg/pkg-configure.cxx index 49570c2..e2ecacb 100644 --- a/bpkg/pkg-configure.cxx +++ b/bpkg/pkg-configure.cxx @@ -591,6 +591,10 @@ namespace bpkg ? dir_path (db.config) /= p->name.string () : optional ()); + // Note that the package could have been disfigured with --keep-config. + // Thus, we always pass config variables it may store to the package + // skeleton. + // pkg_configure (o, db, t, @@ -601,6 +605,7 @@ namespace bpkg db, *ap, move (vars), + &p->config_variables, move (src_root), move (out_root)), nullptr /* prerequisites */, -- cgit v1.1