Archive for August 16th, 2006

Introducing an Eclipse spec-file editor

Wednesday, August 16th, 2006

A couple of weeks ago the guys in the Eclipse group in the office got together to try and hack together an initial version of a spec-file editor for Eclipse, and learn how to write editors for Eclipse in the process.

We spent a couple of hours on it and got it kinda working. It wasn’t really an editor because it didn’t have any extra editing features, but we did get some syntax highlighting done in addition to figuring out at a high level how Eclipse editors work.

Last week I spent some time fixing up our work on the editor. It still not much, but I have working and pretty nice looking syntax highlighting working right now. Take a look:

The squigly white line in the middle is my amazing artistic skills when combining 2 shots :) .

Now I’m trying to figure out how to do content outlining, and the next step after that would probably be formatting or simple error highlighting. In the slightly further future we can have things like content-assist, validation (a.k.a. not-so-simple error highlighting), validation with external tools like rpmlint, and other goodies.

A lot of these features require parsing spec files, which right now isn’t that easy. I haven’t found any source of information that have a precise/formal definition of spec-file syntax. Basically I want to know 2 things:

  • What are the rules that rpmbuild/rpmlint use for reading or validating a spec file.
  • Is there a library that I can interface to that would do this for me?

I thought initially that rpmlib would be able to do the parsing, but the docs I read on it suggest that that would be outside of rpmlib’s scope.

Any ideas out there?

P.S. you can check out the editor at pserver:anonymous@sourceware.org:/cvs/eclipse under the rpm module. (Tip paste the CVS string pserver…/eclipse into Eclipse’s new CVS repository wizard).