aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-07-09 21:06:42 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-07-09 21:06:42 +0300
commitf492f67ced0db166bb9e0840252be616c5be0f67 (patch)
treeadf722a64a9605c66217a035dbcb0f5a0e53c828
parentab8c659fd2e7d1938740472327cf56843e4fd90a (diff)
Fix pkg-build crash for <package>@<location> spec in presense of --no-fetch option
-rw-r--r--bpkg/pkg-build.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx
index a4cbe7f..0793195 100644
--- a/bpkg/pkg-build.cxx
+++ b/bpkg/pkg-build.cxx
@@ -2514,10 +2514,16 @@ namespace bpkg
continue;
}
- // Expand the [[<packages>]@]<location> spec.
+ // Expand the [[<packages>]@]<location> spec. Fail if the repository
+ // is not found in this configuration, that can be the case in the
+ // presence of --no-fetch option.
//
shared_ptr<repository> r (
- db.load<repository> (ps.location.canonical_name ()));
+ db.find<repository> (ps.location.canonical_name ()));
+
+ if (r == nullptr)
+ fail << "repository '" << ps.location
+ << "' does not exist in this configuration";
// If no packages are specified explicitly (the argument starts with
// '@' or is a URL) then we select latest versions of all the packages