On Mon, Dec 30, 2002, Ralf S. Engelschall wrote:

> I've today introduced the new %option(s) handling. For this the
> openpkg-tool package was also upgraded to correctly understand
> the %option directives in %description fields. If you're running
> OpenPKG-CURRENT, please make sure that you NOW first upgrade
> "openpkg-tool" only. Then do your usual "openpkg build -Ua". If you
> upgrade to the new packages with the old "openpkg-tool" your with_xxx
> options will not be handled correctly.

We today finalized the implementation by replacing the %options (note
the "s") in %description with a "Provides:" header based approach. To
clarify the stuff for all of you:

1. Package options are introduced with "%option <name> <value>" only. It
   is not allowed to just "%define <name> <value>", because this way they
   are not "Provided".

2. "%option" directives _HAVE_ to be placed after the (usually first)
   .spec part where the "Name:" header is part of. This is because
   %option requires the definition of "Name:" for its own operation.

3. The effect of "%option <name> <value>" is a "%ifndef <name>"+"%define
   <name> <value>"+"%endif" plus a "Provides: <package>::<name> =
   <value>". The "%define" part is so that you can check for the option
   while building with '%if "%{<name>}" == "<value>"'+'%endif'. The
   "Provides" part is so that the package exports the option.

4. You can view the options a package provides via multiple ways:

   a) if you have foo.spec file, just run "grep '^%option' foo.spec"

   b) if you have a source or binary RPM foo*.rpm, run "rpm -qpi
      foo*.rpm" and watch under "Provides:" or run alternatively "rpm
      -qp --provides foo*rpm". For this to work also with source RPMs,
      I've this evening patched RPM, so don't be confused.

   c) if you have an installed foo package, run "rpm -qi foo" and watch
      under "Provides:" or run alternatively "rpm -q --provides foo".

5. As usual, you can set/override option values on the "rpm --rebuild"
   command line with "--define '<name> <value>'".

6. As usual, another package can depend on the package <package> via
   "[Build]PreReq: <package>". Additionally, it can also depend on
   <package> to be build under option <name> with <value> by using
   "[Build]PreReq: <package>::<name> == <value>".

7. Any package using %option _has_ to require at least "openpkg >=
   20030103".

                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
Developer Communication List                   [EMAIL PROTECTED]

Reply via email to