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

support-expressions: Add support expressions to features. Error when supports expression evaluates to false in classic and manifest mode. #184

Merged
merged 4 commits into from
Sep 27, 2021

Conversation

autoantwort
Copy link
Contributor

@autoantwort autoantwort commented Sep 5, 2021

@autoantwort autoantwort force-pushed the check-supports-expressions branch 6 times, most recently from cace755 to 617ae0e Compare September 7, 2021 12:05
Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, I love this change; this would make my experience using vcpkg so much better.

However, I think there needs to be an escape hatch; some kind of "please ignore supports expressions for this install". Additionally, I think it's very likely that we should start by printing warnings instead of errors, since otherwise we will cause breakage on people installing over-constrained packages.

So far, though, this looks amazing. Thank you so much for your work here @autoantwort!

@autoantwort
Copy link
Contributor Author

Additionally, I think it's very likely that we should start by printing warnings instead of errors, since otherwise we will cause breakage on people installing over-constrained packages.

I have checked some random ports, and the supports expression was almost always back upped by a vcpkg_fail_port_install(...) call in the portfile.cmake. So instead of only printing a warning I would prefer to fix the support expressions of the few ports where it is only used to disable the ci build.

But an additional option is needed to disable the failure.

@autoantwort
Copy link
Contributor Author

I have added such an option now

Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@BillyONeal
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only extreme nits here.

Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I misclicked...

@autoantwort autoantwort force-pushed the check-supports-expressions branch from 39fde2c to f1812a8 Compare September 24, 2021 09:16
@autoantwort
Copy link
Contributor Author

I assume a approval from @ras0219-msft is also needed?

@strega-nil-ms
Copy link
Contributor

Given two yesses, merging now. Thanks @autoantwort :D

@strega-nil-ms strega-nil-ms merged commit baf0eec into microsoft:main Sep 27, 2021
@wrobelda
Copy link
Contributor

wrobelda commented Oct 29, 2021

@autoantwort Is this actually supposed to work? Cause I added a supports element to a feature and am getting:

$ ./vcpkg x-add-version --overwrite-version --all 
Error: The port `libical` is not properly formatted.

While ./vcpkg format-manifest ports/port/vcpkg.json simply removes the supports line.

It gets more explicit when using main:

$ ./vcpkg format-manifest ports/port/vcpkg.json
Failed to parse manifest file: /Users/cromo/Documents/Sourcecode/vcpkg/ports/libical/vcpkg.json
Errors occurred while parsing /Users/cromo/Documents/Sourcecode/vcpkg/ports/libical/vcpkg.json
    $.features.rscale (a feature): unexpected field 'supports', did you mean 'description'?

@autoantwort
Copy link
Contributor Author

Yes, but this tool version is currently not in the vcpkg repo, only after microsoft/vcpkg#20838

@wrobelda
Copy link
Contributor

Yes, but this tool version is currently not in the vcpkg repo, only after microsoft/vcpkg#20838

I compiled vcpkg tool myself, using both main and 2021-10-18 tag, which is when this was released. What am I missing?

@autoantwort
Copy link
Contributor Author

Maybe you are missing a git pull. I can add supports expressions to features and it is definitively working

@autoantwort
Copy link
Contributor Author

While ./vcpkg format-manifest ports/port/vcpkg.json simply removes the supports line.

But this seems to be a bug

@autoantwort
Copy link
Contributor Author

While ./vcpkg format-manifest ports/port/vcpkg.json simply removes the supports line.

But this seems to be a bug

Would be fixed by #240

