I’m still no great shakes as a Ruby coder, but I’m continually amazed at how much can be accomplished with a very few lines of code.
As an example, I mentioned that I’ve been buiding a lot of Solaris packages and Linux binary RPMS lately. One thing I miss on Linux is an equivalent to Solaris’ pkgproto command, which is used like this:
find /path/to/binaries | pkgproto > prototype , or also
pkgproto path ... > prototype
This is how Solaris handles the equivalent of the %files section of a RPM spec file. One thing to like about pkgproto is that it captures owner, group and permissions of each file. Linux supports an
%attr(owner,group,perms) name-of_file
construct; however, Linux provides no tool to directly generate this. In a very few lines of Ruby, I was able to implement a pkgproto equivalent that produces output with each line looking like this:
file_type %attr(uid,gid,perms) filename
This can then be read into the RPM %files section (after stripping the first field). I prefer to use a separate file, combined with the %files -f in the RPM spec file. I’ll discuss how I use that first field in a subsequent installment.
I love that Ruby; a tool to build tools.
-k-



![Validate my Atom 1.0 feed [Valid Atom 1.0]](http://www.quietvoice.org/wp-images/valid-atom.png)