From 9f93b7a33f484b4ccdec2a47748f27338c99afbe Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 8 Mar 2024 18:54:16 +0300 Subject: Add support for build-auxiliary manifest value overrides in bdep-ci --- bdep/ci.cli | 23 ++++++++++++++-------- bdep/ci.cxx | 55 ++++++++++++++++++++++++++++++++++------------------- tests/ci.testscript | 17 +++++++++++++++++ 3 files changed, 67 insertions(+), 28 deletions(-) diff --git a/bdep/ci.cli b/bdep/ci.cli index 5ffcd2f..77d29cd 100644 --- a/bdep/ci.cli +++ b/bdep/ci.cli @@ -75,10 +75,15 @@ namespace bdep $ bdep ci --override 'mytest-build-config: config.foo.cache=true' \ --package-config mytest + + $ bdep ci --override 'build-auxiliary: *-postgresql_16' \ - Manifest overrides override the entire value group that they belong - to. Currently, the following value groups can be overridden. The + Manifest overrides other than \c{[\b{*-}]\b{build-auxiliary}[\b{-*}]} + override the entire value group that they belong to. The + \c{[\b{*-}]\b{build-auxiliary}[\b{-*}]} values only override the matching + values, which are expected to already be present in the package manifest. + Currently, the following value groups/values can be overridden. The \cb{build-*email} group is overridden by default as if by specifying an empty build email. @@ -88,16 +93,18 @@ namespace bdep *-builds *-build-{include,exclude} *-build-config *-build-email *-build-{warning,error}-email + + [*-]build-auxiliary[-*] \ - For the package configuration-specific build constraint and email - overrides the corresponding configuration must exist in the package - manifest. In contrast, the package configuration override + For the package configuration-specific build constraint, email, and + auxiliary overrides, the corresponding configuration must exist in the + package manifest. In contrast, the package configuration override (\cb{*-build-config}) adds a new configuration if it doesn't exist and updates the arguments of the existing configuration otherwise. In the - former case, all the potential build constraint and email overrides for - such a newly added configuration must follow the corresponding - \cb{*-build-config} override. + former case, all the potential build constraint, email, and auxiliary + overrides for such a newly added configuration must follow the + corresponding \cb{*-build-config} override. Note that the build constraints group values (both common and build package configuration-specific) are overridden hierarchically so that the diff --git a/bdep/ci.cxx b/bdep/ci.cxx index 74cfd7a..f97f0cb 100644 --- a/bdep/ci.cxx +++ b/bdep/ci.cxx @@ -194,9 +194,9 @@ namespace bdep // package manifest values and is semantically correct. // // Note that if we end up with any build package configuration-specific - // overrides, then we will need to verify the overrides using the package - // manifests to make sure that the specified build configurations are - // valid for the specified packages. + // overrides or any [*-]build-auxiliary[-*] overrides, then we will need + // to verify the overrides using the package manifests to make sure that + // these overrides are valid for the specified packages. // vector overrides; @@ -226,6 +226,7 @@ namespace bdep o.interactive ().find ('/') != string::npos)); bool build_email_ovr (false); + bool aux_ovr (false); if (o.overrides_specified ()) { @@ -263,17 +264,30 @@ namespace bdep info << "override: " << n << ": " << nv.value; } - if (n == "build-email" || - n == "build-warning-email" || - n == "build-error-email" || - (n.size () > 12 && - n.compare (n.size () - 12, 12, "-build-email") == 0) || - (n.size () > 20 && - n.compare (n.size () - 20, 20, "-build-warning-email") == 0) || - (n.size () > 18 && - n.compare (n.size () - 18, 18, "-build-error-email") == 0)) - { + bool eo ( + (n == "build-email" || + n == "build-warning-email" || + n == "build-error-email" || + (n.size () > 12 && + n.compare (n.size () - 12, 12, "-build-email") == 0) || + (n.size () > 20 && + n.compare (n.size () - 20, 20, "-build-warning-email") == 0) || + (n.size () > 18 && + n.compare (n.size () - 18, 18, "-build-error-email") == 0))); + + if (eo) build_email_ovr = true; + + if (!pco && !eo) + { + if (optional> an = + bpkg::build_auxiliary::parse_value_name (n)) + { + aux_ovr = true; + + if (!an->first.empty ()) + pkg_config_ovr = true; + } } } @@ -492,14 +506,14 @@ namespace bdep } } - // If there are any build package configuration-specific overrides, then - // load the package manifests to use them later for validation of the - // complete override list. Note that we also need these manifests for - // producing the --package-config overrides. + // If there are any build package configuration-specific overrides or any + // build auxiliary overrides, then load the package manifests to use them + // later for validation of the complete override list. Note that we also + // need these manifests for producing the --package-config overrides. // vector override_manifests; - if (pkg_config_ovr) + if (pkg_config_ovr || aux_ovr) { override_manifests.reserve (pkgs.size ()); @@ -809,8 +823,9 @@ namespace bdep }; // If the package manifests are loaded (which happens if there are any - // build package configuration-specific overrides), then override them - // all. Otherwise, use package_manifest::validate_overrides(). + // build package configuration-specific or build auxiliary overrides), + // then override them all. Otherwise, use + // package_manifest::validate_overrides(). // // Specify the name argument for the override validation call to make // sure the origin/value information (saved into the values' diff --git a/tests/ci.testscript b/tests/ci.testscript index 9b365d3..abe6021 100644 --- a/tests/ci.testscript +++ b/tests/ci.testscript @@ -32,6 +32,7 @@ end EOI +cat <+prj/manifest + build-auxiliary: *-postgresql_* network-build-config: config.prj.network=true EOI @@ -278,6 +279,22 @@ windows = ($cxx.target.class == 'windows') EOE } + : build-auxiliary + : + { + $clone_prj; + + $* --override 'build-auxiliary: *-postgresql_16' 2>>~%EOE%; + %CI request is queued.*% + %reference: .+% + EOE + + $* --override 'build-auxiliary-pgsql: *-postgresql_16' 2>>EOE != 0 + error: invalid --override option value: no match for 'build-auxiliary-pgsql' value override + info: override: build-auxiliary-pgsql: *-postgresql_16 + EOE + } + : invalid-option : { -- cgit v1.1