[cmake-developers] [PATCH] Preinstall requirements support for CPack RPM generator
Micha Hergarden
micha.hergarden at gmail.com
Sun Oct 19 07:28:14 EDT 2014
On 10/09/2014 07:30 PM, Evgeny Kalishenko wrote:
> Ok, thanks for the advise about STREQUAL. Explanation of s/_/(/ (from
> http://www.rpm.org/max-rpm-snapshot/s1-rpm-depend-manual-dependencies.html):
> "Recent versions of RPM support context marked dependencies. This is a
> special type of a dependency that applies only in a specified
> /context/. Using this feature, one can specify dependencies for pre-
> and post(un)install scriptlets, ie. the context of a dependency is the
> execution time of the specified scriptlet.
>
> The syntax for specifying these dependencies is:
>
> Requires(/X/): foo
>
>
> Here, /X/ can be one of *pre*, *post*, *preun*, or *postun*, which
> tells RPM that the package depends on package foo for running the
> corresponding *%pre*, *%post*, *%preun*, or *%postun* script."
>
> Modified patch attached.
>
>
> 2014-10-09 18:03 GMT+04:00 Brad King <brad.king at kitware.com
> <mailto:brad.king at kitware.com>>:
>
> On 10/08/2014 01:48 PM, Evgeny Kalishenko wrote:
> > I was interested in feature request
> > http://public.kitware.com/Bug/view.php?id=14769 and made a
> > simple patch for CPack RPM generator (attached).
>
> Thanks.
>
> In this hunk:
>
> > + # The following keywords require braces around the "pre" or
> "post" suffix in the final RPM spec file.
> > + if("${_RPM_SPEC_HEADER}" MATCHES "REQUIRES_PRE" OR
> "${_RPM_SPEC_HEADER}" MATCHES "REQUIRES_POST")
> > + string(REPLACE "_" "(" _PACKAGE_HEADER_NAME
> "${_PACKAGE_HEADER_NAME}")
> > + set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})")
> > + endif()
>
> The MATCHES conditions can use simply STREQUAL instead.
> I'm not very familiar with the spec format, so please
> explain the purpose of the s/_/(/ subsitution in comments
> here.
>
> Thanks,
> -Brad
>
>
>
>
> --
> С уважением,
> Евгений Калишенко
>
>
In this hunk:
+# May be used to set RPM postinstall dependencies (requires(post)).
Note that you must enclose
+# the complete requires string between quotes, for example::
+#
+# set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts")
+#
+#
The variable name CPACK_RPM_PACKAGE_REQUIRES_PRE should be
CPACK_RPM_PACKAGE_REQUIRES_POST.
In this hunk:
+ # The following keywords require braces around the "pre" or "post"
suffix in the final RPM spec file.
+ if("${_RPM_SPEC_HEADER}" MATCHES "REQUIRES_PRE" OR
"${_RPM_SPEC_HEADER}" MATCHES "REQUIRES_POST")
+ string(REPLACE "_" "(" _PACKAGE_HEADER_NAME
"${_PACKAGE_HEADER_NAME}")
+ set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})")
+ endif()
Shouldn't braces be called parentheses here ( i.e '(' versus '{' )?
I have checked with a minimal project on a ubuntu 14.04 box (using rpm
4.11.1) and the generated package seems good. So, no further comments.
With kind regards,
Micha Hergarden
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141019/924d9cfc/attachment-0002.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141019/924d9cfc/attachment-0002.sig>
More information about the cmake-developers
mailing list