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

pass VERSION to cmake when building port #717

Merged
merged 3 commits into from
Oct 10, 2022

Conversation

autoantwort
Copy link
Contributor

@autoantwort autoantwort commented Sep 26, 2022

This is a frequently requested feature. With this one can use the ${PORT_VERSION} variable inside portfile.cmake to get the currents port version.

@vicroms
Copy link
Member

vicroms commented Sep 26, 2022

What's the purpose of having port version available in portfile.cmake? It should be irrelevant in all internal port logic.

@Neumann-A
Copy link
Contributor

It should be irrelevant in all internal port logic.

Maybe you should grep through all portfile.cmake files for the string VERSION

@autoantwort
Copy link
Contributor Author

autoantwort commented Sep 26, 2022

For example https://github.com/microsoft/vcpkg/blob/86cab7438f79f6b0f60fc83f421993534ad333ee/ports/libbson/portfile.cmake#L22-L24

or things like
https://github.com/microsoft/vcpkg/blob/master/ports/webview2/portfile.cmake#L5-L18

There are hundreds of other examples where the port version is repeated in the portfile.cmake

@BillyONeal
Copy link
Member

It should be irrelevant in all internal port logic.

Maybe you should grep through all portfile.cmake files for the string VERSION

Generally speaking, someone asking to make a change needs to motivate making the change, not expect readers to do archeology to figure it out. The original statement says "frequently requested feature" without enumerating any such request, and neither I (nor apparently Victor) have seen such a request before.

For example https://github.com/microsoft/vcpkg/blob/86cab7438f79f6b0f60fc83f421993534ad333ee/ports/libbson/portfile.cmake#L22-L24

Hmm, this is extracting "version", not "port version"? Oh...

There are hundreds of other examples where the port version is repeated in the portfile.cmake

I'm not sure I agree with attempting to replace all such occurrences with an injected variable though; in fact I see people frequently do things like

  • make a variable named version
  • form a URI expanding that variable

or similar which I'm not personally a big fan of. It makes it easier to miss SHA updates, and can produce URIs that aren't what upstream is looking for for whatever their new version is. But this is a personal opinion, not a team policy, so I've not made CR comments about it either way.

For a 'should we do this' statement, I'm neutral. It is indeed something that people are doing, but they're often doing so in service of a pattern of which I'm not a huge fan.

As for the detail of this particular implementation:

  • There should be e2e tests added for version, version-string, version-date, and version-semver that make use of this. I'm 99% sure the change is correct but I would be a lot happier with tests that prove it.
  • I think we need to bikeshed the name a bit because port version already has another meaning. How about one of these:
    • VCPKG_BUILDING_VERSION
    • VERSION (note that we already have PORT so there's precedent for no prefix)
    • VCPKG_JSON_VERSION (somewhat of a misnomer if the port uses a CONTROL file but close enough for me)
    • VCPKG_JSON_VERSION / VCPKG_JSON_VERSION_DATE / VCPKG_JSON_VERSION_SEMVER / VCPKG_JSON_VERSION_STRING (Included for completeness 😄 )
  • We should make sure that we have intentional answers as to whether this variable means anything to vcpkg create (or other things that call ports.cmake).

@Neumann-A
Copy link
Contributor

archaeology: microsoft/vcpkg#17908
This has been requested before vcpkg.json was around ..... today we could simply implement a script function via string(JSON) to read the version string.
In general it is to avoid version mismatches between manifest and portfile.

it easier to miss SHA updates,

move SHA into manifest? (I would like that since portfile changes are for simple ports often not necessary.)

@Osyotr
Copy link

Osyotr commented Sep 27, 2022

move SHA into manifest

I wonder if it's possible to fetch file hash from github. That would make simple ports even more simple!

@BillyONeal
Copy link
Member

move SHA into manifest? (I would like that since portfile changes are for simple ports often not necessary.)

We certainly would like to move vcpkg_from_Xxx things into some form of declaration in the manifest instead so that we can offer better download batching and features like

I wonder if it's possible to fetch file hash from github. That would make simple ports even more simple!

... but that hasn't made it above the cut line yet :(

@dg0yt
Copy link
Contributor

dg0yt commented Sep 28, 2022

I wonder if it's possible to fetch file hash from github. That would make simple ports even more simple!

This only makes sense for the maintainer who does the port update. The user must be able to operate in disconnected mode, with pre-fetched asset.

@autoantwort
Copy link
Contributor Author

move SHA into manifest? (I would like that since portfile changes are for simple ports often not necessary.)

We certainly would like to move vcpkg_from_Xxx things into some form of declaration in the manifest instead so that we can offer better download batching and features like

I wonder if it's possible to fetch file hash from github. That would make simple ports even more simple!

... but that hasn't made it above the cut line yet :(

What about microsoft/vcpkg#24199 (comment)? I would implement it, but feedback would be nice.

@Neumann-A
Copy link
Contributor

I would implement it, but feedback would be nice.

I would rather like to see the options rfc being implemented ;) But be aware that downloads can also carry patch dependencies i.e. a download of a patch can be used by another download

