aboutsummaryrefslogtreecommitdiff
path: root/bpkg
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-01-10 03:08:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-11 16:43:14 +0200
commitc9be77204a96b7ccf3c0e4c3d25e7c268810c3ad (patch)
tree09a6dd754fd1ae740d35ad94c475b441b6f3b55b /bpkg
parent45a4174d5269661cfbd46e56acbbdc6551c6fbe2 (diff)
Support new revision of repository name specification, /pkg/ stripping
Diffstat (limited to 'bpkg')
-rw-r--r--bpkg/manifest.cxx17
1 files changed, 16 insertions, 1 deletions
diff --git a/bpkg/manifest.cxx b/bpkg/manifest.cxx
index ac746e6..7f847a3 100644
--- a/bpkg/manifest.cxx
+++ b/bpkg/manifest.cxx
@@ -1407,7 +1407,10 @@ namespace bpkg
// Finish calculating the canonical name, unless we are relative.
//
if (relative ())
+ {
+ assert (canonical_name_.empty ());
return;
+ }
// Search for the version path component preceeding canonical name
// <path> component.
@@ -1432,9 +1435,21 @@ namespace bpkg
if (stoul (*i) != 1)
throw invalid_argument ("unsupported repository version");
+ dir_path p (rb, i); // Canonical name path part.
+
+ // Prefix ends with "pkg" component.
+ //
+ bool pc (++i != re && (*i == "pkg" || *i == "bpkg"));
+
+ if (pc)
+ ++i; // Skip "pkg" component from prefix.
+
+ if (!host_.empty () || !pc)
+ p = dir_path (i, re) / p; // Concatenate prefix and path.
+
// Note: allow empty paths (e.g., http://stable.cppget.org/1/).
//
- string d (dir_path (rb, i).posix_string ());
+ string d (p.posix_string ());
if (!canonical_name_.empty () && !d.empty ()) // If we have host and dir.
canonical_name_ += '/';