if (!supports_expression.get()->evaluate(
m_var_provider.get_dep_info_vars(spec.spec()).value_or_exit(VCPKG_LINE_INFO)))
{
const auto msg = Strings::format("%s[%s] is only supported on '%s'",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I strongly against this changes!
Since our document does not specify whether to use a whitelist or a blacklist for the supports field, this modification will cause many ports to fail to build on the community triplet.
Please note that this field is only used for pipeline test to judge whether the result is reasonable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support expressions supports black and whitelists. For example !windows is a blacklist while osx & linux is a whitelist. But yeah we should suggest using blacklists to not fail on community triplets unless we know that a port really only works the given set of triplets.

Please note that this field is only used for pipeline test to judge whether the result is reasonable.

Until this PR. Now it can replaces vcpkg_fail_port_install calls to get a better user experience. You don't have to build all dependencies to see that the port does not support your triplet.
If a port is generally supported by a triplet but our ci don't want to build it, you should use ci.baseline.txt because the port in general supports the triplet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please note that this field is only used for pipeline test to judge whether the result is reasonable.

The intent is that ci.baseline.txt is the 'specific to our pipelines' thing, while supports reflects behavior from the upstream sources.

Copy link
Contributor

@JackBoosY JackBoosY Nov 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Therefore, I suggest changes this error to warning message unless we convert all whitelist to blacklist.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also breaks option --only-downloads and --keep-going.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this doesn't exists in the usage info.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this doesn't exists in the usage info.

I don't understand that point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand that point.

This option should be printed in the usage info if we need to add it:

PS F:\vcpkg> .\vcpkg.exe depend-info vtk[*] --allow-unsupported
Unknown option(s) for command 'depend-info':
    '--allow-unsupported'

Example:
  vcpkg depend-info sqlite3

Options:
  --dot                           Creates graph on basis of dot
  --dgml                          Creates graph on basis of dgml
  --show-depth                    Show recursion depth in output
  --max-recurse=...               Set max recursion depth, a value of -1 indicates no limit
  --sort=...                      Set sort order for the list of dependencies, accepted values are:
                                  lexicographical, topological (default), reverse
  --triplet=<t>                   Specify the target architecture triplet. See 'vcpkg help triplet'
                                  (default: %VCPKG_DEFAULT_TRIPLET%)
  --host-triplet=<t>              Specify the host architecture triplet. See 'vcpkg help triplet'
                                  (default: %VCPKG_DEFAULT_HOST_TRIPLET%)
  --overlay-ports=<path>          Specify directories to be used when searching for ports
                                  (also: %VCPKG_OVERLAY_PORTS%)
  --overlay-triplets=<path>       Specify directories containing triplets files
                                  (also: %VCPKG_OVERLAY_TRIPLETS%)
  --binarysource=<path>           Add sources for binary caching. See 'vcpkg help binarycaching'
  --x-asset-sources=<path>        Add sources for asset caching. See 'vcpkg help assetcaching'
  --downloads-root=<path>         Specify the downloads root directory
                                  (default: %VCPKG_DOWNLOADS%)
  --vcpkg-root=<path>             Specify the vcpkg root directory
                                  (default: %VCPKG_ROOT%)
  --x-buildtrees-root=<path>      (Experimental) Specify the buildtrees root directory
  --x-install-root=<path>         (Experimental) Specify the install root directory
  --x-packages-root=<path>        (Experimental) Specify the packages root directory
  --x-json                        (Experimental) Request JSON output

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix this in #300.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another issue: microsoft/vcpkg#22278

@BillyONeal
Copy link
Member

  • s/blacklist/denylist/g
  • s/whitelist/allowlist/g

@autoantwort autoantwort deleted the check-supports-expressions branch November 7, 2021 19:43
@wrobelda
Copy link
Contributor

wrobelda commented Nov 17, 2021

@autoantwort I think there's some issue with it in CI/CD. Specifically, in microsoft/vcpkg#21491 I added:

"features": {
     "libmount": {
       "description": "Used by the UDisks backend on Linux",
       "supports": "linux",
       "dependencies": [
         "libmount"
       ]
     }
   }

However, it appears that because of it the Windows CI/CD now skips the kf5solid build altogether, apparently since libmount is only available on Linux:
https://dev.azure.com/vcpkg/public/_build/results?buildId=63246&view=logs&jobId=7922e5c4-0103-5f8f-ad17-45ce9bb98e80&j=7922e5c4-0103-5f8f-ad17-45ce9bb98e80&t=491b9f02-7edc-5990-cda1-511e95a3768e

@dg0yt
Copy link
Contributor

dg0yt commented Nov 17, 2021

No e2e test for this?

@wrobelda
Copy link
Contributor

IMHO dependencies' features should be enabled only on systems that support it.

@dg0yt
Copy link
Contributor

dg0yt commented Nov 17, 2021

However, it appears that because of it the Windows CI/CD now skips the kf5solid build altogether, apparently since libmount is only available on Linux:

Note that the skip is not because libmount is part of the default features of kf5solid, but because libmount is part of the features requested by depending port kf5io, unconditionally.

@ras0219-msft
Copy link
Contributor

Which means the immediate fix is to add a supports clause to kf5io; but this is definitely tricky to detect reliably and we need some better diagnostics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Confusion about supports field in features
7 participants