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

Implement new PCL versioning scheme #1905

Merged
merged 5 commits into from
Jun 30, 2017

Conversation

taketwo
Copy link
Member

@taketwo taketwo commented Jun 26, 2017

(as discussed in #1682)

Current master (trunk) version is indicated by a "-dev" suffix appended to the latest released version. For instance, right now the latest released version is 1.8.0, therefore the master branch of PCL should build into version 1.8.0-dev.

In order to conditionally compile based on PCL version the PCL_VERSION_COMPARE macro should be used. It takes into account the development/release status of the build. A development version is always greater than its precedent released version and less than any of the future releases. For instance, 1.8.0-dev > 1.8.0 is true, as is 1.8.0-dev < 1.8.1.

No change is done to the existing C++ macros PCL_VERSION and PCL_VERSION_PRETTY. The first one is a numeric representation of the version (e.g. 100800 for version 1.8.0) and does not take into account development/release status to avoid breaking existing codebases. The second one is a string representation with "-dev" suffix for development versions (e.g. "1.8.0-dev" right now).

With the new versioning scheme the release process should involve the following steps:

  1. Update the PCL_VERSION variable in the root "CMakeLists.txt" file:
    1.1. Bump major/minor/revision number as appropriate;
    1.2. Remove "-dev" suffix.
  2. Tag release.
  3. Append "-dev" suffix to the PCL_VERSION variable.

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

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

This looks pretty good. Can you just confirme me what exactly is being generated here https://github.com/PointCloudLibrary/pcl/blob/master/PCLConfigVersion.cmake.in#L3

@taketwo
Copy link
Member Author

taketwo commented Jun 27, 2017

Good catch. I've double checked all occurrences of PCL_VERSION in scripts and updated them to use suffix-less version where appropriate (took OpenCV as an example).

@SergioRAgostinho SergioRAgostinho added this to the pcl-1.8.1 milestone Jun 27, 2017
@taketwo taketwo requested a review from jspricke June 27, 2017 11:30
@SergioRAgostinho
Copy link
Member

I was a looking at this PR #1614 and realized that with this versioning scheme I don't know how to properly handle situations like this https://github.com/aliosciapetrelli/pcl/blob/84e45b5e5c79de3958face842bada15172f3f31e/doc/tutorials/content/sources/ReLOC/CMakeLists.txt#L5

At some this will be merged into 1.8.1-dev but you really can't compile the example (after it's merged) because the minimum version is 1.9. Is there a good way to solve this?

@taketwo
Copy link
Member Author

taketwo commented Jun 28, 2017

The problem is that find_package does not allow us to express "any version greater than", only "any version greater or equal than". But we could use the tweak number to disambiguate the latest released version and the current development version. In other words, 1.8.1-dev will be a synonym of 1.8.1.1, and this is something find_package understands. So for ReLOC you would say find_package(PCL 1.8.1.1 REQUIRED)

Another option that I can exercise is to update the code responsible for version checking in CMake to support constructs like find_package(PCL 1.8.1-dev REQUIRED).

But either way, we end up with strange version numbers that won't exists in the changelog of the library. Though grepping and replacing them with the actual release version can be a part of the releasing protocol.

Off the top of my head I do not see any other clean way around it.

@SergioRAgostinho
Copy link
Member

Another option that I can exercise is to update the code responsible for version checking in CMake to support constructs like find_package(PCL 1.8.1-dev REQUIRED)

I prefer this. It's more consistent with the nomenclature were trying to adopt.

Though grepping and replacing them with the actual release version can be a part of the releasing protocol

I don't see any other way around it

@taketwo
Copy link
Member Author

taketwo commented Jun 28, 2017

OK, I'll check if this is possible.

@taketwo taketwo added the needs: more work Specify why not closed/merged yet label Jun 28, 2017
@taketwo
Copy link
Member Author

taketwo commented Jun 28, 2017

Unfortunately the find_package command is strict about the version argument:

find_package called with invalid argument "1.8.1-dev"

Only major[.minor[.patch[.tweak]]] format is supported. So, first option? Or other ideas?

@SergioRAgostinho
Copy link
Member

I assume major, minor patch and tweak need to numerals, otherwise you would have been able to parse the patch appropriately.

Then the easiest is to use the tweak as 1 when it's a dev version.

@taketwo
Copy link
Member Author

taketwo commented Jun 29, 2017

OK, so "1.8.1-dev" will be a synonym of "1.8.1.1".

I was thinking about the C++ macro PCL_VERSION which is constructed as Major * 100000 + Minor * 100 + Revision, e.g. 100801 for "1.8.1". Although there is an "official" macro function PCL_VERSION_COMPARE to check version compatibility, doing simple #if PCL_VERSION >= 100800 is still popular in user codebases. Perhaps we can change the way PCL_VERSION is constructed to incorporate tweak number (i.e. development status) and without breaking backwards compatibility. The formula can be Major * 10000 + Minor * 1000 + Revision * 10 + Tweak, e.g. 108010 for "1.8.1" and 108011 for "1.8.1-dev". All new versions will be strictly greater than all released old versions.

@taketwo
Copy link
Member Author

taketwo commented Jun 29, 2017

On the other hand, why bothering. Unlike CMake, in source code we can use strictly greater comparison and write #if PCL_VERSION > 100801 to disambiguate between 1.8.1 and 1.8.1-dev.

Copy link
Member

@SergioRAgostinho SergioRAgostinho left a comment

Choose a reason for hiding this comment

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

