aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-fetch.cxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-02-19 21:47:04 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-02-21 17:42:43 +0300
commit89dd478de7cf075beac69d0145df46f914cf35cf (patch)
treebe960f2406d087135c6456cff654de1f24a91557 /bpkg/pkg-fetch.cxx
parentd75d1d9e1c5b03b17fdea1fa3638db2bfe5e8d12 (diff)
Add support for pkg-checkout
Diffstat (limited to 'bpkg/pkg-fetch.cxx')
-rw-r--r--bpkg/pkg-fetch.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index 26f17d2..fbe5b5c 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -198,20 +198,28 @@ namespace bpkg
if (ap == nullptr)
fail << "package " << n << " " << v << " is not available";
- // Pick a repository. Preferring a local one over the remotes seems
- // like a sensible thing to do.
+ // Pick an archive-based repository. Preferring a local one over the
+ // remotes seems like a sensible thing to do.
//
- const package_location* pl (&ap->locations.front ());
+ const package_location* pl (nullptr);
for (const package_location& l: ap->locations)
{
- if (!l.repository.load ()->location.remote ())
+ const repository_location& rl (l.repository.load ()->location);
+
+ if (rl.archive_based () && (pl == nullptr || rl.local ()))
{
pl = &l;
- break;
+
+ if (rl.local ())
+ break;
}
}
+ if (pl == nullptr)
+ fail << "package " << n << " " << v
+ << " is not available from an archive-based repository";
+
if (verb > 1)
text << "fetching " << pl->location.leaf () << " "
<< "from " << pl->repository->name;