-
Notifications
You must be signed in to change notification settings - Fork 123
CPack RPM packaging #3601
CPack RPM packaging #3601
Conversation
Limitations that couldn't be solved:
|
Can you do a bug report about these warnings we receive (also the ones in Debian). Maybe the CMake devs know some easy way to fix it or at least they'll know about the problem and can fix it in the future.
I do not really understand the problem. Can someone who wants to build the RPM packages on his machine trigger this problem? If yes, we should write about it in doc/INSTALL.md. In general we should update doc/INSTALL.md as from now on, creating packages via cpack will be the favorable option, and |
Yes I will do this.
Yes, unless someone sets CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX to a smaller path, they will need to place the libelektra source to a longer path (with 6 parent directories) and build the package from there. I will update doc/INSTALL.md and document these things. |
Since If will add this right to this PR if the approach is OK for you @markus2330. |
Can you give more details about the approach? How do you want to disable packages? What is important for CMake usability is to have as little CACHE variables as possible, as with these variables every maintainer gets confronted. So I would not like a solution where we would need to introduce a CACHE variable for every package. Two ways that sound fine to me would be:
|
I just testet the case for RPM and DEB generators. The build does not fail for RPM packages because the RPM generator detects that there is no source (except for /usr/share/) present and disables the debuginfo generation. My idea was to check the ADDED_PLUGINS, ADDED_BINDINGS and ADDED_TOOLS variables to determine which of the plugins, bindings and tools are not included. Especially for the components/packages where there is a one-to-one relationship to plugins etc. This way no CACHE variables would need to be set. |
Maybe this is a bug in CMake and what we do is actually correct and should already work?
Yes, this proposal is perfect from the user's point of view!
Maybe it is better to track which components are added (e.g. within It would be good to print which components were added or excluded. |
I'm not 100% sure about this, since they state in their docu that binaries must contain debug symbols before packaging. But I will include this in the bug report, because the RPM generator actually handles this case.
This way we would not have the option to yield a message that a part of the expected plugins of a package is missing. For example libelektra4-zeromq depends on the plugins zeromqrecv and zeromqsend. But if this isn't a problem for you, then I can also rewrite it like you suggested. |
No need to rewrite if there are no problems, let us see how the current implementation works. |
b4ca737
to
40b6410
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Can you also update doc/INSTALL.md how to install the Ubuntu packages produced by our build server. At the moment only buster is explained (with a wrong heading, where it says "For Stretch.") and the outdated Jessie (does it even work? I think we can remove it now).
Yes of course. Since the update of the release-pipeline depends on the changes of this PR (and also fixes a few things), should I add all these changes (including the update of the release-pipeline) to this PR or create a separate one after this one is merged? |
Thank you! We should also start offering both released packages and packages build from master. Do we have all of them (Debian+Ubuntu) already in repositories? It is up to you how you prefer to split up PRs. Smaller is usually better. The docu should only reflect what is, not what it might be with upcoming PRs. |
None of the released packages are currently offered in our repositories. I will make myself familiar with the |
Thank you! Do we already have Ubuntu Focal debs build from master? The docu does not mention it at all even though #3522 is resolved. |
Oh I think I misunderstood #3522 and thought that Ubuntu Focal packages should only be built for releases. I will add this to the upcoming PR with the updated release pipeline. |
You are right, in #3522 nothing was mentioned about master builds. I think, however, it would be the easiest for the user if we build the same set of packages for both master and releases. Specifically, for Ubuntu Focal we need packages once #3608 is merged. It would be possible to do a release afterwards. So if it is a lot of effort to do master packages, we can consider to provide only release packages and make some pre-releases so that we have the ability to create packages when needed. Or you find a way to share code between master and release packaging (or even creating packages for branches), this would be best from my point of view. What do you think? |
I don't think it is a lot of effort to also provide them in the main pipeline, since I also have to create the repositories for the released packages. Should we then also include the stage where the built packages are installed and tested in a docker container? This is currently done in the updated release-pipeline, but IMO it wouldn't make much sense to include it in the main pipeline until #2856 is not fixed. Since we also create Fedora packages and the
I planned to refactor the shared code of the main and release Jenkinsfile into a shared groovy library, since I already introduced a lot of duplicate code. Depending on when the release will happen, I'm not sure if I manage to get this done for the current one.
So for Pull Requests? |
As we want the possibility of problems during release to be kept at a minimum, such tests ideally are in the main pipeline.
Then let us fix #2856 by excluding these tests from the installation.
Is there maybe some tool that supports several distributions and package formats? reprepro is some legacy tool I used to use many years ago. There is no special reason to keep it.
That would be amazing.
In any case it is good that you always create PRs whenever you have something that is working.
To have this would be the best. But consider it as strictly nice-to-have. Afaik I am the only one sometimes building packages from branches. With cpack it is not a big deal to build packages for yourself anyway. |
I only could find Pulp as a tool that supports both, but it seems to be really hard to setup and to integrate it into our current setup. aptly is another well used tool for debian package management which appears to be much easier to use than |
Can I set the |
Caching the revision number makes package revisions possible without changing any CMake files
23a6941
to
708e311
Compare
When you finish your work you can always set the The label just avoids premature reviews and also gets PRs merged faster (visibility). |
Oh then I misunderstood it, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much! I'm looking forward to testing the Fedora packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! (Partly reviewed)
doc/INSTALL.md
Outdated
@@ -111,7 +116,55 @@ Please refer to the section OS Independent below. | |||
|
|||
First follow the steps in [COMPILE](COMPILE.md). | |||
|
|||
After you completed building Elektra on your own, there are multiple options how to install it. For example, with make or cPack tools. | |||
After you completed building Elektra on your own, there are multiple options how to install it. For example, with make or CPack tools. | |||
We recommend that you generate your own packages with CPack so ensure compatibility with future releases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We recommend that you generate your own packages with CPack so ensure compatibility with future releases. | |
We recommend to use the packages from our build server or that you generate your own packages with CPack. |
doc/INSTALL.md
Outdated
To install the packages run this in the `package` directory: | ||
|
||
```sh | ||
dpkg -i * |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With apt
you can install directly with also installing dependencies.
@@ -134,20 +187,6 @@ or in the build directory (will not honor `DESTDIR`!): | |||
xargs rm < install_manifest.txt | |||
``` | |||
|
|||
### CPack | |||
|
|||
First follow the steps in [COMPILE](COMPILE.md). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should keep this info somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is already present in the parent heading ## OS Independent
(not visible in the git diff). Is it really necessary to write this multiple times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you are right, I did not see it.
scripts/cmake/ElektraCache.cmake
Outdated
# | ||
|
||
set ( | ||
CPACK_DEBIAN_PACKAGE_RELEASE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not only one variable CPACK_PACKAGE_RELEASE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CPACK_DEBIAN_PACKAGE_RELEASE and CPACK_RPM_PACKAGE_RELEASE are both predefined variables of CPack, but I agree, caching only CPACK_PACKAGE_RELEASE and setting CPACK_DEBIAN_PACKAGE_RELEASE and CPACK_RPM_PACKAGE_RELEASE to CPACK_PACKAGE_RELEASE would be better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they are already predefined we do not need to set them as cache variable anyway?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree, but I would at least define CPACK_PACKAGE_RELEASE as cache variable with a default value. This is especially useful for our release pipeline where the package revision of each package can be changed with the parameterized build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache variables are afaik only needed if you want it to be visible in the cmake GUIs. I do not think this is needed in this situation.
With something like:
if (CPACK_RPM_PACKAGE_RELEASE) set (CPACK_RPM_PACKAGE_RELEASE ...)
you should be able to set a default if the variable is not set from outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Can imho be merged and the small things fixed later.
if [ $OS_NAME = "Fedora" ]; then | ||
|
||
CMAKE_ARGS="-DTARGET_PLUGIN_FOLDER='elektra4' \ | ||
-DBUILD_STATIC=OFF \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some args, like -DBUILD_STATIC=OFF, seem to be the same in both branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already fixed in #3623.
|
||
# install copyright file | ||
configure_file ("${CMAKE_SOURCE_DIR}/LICENSE.md" "${CMAKE_BINARY_DIR}/doc/LICENSE" COPYONLY) | ||
configure_file ("${CMAKE_SOURCE_DIR}/doc/THIRD-PARTY-LICENSES" "${CMAKE_BINARY_DIR}/doc/THIRD-PARTY-LICENSES" COPYONLY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need distribution-specific installation of files? Maybe put it together with execute_process, here it is a bit surprising.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately yes. /usr/share/licenses/
is the default directory for licenses on Fedora based distributions and is not present on Debian based distributions. I will move it up like you suggested.
@@ -0,0 +1,199 @@ | |||
set (CPACK_RPM_PACKAGE_VERSION "${PROJECT_VERSION}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give a short info what this file is about (that it sets CPACK_RPM_ vars and also installs some rpm specific files). Maybe also split this into two files (with separate headers)
scripts/cmake/ElektraPackaging.cmake
Outdated
# ADDITIONAL_DEPENDENCIES additional dependencies if the component | ||
# has multiple dependencies | ||
# ~~~ | ||
macro (check_component_dependencies dependency_name component_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can put this to some other file, the files already get lengthy.
scripts/cmake/ElektraPackaging.cmake
Outdated
# ~~~ | ||
# check_component_dependencies | ||
# | ||
# check and excludes a component from packaging if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice docu 👍
Thank you. 🚀 |
Basics
These points need to be fulfilled for every PR:
(added as entry in
doc/news/_preparation_next_release.md
whichcontains
_(my name)_
)Please always add something to the release notes.
(first line should have
module: short statement
syntax)close #X
, are in the commit messages.doc/news/_preparation_next_release.md
scripts/dev/reformat-all
If you have any troubles fulfilling these criteria, please write
about the trouble as comment in the PR. We will help you.
But we cannot accept PRs that do not fulfill the basics.
Checklist
Check relevant points but please do not remove entries.
For docu fixes, spell checking, and similar none of these points below
need to be checked.
(not in the PR description)
Review
Reviewers will usually check the following:
Labels
If you are already Elektra developer:
say that everything is ready to be merged.