Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix list parsing logic and add error messages #7863

Merged
merged 6 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion ports/boost/CONTROL
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 7 additions & 4 deletions ports/cpprestsdk/CONTROL
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
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
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
2 changes: 1 addition & 1 deletion toolsrc/VERSION.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"2019.08.16"
"2019.08.23"
94 changes: 82 additions & 12 deletions toolsrc/src/vcpkg/parse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <vcpkg/parse.h>

#include <vcpkg/base/system.print.h>
#include <vcpkg/base/util.h>

namespace vcpkg::Parse
Expand Down Expand Up @@ -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())
Expand All @@ -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;
}
Expand Down