From d6f50b34977cead4bd1e0bd4fe49e5e5b6f2bdd3 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 25 Nov 2022 21:46:04 +0300 Subject: Add support for package manifest build config group values override --- libbpkg/manifest.hxx | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'libbpkg/manifest.hxx') diff --git a/libbpkg/manifest.hxx b/libbpkg/manifest.hxx index ae2051e..3b75830 100644 --- a/libbpkg/manifest.hxx +++ b/libbpkg/manifest.hxx @@ -1169,7 +1169,11 @@ namespace bpkg butl::small_vector builds; std::vector build_constraints; - std::vector build_configs; + // Note that the parsing constructor adds the implied (empty) default + // configuration at the beginning of the list. Also note that serialize() + // writes no values for such a configuration. + // + butl::small_vector build_configs; // 1 for default. // If true, then this package use the alternative buildfile naming scheme // (build2/, .build2). In the manifest serialization this is encoded as @@ -1283,18 +1287,29 @@ namespace bpkg // // The specified values override the whole groups they belong to, // resetting all the group values prior to being applied. Currently, only - // the following value groups can be overridden: {build-*email} and - // {builds, build-{include,exclude}}. + // the following value groups can be overridden: + // + // {build-*email} + // {builds, build-{include,exclude}} + // {*-builds, *-build-{include,exclude}} // - // Note that the build constraints group values are overridden - // hierarchically so that the build-{include,exclude} overrides don't - // affect the builds values. + // Note that the build constraints group values (both common and build + // config-specific) are overridden hierarchically so that the + // [*-]build-{include,exclude} overrides don't affect the respective + // [*-]builds values. + // + // Also note that the common and build config-specific build constraints + // group value overrides are mutually exclusive. If the common build + // constraints are overridden, then all the build config-specific + // constraints are removed. Otherwise, if some build config-specific + // constraints are overridden, then for the remaining configs the build + // constraints are reset to `builds: none`. // // If a non-empty source name is specified, then the specified values are // assumed to also include the line/column information and the possibly - // thrown manifest_parsing exception will contain the invalid value + // thrown manifest_parsing exception will contain the invalid value's // location information. Otherwise, the exception description will refer - // to the invalid value name instead. + // to the invalid value instead. // void override (const std::vector&, @@ -1302,6 +1317,13 @@ namespace bpkg // Validate the overrides without applying them to any manifest. // + // Specifically, validate that the override values can be parsed according + // to their name semantics and that the value sequence makes sense (no + // mutually exclusive values, etc). Note, however, that the subsequent + // applying of the successfully validated overrides to a specific package + // manifest may still fail (no build config exists for specified *-builds, + // etc). + // static void validate_overrides (const std::vector&, const std::string& source_name); -- cgit v1.1