From 4e96df0f801ac0edc843a35fe4c6de3fb6ca2fb4 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 3 Mar 2018 11:17:11 +0200 Subject: Support package scheme in @ --- bpkg/pkg-build.cxx | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 34d1023..f580858 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -1078,11 +1078,18 @@ namespace bpkg // of if that's the case and string::npos otherwise. // // Note that we consider '@' to be such a delimiter only if it comes - // before ':' (think a URL which could contain its own '@'). + // before "://" (think a URL which could contain its own '@'). // auto location = [] (const string& arg) -> size_t { - size_t p (arg.find_first_of ("@:")); + size_t p (0); + + // Skip leading ':' that are not part of "://". + // + while ((p = arg.find_first_of ("@:", p)) != string::npos && + arg[p] == ':' && + arg.compare (p + 1, 2, "//") != 0) + ++p; if (p != string::npos) { @@ -1207,7 +1214,12 @@ namespace bpkg // p = ps.find (',', b); - string s (ps, b, p != string::npos ? p - b : p); + string pkg (ps, b, p != string::npos ? p - b : p); + const char* s (pkg.c_str ()); + + // @@ Shouldn't we skip version selection for sys packages? + // + parse_package_scheme (s); string n (parse_package_name (s)); version v (parse_package_version (s)); @@ -1223,15 +1235,15 @@ namespace bpkg if (ap == nullptr) { diag_record dr (fail); - dr << "package " << s << " is not found in " << r->name; + dr << "package " << pkg << " is not found in " << r->name; if (!r->complements.empty ()) dr << " or its complements"; } - // Add the package/version to the argument list. + // Add the [scheme:]package/version to the argument list. // - eargs.push_back (ap->id.name + '/' + ap->version.string ()); + eargs.push_back (pkg + '/' + ap->version.string ()); b = p != string::npos ? p + 1 : p; } -- cgit v1.1