diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2021-04-16 22:04:22 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-04-19 18:35:30 +0300 |
commit | f0c4ddcc96ae4eea5e158359bc21f51c3261bdd2 (patch) | |
tree | f2d12cb67395a4be2053379958b94d8ec6d333d9 /bpkg/pkg-build.cxx | |
parent | e4c22fd4b9ba9782acd0c0a10866cbeaf8be694d (diff) |
Match package spec local repository locations in pkg-build case-insensitively on Windows
Diffstat (limited to 'bpkg/pkg-build.cxx')
-rw-r--r-- | bpkg/pkg-build.cxx | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/bpkg/pkg-build.cxx b/bpkg/pkg-build.cxx index 9d9b384..082696e 100644 --- a/bpkg/pkg-build.cxx +++ b/bpkg/pkg-build.cxx @@ -2620,17 +2620,38 @@ namespace bpkg { using query = query<repository>; - auto q (db.query<repository> (query::location.url == l)); - auto i (q.begin ()); + // For case-insensitive filesystems (Windows) we need to match the + // location case-insensitively against the local repository URLs + // and case-sensitively against the remote ones. + // + // Note that the root repository will never be matched, since its + // location is empty. + // + const auto& url (query::location.url); + +#ifndef _WIN32 + query q (url == l); +#else + string u (url.table ()); + u += '.'; + u += url.column (); + + query q ( + (!query::local && url == l) || + ( query::local && u + " COLLATE nocase = " + query::_val (l))); +#endif + + auto rs (db.query<repository> (q)); + auto i (rs.begin ()); - if (i != q.end ()) + if (i != rs.end ()) { r = i.load (); // Fallback to parsing the location if several repositories // match. // - if (++i != q.end ()) + if (++i != rs.end ()) r = nullptr; } } |