@vicroms
Copy link
Member

vicroms commented Sep 29, 2022

@ras0219 @dan-shaw @JavierMatosD @BillyONeal @valeriaconde @vicroms

The team has voted and we prefer this be renamed to just VERSION.

We think this won't cause issues with any ports that use VERSION as a variable since they will be resetting it already.

@autoantwort autoantwort changed the title pass PORT_VERSION to cmake when building port pass VERSION to cmake when building port Sep 30, 2022
@BillyONeal
Copy link
Member

What about microsoft/vcpkg#24199 (comment)? I would implement it, but feedback would be nice.

I'm not convinced the ask there is possible. We already have scripts that try to update stuff that get run occasionally (to my understanding), but most of the cleanup steps enumerated there aren't automated because we aren't sure how to do that. Making things more declarative would of course make that easier.

@BillyONeal
Copy link
Member

  • There should be e2e tests added for version, version-string, version-date, and version-semver that make use of this. I'm 99% sure the change is correct but I would be a lot happier with tests that prove it.

Done.

  • I think we need to bikeshed the name a bit because port version already has another meaning.

Done.

  • We should make sure that we have intentional answers as to whether this variable means anything to vcpkg create (or other things that call ports.cmake).

The other thing ports.cmake does is "create" and I think leaving version unset there is fine.

LGTM

@vicroms vicroms merged commit 3221bf0 into microsoft:main Oct 10, 2022
BillyONeal added a commit to BillyONeal/vcpkg that referenced this pull request Nov 1, 2022
…0-17, he started applying use of the "embedded VERSION" feature microsoft/vcpkg-tool#717 to PRs on merge.

@dg0yt points out that this use should be accompanied by a call to vcpkg_minimum_required, in https://github.com/microsoft/vcpkg/pull/27594/files#r1010641672

This is an audit of everything merged in that time and whether it needs to gain that.

