[CMake] Documentation in RPM Package

Domen Vrankar domen.vrankar at gmail.com
Tue Dec 20 18:52:38 EST 2016


2016-12-20 21:53 GMT+01:00 Paul Londino <londinop at gmail.com>:

> Hello,
>
> I am trying to create an RPM package using CPack. I am having trouble
> packaging the documentation. There is a custom target that generates
> HTML using DoxyGen (in a folder called html), and this gets installed
> to /usr/doc/share during the packaging process. However, this
> generates 12,000+ files which are all added individually to the .spec
> file.
>
> What I would like to do is just add the whole doc directory to the RPM
> package using the %doc attribute so the RPM correctly installs this in
> the package-named subfolder of /usr/share/doc and marks it as
> documentation. I experimented with the
> CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST variable but this doesn't seem to
> work on a wildcard basis and excluding all 12,000 generated files by
> hand does not seem practical. Also, I was able to generate the %doc
> attribute using CPACK_RPM_USER_FILELIST, but I believe in order to
> have the auto-generated doc dir, it needs to be a relative path
> instead of absolute, which I had problems setting using the CMAKE
> variable (this could be more an RPM issue than a CMAKE one).
>
> Any ideas in the best way to achieve what I'm trying to do? I could
> try using a custom .spec file but there is a lot of value in the
> automatically generated one from the CMake, so I would prefer to use
> that if possible.
>

I don't believe that CPack/RPM can currently do what you want.

CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST is not intended to be used for
removing an entire list of files so it doesn't support wildcards - it is
meant to be used to exclude directory paths from being tracked by rpm and
deleted during rpm package uninstall.

Why exactly do you want to remove all those files? Spec file size or
something else?
If you write something like this:

install(FILES CMakeLists.txt DESTINATION x/maabc COMPONENT test RENAME
manx.txt)
install(FILES CMakeLists.txt DESTINATION x/maabc COMPONENT test RENAME
many.txt)

set(CPACK_RPM_USER_FILELIST
  "%doc /usr/x"
  )

Where /usr is packaging install prefix (this part could be replaced with a
variable so that it depends on for e.g. CPACK_PACKAGING_INSTALL_PREFIX or
some other path).

And then expect the generated package with (listing only files marked with
%doc):

rpm -qpld <your_rpm_package_name>

You'll get both files in that subdirectory flagged with %doc and I believe
that that's what you'd like to achieve.

If for some reason you'd really like to remove those files from spec file
you'll either have to patch your CPackRPM.cmake or write your own spec
file. If that's the case then please explain the reasons a bit further and
if it would be useful for others it could be added to a later CPackRPM
release.

Regards,
Domen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161221/ab8ed498/attachment.html>


More information about the CMake mailing list