aboutsummaryrefslogtreecommitdiff
path: root/bpkg/pkg-fetch.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-10-05 08:45:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-10-05 08:45:27 +0200
commitb83a9bbdb0407c198e615e61491e1f8492ae5dc9 (patch)
treece421f55b5b1aa020c6edc3caefc321bbca44157 /bpkg/pkg-fetch.cxx
parent5ae8a9214da9285aa6e7e374288eaf9adc1ba862 (diff)
Add repository location to package, minor cleanups
Diffstat (limited to 'bpkg/pkg-fetch.cxx')
-rw-r--r--bpkg/pkg-fetch.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/bpkg/pkg-fetch.cxx b/bpkg/pkg-fetch.cxx
index ca2bada..b1e5253 100644
--- a/bpkg/pkg-fetch.cxx
+++ b/bpkg/pkg-fetch.cxx
@@ -37,6 +37,7 @@ namespace bpkg
path a;
auto_rm arm;
bool purge;
+ repository_location rl;
if (o.existing ())
{
@@ -50,6 +51,11 @@ namespace bpkg
fail << "archive file '" << a << "' does not exist";
purge = o.purge ();
+
+ // Use the special root repository as the repository of this
+ // package.
+ //
+ rl = repository_location ();
}
else
{
@@ -79,7 +85,8 @@ namespace bpkg
if (p == nullptr)
fail << "package " << n << " " << v << " is not available";
- // Pick a repository. Prefer local ones over the remote.
+ // Pick a repository. Preferring local ones over the remote seems
+ // like a sensible thing to do.
//
const package_location* pl (&p->locations.front ());
@@ -96,7 +103,8 @@ namespace bpkg
text << "fetching " << pl->location.leaf () << " "
<< "from " << pl->repository->name;
- a = fetch_archive (o, pl->repository->location, pl->location, c);
+ rl = pl->repository->location;
+ a = fetch_archive (o, rl, pl->location, c);
arm = auto_rm (a);
purge = true;
}
@@ -132,6 +140,7 @@ namespace bpkg
move (m.name),
move (m.version),
state::fetched,
+ move (rl),
move (a),
purge,
nullopt, // No source directory yet.