microsoft#27561 No VERSION
microsoft#27525 No VERSION
microsoft#27554 Already has vcpkg_minimum_required
microsoft#27536 No VERSION
microsoft#27562 No VERSION
microsoft#24914 Fixed here
microsoft#27547 No VERSION
microsoft#27502 No VERSION
microsoft#27497 No VERSION
microsoft#27317 No VERSION
microsoft#27288 No VERSION
microsoft#27509 No VERSION
microsoft#27504 No VERSION
microsoft#27514 No VERSION
microsoft#27501 No VERSION
microsoft#27495 No VERSION
microsoft#27488 No VERSION
microsoft#27499 No VERSION
microsoft#27378 No VERSION
microsoft#27376 Fixed here
microsoft#27373 No VERSION
microsoft#27045 No VERSION
microsoft#27521 No VERSION
microsoft#27453 No VERSION
microsoft#27481 No VERSION
microsoft#27511 No VERSION
microsoft#27490 No VERSION
microsoft#27510 No VERSION
microsoft#27496 No VERSION
microsoft#27503 No VERSION
microsoft#27485 No VERSION
microsoft#27484 No VERSION
microsoft#27483 No VERSION
microsoft#27459 No VERSION
microsoft#27369 No VERSION
microsoft#27489 No VERSION
microsoft#26594 No VERSION
microsoft#27465 No VERSION
microsoft#27456 No VERSION
microsoft#27425 No VERSION
microsoft#27464 Fixed here
microsoft#27406 No VERSION
microsoft#27398 No VERSION
microsoft#27240 No VERSION
microsoft#27450 No VERSION
microsoft#27463 No VERSION
microsoft#27462 No VERSION
microsoft#27448 No VERSION
microsoft#27440 No VERSION
microsoft#27435 No VERSION
microsoft#27424 No VERSION
microsoft#27414 No VERSION
microsoft#27412 No VERSION
microsoft#27380 No VERSION
microsoft#27343 No VERSION
microsoft#27342 No VERSION
microsoft#27367 No VERSION
microsoft#27226 No VERSION
microsoft#27320 No VERSION
microsoft#26923 No VERSION
microsoft#27284 No VERSION
microsoft#27433 No VERSION
microsoft#27314 VERSION got *removed*
microsoft#27335 No VERSION
microsoft#27370 No VERSION
microsoft#27324 No VERSION
microsoft#27391 No VERSION
microsoft#27388 No VERSION
microsoft#27396 No VERSION
microsoft#27404 No VERSION
microsoft#27413 No VERSION
microsoft#27417 No VERSION
microsoft#27427 No VERSION
microsoft#27428 No VERSION
microsoft#27368 No VERSION
microsoft#27307 No VERSION
microsoft#27415 Fixed here.
microsoft#27371 Fixed here.
microsoft#27323 No VERSION
microsoft#27352 No VERSION
microsoft#27347 No VERSION
microsoft#27366 No VERSION
microsoft#27361 No VERSION
microsoft#27359 No VERSION
microsoft#27358 No VERSION
microsoft#27355 No VERSION
microsoft#27331 No VERSION
microsoft#24615 No VERSION
microsoft#27325 No VERSION
microsoft#24861 No VERSION
microsoft#27354 No VERSION
microsoft#27346 No VERSION
microsoft#27345 No VERSION
microsoft#27218 No VERSION
microsoft#27329 No VERSION
microsoft#27326 No VERSION
microsoft#27321 No VERSION
microsoft#27312 No VERSION
microsoft#27297 No VERSION
microsoft#27336 No VERSION
microsoft#27225 No VERSION
microsoft#27339 No VERSION
microsoft#27302 No VERSION
microsoft#27295 No VERSION
microsoft#27233 No VERSION
microsoft#27313 No VERSION
microsoft#27237 No VERSION
microsoft#27250 No VERSION
microsoft#27263 No VERSION
microsoft#27266 No VERSION
microsoft#27272 No VERSION
microsoft#27287 No VERSION
microsoft#27282 No VERSION
microsoft#27294 No VERSION
microsoft#27228 No VERSION
microsoft#27163 No VERSION
microsoft#26817 No VERSION
microsoft#27286 No VERSION
microsoft#27274 No VERSION
microsoft#27276 No VERSION
microsoft#27232 No VERSION
microsoft#27221 No VERSION
microsoft#27215 No VERSION
microsoft#27166 No VERSION
microsoft#27239 No VERSION
microsoft#27246 No VERSION
microsoft#27268 No VERSION
microsoft#27259 No VERSION
microsoft#27238 No VERSION
microsoft#27224 No VERSION
microsoft#27203 No VERSION
microsoft#27124 No VERSION
JavierMatosD pushed a commit to microsoft/vcpkg that referenced this pull request Nov 8, 2022
* When @BillyONeal started being the on-call vcpkg maintainer on 2022-10-17, he started applying use of the "embedded VERSION" feature microsoft/vcpkg-tool#717 to PRs on merge.

