<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">Le mar. 27 nov. 2018 à 14:56, Mario Emmenlauer <<a href="mailto:mario@emmenlauer.de">mario@emmenlauer.de</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Dear Eric,<br>
<br>
just to let you know, your suggestion of using a post-install-script<br>
for all system-wide links and files was indeed the solution to a working<br>
RPM package. Now my files are completely encapsulated in /opt/PKGNAME/<br>
and install works fine.<br></blockquote><div><br></div><div>Thank you very much for the *positive* feedback, we don't always get those :-)</div><div><br></div><div>This is nice to me and probably useful to others knowing it finally works.</div><div> </div><div>Cheers,</div><div>Eric</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Cheers and Thanks,<br>
<br>
Mario<br>
<br>
<br>
<br>
On 23.11.18 15:37, Mario Emmenlauer wrote:<br>
> <br>
> Dear Eric,<br>
> <br>
> thanks a lot for this help! I think I have the pointers to move forward!<br>
> One more detail below:<br>
> <br>
> On 23.11.18 11:36, Eric Noulard wrote:<br>
>> Le ven. 23 nov. 2018 à 11:10, Mario Emmenlauer <<a href="mailto:mario@emmenlauer.de" target="_blank">mario@emmenlauer.de</a> <mailto:<a href="mailto:mario@emmenlauer.de" target="_blank">mario@emmenlauer.de</a>>> a écrit :<br>
>> Dear Eric, thanks for the help! Below more:<br>
>><br>
>> On 22.11.18 18:20, Eric Noulard wrote:<br>
>> > Le jeu. 22 nov. 2018 à 16:16, Mario Emmenlauer <<a href="mailto:mario@emmenlauer.de" target="_blank">mario@emmenlauer.de</a> <mailto:<a href="mailto:mario@emmenlauer.de" target="_blank">mario@emmenlauer.de</a>> <mailto:<a href="mailto:mario@emmenlauer.de" target="_blank">mario@emmenlauer.de</a><br>
>> <mailto:<a href="mailto:mario@emmenlauer.de" target="_blank">mario@emmenlauer.de</a>>>> a écri<br>
>> > I'm trying to build an RPM with CPack, and everything seems to work,<br>
>> > but the resulting package can not be installed. I get Transaction check<br>
>> > error:<br>
>> > file / from install of <mypackage> conflicts with file from package filesystem-3.2-25.el7.x86_64<br>
>> > file /opt from install of <mypackage> conflicts with file from package filesystem-3.2-25.el7.x86_64<br>
>> > file /usr/bin from install of <mypackage> conflicts with file from package filesystem-3.2-25.el7.x86_64<br>
>> > file /usr/share from install of <mypackage> conflicts with file from package filesystem-3.2-25.el7.x86_64<br>
>> > file /usr from install of <mypackage> conflicts with file from package filesystem-3.2-25.el7.x86_64<br>
>> ><br>
>> > I've read in the CPackRPM source code about how to add excludes and<br>
>> > CPackRPM says that my "Final list of path to OMIT in RPM" would be<br>
>> > /etc;/etc/init.d;/usr;/usr/bin;/usr/include;/usr/lib;/usr/libx32;/usr/lib64;/usr/share;/usr/share/aclocal;/usr/share/doc;/opt;/usr/share/applications<br>
>> ><br>
>> ><br>
>> > You can read the doc too:<br>
>> > <a href="https://cmake.org/cmake/help/v3.13/cpack_gen/rpm.html#variable:CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/v3.13/cpack_gen/rpm.html#variable:CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST</a><br>
>><br>
>> Haha, done that! I've read everything I could find, including the<br>
>> docs and the excellent but hard-to-find community wiki at<br>
>> <a href="https://gitlab.kitware.com/cmake/community/wikis/home" rel="noreferrer" target="_blank">https://gitlab.kitware.com/cmake/community/wikis/home</a><br>
>><br>
>><br>
>> OK then you are up-to-doc then.<br>
>><br>
>> > Could someone shed some light? I believe that the problem may be<br>
>> > my install command: I call install only once for the full tree<br>
>> > of files that I'd like to package:<br>
>> > install(DIRECTORY "${INSTALL_TMP_ROOT}/" DESTINATION "/" USE_SOURCE_PERMISSIONS)<br>
>> ><br>
>> > Yep this is looking for trouble.<br>
>> > How did you build the "${INSTALL_TMP_ROOT}" in the first place?<br>
>> ><br>
>> > Can't you use relative path install DESTINATION ? For all files/target you build?<br>
>><br>
>> I'm not sure if I can use a relative path. I want to build a system package<br>
>> that installs to /opt/<package>/ with symlinks in /usr/bin/ and desktop<br>
>> files in /usr/share/applications/. Since files go into different paths below<br>
>> system root (/opt, /usr, maybe /var) I assume I need to install into root?<br>
>> Maybe I misunderstand?<br>
>><br>
>><br>
>> Not really. Usually you install in relative bin/ share/ man/ whatever other subdir you need.<br>
>> Then you define CPACK_PACKAGING_INSTALL_PREFIX (see <a href="https://cmake.org/cmake/help/v3.13/variable/CPACK_PACKAGING_INSTALL_PREFIX.html" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/v3.13/variable/CPACK_PACKAGING_INSTALL_PREFIX.html</a>)<br>
>> to set up your "main" install prefix for your package. Every CPack generator has a default **packaging install prefix** (not to be confused with<br>
>> CMAKE_INSTALL_PREFIX).<br>
>> In your case: <br>
>> set(CPACK_PACKAGING_INSTALL_PREFIX "/opt") <br>
>> which should even be (AFAIR) the default value for RPM and DEB.<br>
>><br>
>> Concerning the symlink in /usr/bin (or other places /usr/share etc...) this usually done using post-install script<br>
>> <a href="https://cmake.org/cmake/help/v3.13/cpack_gen/rpm.html#variable:CPACK_RPM_SPEC_MORE_DEFINE" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/v3.13/cpack_gen/rpm.html#variable:CPACK_RPM_SPEC_MORE_DEFINE</a><br>
>><br>
>> the script itself may call standard symlink creation like <a href="https://linux.die.net/man/8/update-alternatives" rel="noreferrer" target="_blank">https://linux.die.net/man/8/update-alternatives</a><br>
> <br>
> Aha, now I see the recommended approach! Makes perfect sense! So I will<br>
> continue to bundle up everything, but try to avoid files outside my<br>
> man package directory (for me /opt/${PROJECT_NAME}). Then I will make<br>
> the system integration (to /usr/bin, /usr/share, etc) via symlinks<br>
> and update-alternatives in post-install scripts. This makes perfect<br>
> sense, I'm sorry I did not think of it myself!<br>
> <br>
> All the best,<br>
> <br>
> Mario<br>
> <br>
> <br>
> <br>
>> Sometimes you *really* need absolute prefix like when you install in /etc/init...<br>
>> then for those (generally system) specific file you install them with absolute destination.<br>
>> CPackRPM is able to handle those as "config" file automatically.<br>
>><br>
>> > I have a wild guess that this install somehow includes the<br>
>> > directories, and probably it would be better to just call install<br>
>> > on the individual files?<br>
>> ><br>
>> > CPack RPM tries its best to avoid shipping directories he does not need to ship, but<br>
>> > RPM requires that any new (non shared) directory should be specified in the spec file,<br>
>> > so CPackRPM tries to "discover that" automatically and make the package relocatable.<br>
>> ><br>
>> > Installing a whole directory to an absolute DESTINATION (even "/" in you case) is probably <br>
>> > giving tough time to CPackRPM.<br>
>><br>
>> There is something I don't understand: I can see that CPackRPM removes<br>
>> several things from CPACK_RPM_INSTALL_FILES, but later rpm complains<br>
>> about several of the removed items nonetheless. For example /usr/bin.<br>
>> Does that mean the filtering failed, or does the filter work but (somehow)<br>
>> the directory still ends up being packaged?<br>
>><br>
>><br>
>> Evil usually hides in details.<br>
>><br>
>> Difficult to say without having the actual code and package to look into it.<br>
>> Is your project public? If so could you provide us with the source?<br>
>><br>
>> If not tries to setup a stripped down public project that exhibit the same issue.<br>
>> <br>
>><br>
>> > I would prefer not to call install on the<br>
>> > individual files because that overrides file permissions for every<br>
>> > file, and I carefully prepared my package upfront to have the<br>
>> > exact permissions for installation.<br>
>> ><br>
>> ><br>
>> > How did you "carefully prepared my package upfront" ?<br>
>> > And what do you mean by<br>
>> > "because that overrides file permissions for every file"<br>
>><br>
>> Currently I bundle my package in a temporary directory for three reasons:<br>
>> - Its easier for me to grasp. I.e. I can nicely inspect the package and<br>
>> see what will be bundled before the fact.<br>
>><br>
>><br>
>> make/ninja DESTDIR=/tmp/testinstall all<br>
>><br>
>> may be used equally for that.<br>
>> <br>
>><br>
>> - In the temporary copy, I can override RPATH on binaries and libraries<br>
>> without changing them in their actual install location.<br>
>><br>
>><br>
>> If you have a "clean" prefix and relative install path for all binaries then you can safely use $ORIGIN <br>
>> see: <a href="https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling" rel="noreferrer" target="_blank">https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling</a><br>
>><br>
>> <br>
>><br>
>> - I prefer file(COPY) over install(FILES) because the former can set<br>
>> permissions with complex patterns. I appreciate that file(COPY) allows<br>
>> me to set executable permissions on *.so and binaries with a single<br>
>> invocation (in a loop over many directories).<br>
>><br>
>><br>
>> if you install(TARGET ..) any binaries or .so would have the appropriate permissions precisely because cmake<br>
>> knows what they are and does not consider them as "file" which is the case for install(FILES).<br>
>> <br>
>><br>
>> > one more question, could you tell us which version of CPack/CMake you are using?<br>
>><br>
>> I'm on the latest cmake 3.13 as of now, but I tested 3.12.4 as well.<br>
>><br>
>><br>
>> Then you have all bleeding edge feature with you.<br>
>><br>
>> I'm not trying to tell you what to do with your install, I'm just trying what CPack expects.<br>
>><br>
>> install(DIRECTORY ...) is a kind of trap-them-all for things that are not installed otherwise, this is usually used for things like<br>
>> generated documentation and not for "normally built artefact" like executable, libraries etc...<br>
>><br>
>><br>
>> -- <br>
>> Eric<br>
> <br>
<br>
<br>
<br>
Viele Gruesse,<br>
<br>
Mario Emmenlauer<br>
<br>
<br>
--<br>
BioDataAnalysis GmbH, Mario Emmenlauer Tel. Buero: +49-89-74677203<br>
Balanstr. 43 mailto: memmenlauer * <a href="http://biodataanalysis.de" rel="noreferrer" target="_blank">biodataanalysis.de</a><br>
D-81669 München <a href="http://www.biodataanalysis.de/" rel="noreferrer" target="_blank">http://www.biodataanalysis.de/</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div></div>