On Jun 18, 2008, at 10:12 AM, Marcin ‘Qrczak’ Kowalczyk wrote: > 2008/6/18 Elan Ruusamäe <[EMAIL PROTECTED]>: > >> rpm5 doesn't parse macro params mixed with options like like rpm >> 4.4.9 / 4.5 >> does. > > Thank you for enlightenment. So... any plans how to resolve this? >
The problem boils down to whether POSIX behavior is desirable or not. getopt (as used in rpm-4.4.9 parameterized macros) already had a means to specify whether POSIX behavior for parameterized macro option/arg processing was desired. Here's the relevant section from "man 3 getopt" By default, getopt() permutes the contents of argv as it scans, so that eventually all the non-options are at the end. Two other modes are also implemented. If the first character of optstring is ’+’ or the environment variable POSIXLY_CORRECT is set, then option processing stops as soon as a non-option argument is encountered. If the first character of optstring is ’-’, then each non-option argv- element is handled as if it were the argument of an option with character code 1. (This is used by programs that were written to expect options and other argv-elements in any order and that care about the ordering of the two.) The special argument "--" forces an end of option-scanning regardless of the scanning mode. So %define foo(+ab:cd:) whatever should (unchecked) turn on POSIX behavior (like in rpm-5.0) in rpm-4.4.9. In rpm-5.0, OpenPKG is making extensive use of macros, and, unlike linux glibc, the default behavior and expectation on *BSD is POSIX options-before-args behavior. So popt rather than getopt is now used, and the popt equivalent for POSIXLY_CORRECT is in the last argument to (from rpmio/macro.c): optCon = poptGetContext(argv[0], argc, argv, optTbl, POPT_CONTEXT_NO_EXEC|POPT_CONTEXT_POSIXMEHARDER); The resolution will be to adopt the getopt leading "+" convention to set (or unset) POPT_CONTEXT_POSIXMEHARDER. Its likely 5-6 lines of C in rpmio/macro.c grabArgs() to achieve a resolution. "Patches cheerfully accepted." 73 de Jeff > -- > Marcin Kowalczyk > [EMAIL PROTECTED] > http://qrnik.knm.org.pl/~qrczak/ > _______________________________________________ > pld-devel-en mailing list > pld-devel-en@lists.pld-linux.org > http://lists.pld-linux.org/mailman/listinfo/pld-devel-en _______________________________________________ pld-devel-en mailing list pld-devel-en@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-devel-en