@dg0yt points out that this use should be accompanied by a call to vcpkg_minimum_required, in https://github.com/microsoft/vcpkg/pull/27594/files#r1010641672

This is an audit of everything merged in that time and whether it needs to gain that.

#27561 No VERSION
#27525 No VERSION
#27554 Already has vcpkg_minimum_required
#27536 No VERSION
#27562 No VERSION
#24914 Fixed here
#27547 No VERSION
#27502 No VERSION
#27497 No VERSION
#27317 No VERSION
#27288 No VERSION
#27509 No VERSION
#27504 No VERSION
#27514 No VERSION
#27501 No VERSION
#27495 No VERSION
#27488 No VERSION
#27499 No VERSION
#27378 No VERSION
#27376 Fixed here
#27373 No VERSION
#27045 No VERSION
#27521 No VERSION
#27453 No VERSION
#27481 No VERSION
#27511 No VERSION
#27490 No VERSION
#27510 No VERSION
#27496 No VERSION
#27503 No VERSION
#27485 No VERSION
#27484 No VERSION
#27483 No VERSION
#27459 No VERSION
#27369 No VERSION
#27489 No VERSION
#26594 No VERSION
#27465 No VERSION
#27456 No VERSION
#27425 No VERSION
#27464 Fixed here
#27406 No VERSION
#27398 No VERSION
#27240 No VERSION
#27450 No VERSION
#27463 No VERSION
#27462 No VERSION
#27448 No VERSION
#27440 No VERSION
#27435 No VERSION
#27424 No VERSION
#27414 No VERSION
#27412 No VERSION
#27380 No VERSION
#27343 No VERSION
#27342 No VERSION
#27367 No VERSION
#27226 No VERSION
#27320 No VERSION
#26923 No VERSION
#27284 No VERSION
#27433 No VERSION
#27314 VERSION got *removed*
#27335 No VERSION
#27370 No VERSION
#27324 No VERSION
#27391 No VERSION
#27388 No VERSION
#27396 No VERSION
#27404 No VERSION
#27413 No VERSION
#27417 No VERSION
#27427 No VERSION
#27428 No VERSION
#27368 No VERSION
#27307 No VERSION
#27415 Fixed here.
#27371 Fixed here.
#27323 No VERSION
#27352 No VERSION
#27347 No VERSION
#27366 No VERSION
#27361 No VERSION
#27359 No VERSION
#27358 No VERSION
#27355 No VERSION
#27331 No VERSION
#24615 No VERSION
#27325 No VERSION
#24861 No VERSION
#27354 No VERSION
#27346 No VERSION
#27345 No VERSION
#27218 No VERSION
#27329 No VERSION
#27326 No VERSION
#27321 No VERSION
#27312 No VERSION
#27297 No VERSION
#27336 No VERSION
#27225 No VERSION
#27339 No VERSION
#27302 No VERSION
#27295 No VERSION
#27233 No VERSION
#27313 No VERSION
#27237 No VERSION
#27250 No VERSION
#27263 No VERSION
#27266 No VERSION
#27272 No VERSION
#27287 No VERSION
#27282 No VERSION
#27294 No VERSION
#27228 No VERSION
#27163 No VERSION
#26817 No VERSION
#27286 No VERSION
#27274 No VERSION
#27276 No VERSION
#27232 No VERSION
#27221 No VERSION
#27215 No VERSION
#27166 No VERSION
#27239 No VERSION
#27246 No VERSION
#27268 No VERSION
#27259 No VERSION
#27238 No VERSION
#27224 No VERSION
#27203 No VERSION
#27124 No VERSION

* Also add libcanberra
@autoantwort autoantwort deleted the feature/port-version branch November 10, 2022 23:08
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.

6 participants