Skip to content

build: clean up the VERSION file#3112

Merged
matthiasdiener merged 21 commits intomasterfrom
version-cleanup
Oct 28, 2020
Merged

build: clean up the VERSION file#3112
matthiasdiener merged 21 commits intomasterfrom
version-cleanup

Conversation

@matthiasdiener
Copy link
Copy Markdown
Contributor

@matthiasdiener matthiasdiener commented Oct 19, 2020

create two separate files, charm-version.h and charm-version-git.h in
include/, with the release/API version and git version respectively.

The files look like this:

$ cat ./netlrts-darwin-x86_64/include/charm-version.h
#define CHARM_VERSION 61002
#define CHARM_VERSION_MAJOR 6
#define CHARM_VERSION_MINOR 10
#define CHARM_VERSION_PATCH 2
$ cat ./netlrts-darwin-x86_64/include/charm-version-git.h
#define CHARM_VERSION_GIT "v6.11.0-devel-430-g50bd748ad*"

Fixes #2844.

For the old build system, commitid.sh creates the charm-version-git.h file containing the git version of Charm++ (this version was previously contained in tmp/VERSION.

create two separate files, charm-version.h and charm-api-version.h in
include/, with the git version and release/API version respectively.
@matthiasdiener matthiasdiener added the CMake The CMake build system label Oct 19, 2020
@matthiasdiener matthiasdiener self-assigned this Oct 19, 2020
@matthiasdiener
Copy link
Copy Markdown
Contributor Author

This is somewhat risky and the changes are not very well tested, but it fixes an important issue users have been seeing. @rbuch: Could you please check if the changes related to the tarball packaging work as expected?

CMakeLists.txt Outdated
file(WRITE ${CMAKE_BINARY_DIR}/include/.vdir "${CMK_VDIR}\n")
file(WRITE ${CMAKE_BINARY_DIR}/include/VERSION "${CHARM_VERSION}\n")
file(WRITE ${CMAKE_BINARY_DIR}/include/charm-version.h "#define CHARM_VERSION "${CHARM_VERSION}"\n")
file(WRITE ${CMAKE_BINARY_DIR}/include/charm-api-version.h "#define CHARM_API_VERSION ${PROJECT_VERSION}\n")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I suggest to #define CHARM_VERSION_{MAJOR,MINOR,PATCH} as well

Copy link
Copy Markdown
Contributor

@rbuch rbuch left a comment

Choose a reason for hiding this comment

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

Using $(cat charm-version.h | grep CHARM_VERSION | awk '{print $3}') in package-tarball.sh doesn't strip the version of the quotation marks, is there some other command that should be used for that? I'm confused why its use in src/scripts/Makefile doesn't result in extra quotation marks.

@matthiasdiener
Copy link
Copy Markdown
Contributor Author

Using $(cat charm-version.h | grep CHARM_VERSION | awk '{print $3}') in package-tarball.sh doesn't strip the version of the quotation marks, is there some other command that should be used for that? I'm confused why its use in src/scripts/Makefile doesn't result in extra quotation marks.

Good catch. Both package-tarball.sh and src/scripts/Makefile were incorrect and should be fixed now.

@evan-charmworks
Copy link
Copy Markdown
Contributor

Should this PR add mention of VERSION's removal to CHANGES? It might be good to offer documentation on the forward transition path for any Charm users who parse it.

@matthiasdiener
Copy link
Copy Markdown
Contributor Author

Should this PR add mention of VERSION's removal to CHANGES? It might be good to offer documentation on the forward transition path for any Charm users who parse it.

We could add this and also add documentation to the manual regarding CHARM_API_VERSION etc.
Another idea is to #include both files into charm-api.h or so.

@matthiasdiener
Copy link
Copy Markdown
Contributor Author

Turns out that CHARM_VERSION is already used in conv-autoconfig.h (value is the same as CHARM_API_VERSION).
So I'll rename CHARM_API_VERSION_MAJOR etc. to CHARM_VERSION_MAJOR, and CHARM_VERSION to CHARM_VERSION_GIT.

@rbuch
Copy link
Copy Markdown
Contributor

rbuch commented Oct 22, 2020

One thing to note is some applications (at least Enzo-E) read the root VERSION file as part of their build process. I don't think that should stop us from making this change, just know that it will be a breaking one.

@matthiasdiener matthiasdiener requested a review from rbuch October 25, 2020 02:15
@matthiasdiener
Copy link
Copy Markdown
Contributor Author

Ready for review.

@evan-charmworks
Copy link
Copy Markdown
Contributor

Does this work correctly from a packaged tarball too? I get this from CMake with current master from a tarball:

fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
==============================
-- Configuring done
Charm++ 6.10.2 configuration: 
  OS version:      Ubuntu 18.04.5 LTS (Linux 5.4.0-1031-azure, x86_64)
  Charm++ version:  (dev)

I don't know if passing --release to package-tarball.sh changes anything.

@matthiasdiener
Copy link
Copy Markdown
Contributor Author

Does this work correctly from a packaged tarball too? I get this from CMake with current master from a tarball:

fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
==============================
-- Configuring done
Charm++ 6.10.2 configuration: 
  OS version:      Ubuntu 18.04.5 LTS (Linux 5.4.0-1031-azure, x86_64)
  Charm++ version:  (dev)

I don't know if passing --release to package-tarball.sh changes anything.

Good point, should be fixed now.

@evan-charmworks
Copy link
Copy Markdown
Contributor

buildold says this:

fatal: not a git repository (or any of the parent directories): .git
Copying charm-version-git.h.new = "" over charm-version-git.h = 
./system_ln $PWD/charm-version-git.h ../include/charm-version-git.h

@matthiasdiener
Copy link
Copy Markdown
Contributor Author

matthiasdiener commented Oct 28, 2020

buildold says this:

fatal: not a git repository (or any of the parent directories): .git
Copying charm-version-git.h.new = "" over charm-version-git.h = 
./system_ln $PWD/charm-version-git.h ../include/charm-version-git.h

Ok, but this is not a regression with this PR as far as I can see.

Comment on lines +764 to +765
rm -f charm-version.h
$DESTINATION/tmp/system_ln $DESTINATION/include/charm-version.h charm-version.h
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we also want to remove charm-version-git.h here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure, but I think the rm refers to the symlink only, and there is no symlink created for charm-version-git.h.

@matthiasdiener matthiasdiener merged commit adba432 into master Oct 28, 2020
@matthiasdiener matthiasdiener deleted the version-cleanup branch October 28, 2020 18:47
stwhite91 pushed a commit that referenced this pull request May 11, 2023
create two separate files, charm-version.h and charm-version-git.h in
include/, with the release/API version and git version respectively.

The files look like this:

$ cat ./netlrts-darwin-x86_64/include/charm-version.h
#define CHARM_VERSION 61002
#define CHARM_VERSION_MAJOR 6
#define CHARM_VERSION_MINOR 10
#define CHARM_VERSION_PATCH 2
$ cat ./netlrts-darwin-x86_64/include/charm-version-git.h
#define CHARM_VERSION_GIT "v6.11.0-devel-430-g50bd748ad*"
Fixes #2844.

For the old build system, commitid.sh creates the charm-version-git.h file containing the git version of Charm++ (this version was previously contained in tmp/VERSION.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CMake The CMake build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflict between LLVM's version file and our VERSION file

5 participants