[CMake] Packaging a directory with CPack RPM
Eric Noulard
eric.noulard at gmail.com
Thu Sep 12 06:57:44 EDT 2019
Le jeu. 12 sept. 2019 à 02:27, Ashish Sadanandan <
ashish.sadanandan at gmail.com> a écrit :
> Hello,
> I'm using CPack to create RPMs for an application. I have this working but
> the CPack step is quite slow. While investigating this, I noticed that all
> files in a directory I'm packaging, which contains a large number of small
> files, is being listed in the spec file.
>
> For instance, say I have
>
> set(CPACK_PACKAGING_INSTALL_PREFIX /opt/myapp)
> install(DIRECTORY ${CMAKE_BINARY_DIR}/myapp/foo
> DESTINATION foo
> COMPONENT myapp
> )
>
> In the %files section I see
>
> %files
> %dir /opt/myapp/foo
> " /opt/myapp/foo/file1"
> " /opt/myapp/foo/file2"
> ...
> " /opt/myapp/foo/file60000"
>
> If I were writing the spec file by hand, this entire section could be
> replaced by a single line
>
> %files
> /opt/myapp/foo
>
CPack has no idea that the list of files are coming from an installed
*directory*, because CPack is not doing the install CMake is.
Thus CPackRPM and other CPack generators collect all installed bits inside
a given [temporary] prefix directory.
Now may be you can tell CPack to ignore some of you installed
files/directory by using: CPACK_RPM_USER_FILELIST
https://cmake.org/cmake/help/v3.15/cpack_gen/rpm.html#cpack_gen:CPack%20RPM%20Generator
> RPM will package all files within the directory if you specify the
> directory under %files (
> http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list-directives.html - the
> "The %dir Directive" section)
> Is there an option to list just the directory instead of recursively
> listing all contained files within the directory?
>
AFAIK, No there is not.
I'm not claiming this is the reason for CPack being slow, I came across
> this while investigating performance and if nothing else, this will result
> in a cleaner looking spec file.
>
For performance sake you can
try CPACK_RPM_USER_BINARY_SPECFILE,
CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
and handcraft your "user" spec file in order to see if it helps the
packaging performance.
and/or you can set CPACK_RPM_PACKAGE_DEBUG to 1 in order to get more timed
traces of CPackRPM execution.
--
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190912/d54c8e7a/attachment-0001.html>
More information about the CMake
mailing list