It would be very nice to see an inline example in /etc/rpm/macros.d/control so as not to guess the way macro parameters get substituted; like: %post_control -s wheelonly %name x%name Thanks for the macro itself, my specs bloat begins to decrease once more :)
btw, there's http://wiki.sisyphus.ru/devel/control/print developer's docs page now
I'd like to include it in %doc devel.txt form but links -dump form is not suitable.
well, %doc README.html would be better than nothing... 2 mithraen: severely broken page headers on f.i: <meta http-equiv="content-type" content="text/html; charset=" />
Created attachment 2261 [details] control.txt This more or less worked: lynx -assume_charset windows-1251 -dump http://www.freesource.info/wiki/ALTLinux/Sisyphus/devel/control/print or links2 -codepage koi8-r -html-assume-codepage windows-1251 -dump http://www.freesource.info/wiki/ALTLinux/Sisyphus/devel/control/print Attaching the latter (somewhat fixed by hand, textareas broke).
whoops, s/\[IMG\]//g would be nice :o)
Er, so are we comfortable with a few-liner and an attach? Hope to see that included in 4.1 to be a bit more developer-friendly yet :)
Спустя 22 года примера в /etc/rpm/macros.d/control по-прежнему нет: в control 0.8.1-alt1 control.macros содержит только пометки «in %%pre section» / «in %%post section», документации в пакете нет (%files без %doc), а wiki-страница на freesource.info умерла. Патч к control.macros с описанием сигнатур и примером использования; проверено, что макросы раскрываются так же, как раньше (rpm --macros=control.macros --eval '%post_control -s wheelonly foo bar'): --- a/control.macros +++ b/control.macros @@ -1,15 +1,31 @@ # control(8) macros +# +# Usage in a spec file of a package that installs facility scripts +# into %_controldir (one argument per facility): +# +# %pre +# %pre_control foo bar +# +# %post +# %post_control -s wheelonly foo bar +# +# %pre_control saves the current state of the listed facilities on +# package upgrade (control-dump), %post_control restores it (control-restore); +# on first installation %post_control sets every listed facility to the +# status given with -s (default: public). %_controldir %_sysconfdir/control.d/facilities -# in %%pre section. +# %pre_control FACILITY... +# in %%pre section: dump state of the facilities on upgrade. %pre_control() \ if [ $1 -ge 2 ]; then \ /usr/sbin/control-dump %* \ fi \ %nil -# in %%post section. +# %post_control [-s STATUS] FACILITY... +# in %%post section: restore state on upgrade, set STATUS on fresh install. %post_control(s:) \ if [ $1 -ge 2 ]; then \ /usr/sbin/control-restore %* \