quarta-feira, julho 25, 2007

Weird behavior of Lua RPM scriptlets

RPM allows packagers to write scriptlets and macros in specfiles using the Lua language. That's a really nice feature but seems nobody is using it and thus it is not being properly tested:
$ rpm -q --qf '%{VERSION}\n' --specfile teste.spec
error: line 8: Unknown tag: ðâ
error: query of specfile teste.spec failed, can't parse
$ cat teste.spec
%{lua: print("Name: foo") }
%{lua: print("Version: bar") }
Release: 1
Group: Foo/bar
License: GPL
Summary: summary
Buildroot: %_tmpdir/%name
Note the unknown tag rpm is complaining about "ðâ", which seems to be gargabage. It happens always when calling print more than once and can't be reproduced with "rpm --eval". Really weird.

My dirty workaround was to append all needed lines in a table and then dump all these lines with only one call of print().

segunda-feira, julho 09, 2007

Some reasons to use (g)make

The following excerpt from the ISconf history describes well why I like make(1) for writing scripts:
Its functionality is dependent on three key features:
  • Deterministic Ordering
  • Failure on error
  • State maintenance
Because make is the only tool that fulfills all of these requirements in its default state, it was chosen as the basis for ISconf.
I think make(1) is specially good for those scripts that will be called directly from the command line.