@jspricke Any final comment? Just to be sure we're not overlooking anything at this point.

taketwo added 3 commits June 29, 2017 14:39
It is set to 1 for development versions and 0 for release versions.
Development versions are identified by a "-dev" prefix.

This commit drops unused PCL_CANDIDATE_VERSION CMake variable.
…versions

A development version is always greater than its precedent released version and less than any of the future releases.
@taketwo taketwo removed the needs: more work Specify why not closed/merged yet label Jun 29, 2017
Copy link
Member

@jspricke jspricke left a comment

Choose a reason for hiding this comment

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

Thanks for looking into it. I'm generally fine, except the one comment inline.

Also, I've seen other project integration the git describe output into it, but we can think about that later.

set(PCL_VERSION_PLAIN "${PCL_MAJOR_VERSION}.${PCL_MINOR_VERSION}.${PCL_REVISION_VERSION}")
if(${PCL_VERSION} MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+-dev$")
set(PCL_DEV_VERSION 1)
set(PCL_VERSION_PLAIN "${PCL_VERSION_PLAIN}.1")
Copy link
Member

Choose a reason for hiding this comment

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

I would propose to use 90 or 99 instead of 1 to make it easier distinguishable.

Copy link
Member

Choose a reason for hiding this comment

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

prefer 99 between the two.

@taketwo
Copy link
Member Author

taketwo commented Jun 30, 2017

Interesting, I did not know the describe command. For example, executing right now in my clone the following command:

git describe --tags --long

I get:

pcl-1.8.0-234-g16ef868
^          ^     ^
|          |     |
|          |     SHA of HEAD
|          |
|          number of commits since last tag
|
last tag

We can use the number of commits since last tag as the tweak number instead of the arbitrary "1", "90", or "99". One problem, however, is that this won't work in source trees downloaded as archive, not by cloning.

@taketwo
Copy link
Member Author

taketwo commented Jun 30, 2017

Actually, after reading up in this topic, I do not think it is a good idea. For example, we will run into problems already after 1.8.1 release. Recall that we agreed to make a release branch, revert one of the PRs there, and eventually tag. The mainline PCL will continue with the master branch, it will never have this tag in it's history. Consequence: git describe will still report the number of commits since 1.8.0 release.

Jochen, can you give us some examples of projects that use it? (I see it in OpenCV, but only in CMake for reporting general build configuration to the user, not for tweak versioning.)

taketwo added 2 commits June 30, 2017 10:51
This variable is just like PCL_VERSION, but with "-dev" suffix (if any)
replaced by ".99" tweak number.

fu
@SergioRAgostinho
Copy link
Member

Actually, after reading up in this topic, I do not think it is a good idea. For example, we will run into problems already after 1.8.1 release. Recall that we agreed to make a release branch, revert one of the PRs there, and eventually tag. The mainline PCL will continue with the master branch, it will never have this tag in it's history. Consequence: git describe will still report the number of commits since 1.8.0 release.

😞 The approach sounded really nice.

Shall I squash merge this or do we need to keep the 'new version mechanism' and the 'bumping of current version' in different commits?

@taketwo
Copy link
Member Author

taketwo commented Jun 30, 2017

I like granular commits, but I don't care.

@SergioRAgostinho SergioRAgostinho merged commit 0381c68 into PointCloudLibrary:master Jun 30, 2017
@SergioRAgostinho
Copy link
Member

Thanks Sergey :)

@taketwo taketwo deleted the version-dev branch June 30, 2017 11:57
@jspricke
Copy link
Member

@taketwo sorry, I don't have a project at hand. Regarding the describe, I think basing it of the last tag in the branch is the right thing and we could still decode it (and for sure using the sha1), but we can reevaluate that at an other point.

@SergioRAgostinho
Copy link
Member

By the way guys I just found this here

Release versions and release candidate versions of CMake use the format:

<major>.<minor>.<patch>[-rc<n>]
where the component is less than 20000000. Development versions of CMake use the format:

<major>.<minor>.<date>[-<id>]
where the component is of format CCYYMMDD and may contain arbitrary text. This represents development as of a particular date following the . feature release.

Also

Note CMake versions 2.8.2 through 2.8.12 used three components for the feature level. Release versions represented the bug-fix level in a fourth component, i.e. <major>.<minor>.<patch>[.<tweak>][-rc<n>]. Development versions represented the development date in the fourth component, i.e. <major>.<minor>.<patch>.<date>[-<id>].

CMake versions prior to 2.8.2 used three components for the feature level and had no bug-fix component. Release versions used an even-valued second component, i.e. <major>.<even-minor>.<patch>[-rc<n>]. Development versions used an odd-valued second component with the development date as the third component, i.e. <major>.<odd-minor>.<date>.

The CMAKE_VERSION variable is defined by CMake 2.6.3 and higher. Earlier versions defined only the individual component variables.

@taketwo
Copy link
Member Author

taketwo commented Jul 3, 2017

Well, this concerns only versioning of CMake itself. As a wrote before, find_package does not accept suffixed versions.

@SergioRAgostinho
Copy link
Member

I just revised it to be sure. I though that perhaps versions prior to CMake 3 didn't accept it.

Really mean of Kitware to be able to use a very convenient version number for themselves and not allow the same type of functionality for the rest :(

I like the idea of the tweak version during the development stage as a date in yyyyMMDD format though.

@taketwo
Copy link
Member Author

taketwo commented Jul 3, 2017

I like the idea of the tweak version during the development stage as a date in yyyyMMDD format though.

Sounds attractive!

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.

3 participants