aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2022-02-04 11:46:14 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2022-02-04 14:22:00 +0300
commit0e954df70c6133d84660ee446fdb33ecb61a8c3f (patch)
tree661f7b87d4ffbb2860ecf1cc588f8e5708e45e30
parentfafc5727732c7df2c98b123292f483411e0050e3 (diff)
Improve pkg-build's make_available() function
-rw-r--r--bpkg/pkg-build.cxx25
1 files changed, 18 insertions, 7 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index a697fb0..02e4253 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -403,9 +403,23 @@ namespace bpkg
// root repository fragment but that feels a bit too drastic at the
// moment).
//
- shared_ptr<repository_fragment> af (
- db.find<repository_fragment> (
- sp->repository_fragment.canonical_name ()));
+ // Also note that the repository information for this selected package can
+ // potentially be in one of the ultimate dependent configurations as
+ // determined at the time of the run when the package was configured. This
+ // configurations set may differ from the current one, but let's try
+ // anyway.
+ //
+ lazy_shared_ptr<repository_fragment> rf;
+
+ for (database& ddb: dependent_repo_configs (db))
+ {
+ if (shared_ptr<repository_fragment> f = ddb.find<repository_fragment> (
+ sp->repository_fragment.canonical_name ()))
+ {
+ rf = lazy_shared_ptr<repository_fragment> (ddb, move (f));
+ break;
+ }
+ }
// The package is in at least fetched state, which means we should
// be able to get its manifest.
@@ -426,10 +440,7 @@ namespace bpkg
// Copy potentially fixed up version from selected package.
[&sp] (version& v) {v = sp->version;}));
- return make_pair (make_shared<available_package> (move (m)),
- (af != nullptr
- ? lazy_shared_ptr<repository_fragment> (db, move (af))
- : nullptr));
+ return make_pair (make_shared<available_package> (move (m)), move (rf));
}
// Return true if the version constraint represents the wildcard version.