From 89dd478de7cf075beac69d0145df46f914cf35cf Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Mon, 19 Feb 2018 21:47:04 +0300 Subject: Add support for pkg-checkout --- bpkg/pkg-fetch.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'bpkg/pkg-fetch.cxx') 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; -- cgit v1.1