diff options
| author | Phil Christensen <philc@microsoft.com> | 2019-08-27 11:00:37 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-08-27 11:00:37 -0700 |
| commit | 0eb73051028d5ece1dd837171728fd62c82c1202 (patch) | |
| tree | f9e2d3e41cd2a2b3119b9d148fae21bb653865cb | |
| parent | 693d05fa965b28fded96d0ded7b1cda84189ff48 (diff) | |
| parent | 8bae937e1725a85cb7829ad3113debbeef43674a (diff) | |
| download | vcpkg-0eb73051028d5ece1dd837171728fd62c82c1202.tar.gz vcpkg-0eb73051028d5ece1dd837171728fd62c82c1202.zip | |
[vcpkg] fix list parsing logic and add error messages
fix list parsing logic and add error messages
| -rw-r--r-- | ports/boost/CONTROL | 28 | ||||
| -rw-r--r-- | ports/cpprestsdk/CONTROL | 11 | ||||
| -rw-r--r-- | toolsrc/VERSION.txt | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/parse.cpp | 94 |
4 files changed, 117 insertions, 18 deletions
diff --git a/ports/boost/CONTROL b/ports/boost/CONTROL index 54dfc3c7a..44c44fbf0 100644 --- a/ports/boost/CONTROL +++ b/ports/boost/CONTROL @@ -3,7 +3,33 @@ Source: boost Version: 1.70.0
Homepage: https://boost.org
Description: Peer-reviewed portable C++ source libraries
-Build-Depends: boost-accumulators, boost-algorithm, boost-align, boost-any, boost-array, boost-asio, boost-assert, boost-assign, boost-atomic, boost-beast, boost-bimap, boost-bind, boost-callable-traits, boost-chrono, boost-circular-buffer, boost-compatibility, boost-compute, boost-concept-check, boost-config, boost-container, boost-container-hash, boost-context (!uwp), boost-contract (!arm), boost-conversion, boost-convert, boost-core, boost-coroutine (!uwp), boost-coroutine2, boost-crc, boost-date-time, boost-detail, boost-disjoint-sets, boost-dll, boost-dynamic-bitset, boost-endian, boost-exception, boost-fiber (windows), boost-filesystem (!uwp), boost-flyweight, boost-foreach, boost-format, boost-function, boost-functional, boost-function-types, boost-fusion, boost-geometry, boost-gil, boost-graph, boost-graph-parallel, boost-hana, boost-heap, boost-histogram, boost-hof, boost-icl, boost-integer, boost-interprocess, boost-intrusive, boost-io, boost-iostreams (!uwp), boost-iterator, boost-lambda, boost-lexical-cast, boost-locale (!uwp), boost-local-function, boost-lockfree, boost-log (!uwp), boost-logic, boost-math, boost-metaparse, boost-move, boost-mp11, boost-mpl, boost-msm, boost-multiprecision, boost-multi-array, boost-multi-index, boost-numeric-conversion, boost-interval, boost-odeint, boost-ublas, boost-safe-numerics, boost-optional, boost-outcome, boost-parameter, boost-parameter-python (windows), boost-phoenix, boost-polygon, boost-poly-collection, boost-pool, boost-predef, boost-preprocessor, boost-process, boost-program-options, boost-property-map, boost-property-tree, boost-proto, boost-ptr-container, boost-python (windows), boost-qvm, boost-random, boost-range, boost-ratio, boost-rational, boost-regex, boost-numeric-conversion, boost-interval, boost-odeint, boost-ublas, boost-safe-numerics, boost-scope-exit, boost-serialization, boost-signals2, boost-smart-ptr, boost-sort, boost-spirit, boost-stacktrace (!uwp), boost-statechart, boost-static-assert, boost-system, boost-test (!uwp), boost-thread (!arm), boost-throw-exception, boost-timer, boost-tokenizer, boost-tti, boost-tuple, boost-typeof, boost-type-erasure (!arm), boost-type-index, boost-type-traits, boost-units, boost-unordered, boost-utility, boost-uuid, boost-variant, boost-vmd, boost-wave (!uwp), boost-winapi, boost-xpressive, boost-yap
+Build-Depends: boost-accumulators, boost-algorithm, boost-align, boost-any, boost-array,
+ boost-asio, boost-assert, boost-assign, boost-atomic, boost-beast, boost-bimap, boost-bind,
+ boost-callable-traits, boost-chrono, boost-circular-buffer, boost-compatibility,
+ boost-compute, boost-concept-check, boost-config, boost-container, boost-container-hash,
+ boost-context (!uwp), boost-contract (!arm), boost-conversion, boost-convert, boost-core,
+ boost-coroutine (!uwp), boost-coroutine2, boost-crc, boost-date-time, boost-detail,
+ boost-disjoint-sets, boost-dll, boost-dynamic-bitset, boost-endian, boost-exception,
+ boost-fiber (windows), boost-filesystem (!uwp), boost-flyweight, boost-foreach, boost-format,
+ boost-function, boost-functional, boost-function-types, boost-fusion, boost-geometry,
+ boost-gil, boost-graph, boost-graph-parallel, boost-hana, boost-heap, boost-histogram,
+ boost-hof, boost-icl, boost-integer, boost-interprocess, boost-intrusive, boost-io,
+ boost-iostreams (!uwp), boost-iterator, boost-lambda, boost-lexical-cast, boost-locale (!uwp),
+ boost-local-function, boost-lockfree, boost-log (!uwp), boost-logic, boost-math,
+ boost-metaparse, boost-move, boost-mp11, boost-mpl, boost-msm, boost-multiprecision,
+ boost-multi-array, boost-multi-index, boost-numeric-conversion, boost-interval, boost-odeint,
+ boost-ublas, boost-safe-numerics, boost-optional, boost-outcome, boost-parameter,
+ boost-parameter-python (windows), boost-phoenix, boost-polygon, boost-poly-collection,
+ boost-pool, boost-predef, boost-preprocessor, boost-process, boost-program-options,
+ boost-property-map, boost-property-tree, boost-proto, boost-ptr-container,
+ boost-python (windows), boost-qvm, boost-random, boost-range, boost-ratio, boost-rational,
+ boost-regex, boost-numeric-conversion, boost-interval, boost-odeint, boost-ublas,
+ boost-safe-numerics, boost-scope-exit, boost-serialization, boost-signals2, boost-smart-ptr,
+ boost-sort, boost-spirit, boost-stacktrace (!uwp), boost-statechart, boost-static-assert,
+ boost-system, boost-test (!uwp), boost-thread (!arm), boost-throw-exception, boost-timer,
+ boost-tokenizer, boost-tti, boost-tuple, boost-typeof, boost-type-erasure (!arm),
+ boost-type-index, boost-type-traits, boost-units, boost-unordered, boost-utility, boost-uuid,
+ boost-variant, boost-vmd, boost-wave (!uwp), boost-winapi, boost-xpressive, boost-yap
Feature: mpi
Description: Build with MPI support
diff --git a/ports/cpprestsdk/CONTROL b/ports/cpprestsdk/CONTROL index 877164673..6f6a2a307 100644 --- a/ports/cpprestsdk/CONTROL +++ b/ports/cpprestsdk/CONTROL @@ -1,13 +1,16 @@ Source: cpprestsdk Version: 2.10.14-1 -Build-Depends: openssl (!uwp&!windows), boost-system (!uwp&!windows), boost-date-time (!uwp&!windows), boost-regex (!uwp&!windows), boost-thread (!uwp&!windows), boost-filesystem (!uwp&!windows), boost-random (!uwp&!windows), boost-chrono (!uwp&!windows), boost-asio (!uwp&!windows) +Build-Depends: openssl (!uwp&!windows), boost-system (!uwp&!windows), + boost-date-time (!uwp&!windows), boost-regex (!uwp&!windows), boost-thread (!uwp&!windows), + boost-filesystem (!uwp&!windows), boost-random (!uwp&!windows), boost-chrono (!uwp&!windows), + boost-asio (!uwp&!windows) Homepage: https://github.com/Microsoft/cpprestsdk Description: C++11 JSON, REST, and OAuth library The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services. Default-Features: default-features Feature: default-features -Build-Depends: cpprestsdk[brotli] (windows), cpprestsdk[core], cpprestsdk[compression], cpprestsdk[websockets] +Build-Depends: cpprestsdk[brotli] (windows), cpprestsdk[core,compression,websockets] Description: Features installed by default Feature: compression @@ -15,9 +18,9 @@ Build-Depends: zlib Description: HTTP Compression support Feature: websockets -Build-Depends: cpprestsdk[core], cpprestsdk[compression], websocketpp (!uwp), openssl (!uwp), boost-system (!uwp), boost-date-time (!uwp), boost-regex (!uwp) +Build-Depends: cpprestsdk[core,compression], websocketpp (!uwp), openssl (!uwp), boost-system (!uwp), boost-date-time (!uwp), boost-regex (!uwp) Description: Websockets support Feature: brotli -Build-Depends: cpprestsdk[core], cpprestsdk[compression], brotli +Build-Depends: cpprestsdk[core,compression], brotli Description: Brotli compression support diff --git a/toolsrc/VERSION.txt b/toolsrc/VERSION.txt index 43464a247..66247baf7 100644 --- a/toolsrc/VERSION.txt +++ b/toolsrc/VERSION.txt @@ -1 +1 @@ -"2019.08.16" +"2019.08.23" diff --git a/toolsrc/src/vcpkg/parse.cpp b/toolsrc/src/vcpkg/parse.cpp index 0509339c5..6015d9927 100644 --- a/toolsrc/src/vcpkg/parse.cpp +++ b/toolsrc/src/vcpkg/parse.cpp @@ -2,6 +2,7 @@ #include <vcpkg/parse.h> +#include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> namespace vcpkg::Parse @@ -44,6 +45,8 @@ namespace vcpkg::Parse return nullptr; } + static bool is_whitespace(char c) { return c == ' ' || c == '\t' || c == '\n' || c == '\r'; } + std::vector<std::string> parse_comma_list(const std::string& str) { if (str.empty()) @@ -53,26 +56,93 @@ namespace vcpkg::Parse std::vector<std::string> out; - size_t cur = 0; + auto iter = str.cbegin(); + do { - auto pos = str.find(',', cur); - if (pos == std::string::npos) + // Trim leading whitespace of each element + while (iter != str.cend() && is_whitespace(*iter)) + { + ++iter; + } + + // Allow commas inside of []. + bool bracket_nesting = false; + + auto element_begin = iter; + auto element_end = iter; + while (iter != str.cend() && (*iter != ',' || bracket_nesting)) + { + char value = *iter; + + // do not support nested [] + if (value == '[') + { + if (bracket_nesting) + { + Checks::exit_with_message(VCPKG_LINE_INFO, + "Lists do not support nested brackets, Did you forget a ']'?\n" + "> '%s'\n" + "> %s^\n", + str, + std::string(static_cast<int>(iter - str.cbegin()), ' ')); + } + bracket_nesting = true; + } + else if (value == ']') + { + if (!bracket_nesting) + { + Checks::exit_with_message(VCPKG_LINE_INFO, + "Found unmatched ']'. Did you forget a '['?\n" + "> '%s'\n" + "> %s^\n", + str, + std::string(static_cast<int>(iter - str.cbegin()), ' ')); + } + bracket_nesting = false; + } + + ++iter; + + // Trim ending whitespace + if (!is_whitespace(value)) + { + // Update element_end after iter is incremented so it will be one past. + element_end = iter; + } + } + + if (element_begin == element_end) { - out.push_back(str.substr(cur)); - break; + Checks::exit_with_message(VCPKG_LINE_INFO, + "Empty element in list\n" + "> '%s'\n" + "> %s^\n", + str, + std::string(static_cast<int>(element_begin - str.cbegin()), ' ')); } - out.push_back(str.substr(cur, pos - cur)); + out.push_back({element_begin, element_end}); - // skip comma and space - ++pos; - while (str[pos] == ' ') + if (iter != str.cend()) { - ++pos; + Checks::check_exit(VCPKG_LINE_INFO, *iter == ',', "Internal parsing error - expected comma"); + + // Not at the end, must be at a comma that needs to be stepped over + ++iter; + + if (iter == str.end()) + { + Checks::exit_with_message(VCPKG_LINE_INFO, + "Empty element in list\n" + "> '%s'\n" + "> %s^\n", + str, + std::string(str.length(), ' ')); + } } - cur = pos; - } while (cur != std::string::npos); + } while (iter != str.cend()); return out; } |
