[pacman-dev] [PATCH] Separate file parsing from backend

Henning Garus henning.garus at googlemail.com
Wed Sep 23 11:36:24 EDT 2009


On Wed, Sep 23, 2009 at 05:03:22PM +0200, Xavier wrote:
> On Wed, Sep 23, 2009 at 2:46 PM, Henning Garus
> <henning.garus at googlemail.com> wrote:
> > Split the huge list of else ifs which was used for parsing  'desc',
> > 'depends', 'files' and 'deltas' files, into separate functions and move
> > them to a new file parse.c . This makes it possible for other backends
> > to share the same parse code. Also change the parsing from the giant
> > else if list to a single loop calling different functions as specified
> > in an array of parser structs (see  parse_lines() for details).
> >
> > Move _alpm_delta_parse to parse.c and make it static.
> >
> > Signed-off-by: Henning Garus <henning.garus at gmail.com>
> > ---
> >
> > I actually managed to make it longer, instead of shorter (well if you
> > take out comments and license headers this version is roughly as long
> > as the old one), however I think it is more readable. Feel free to call
> > it overkill though.
> >
> > I don't really like the ugets stuff I used to get the next line, but I
> > wanted this to work on something other than FILE*, even though this is
> > not used (yet), and this was the best thing I could come up with. I
> > toyed around with using fopencookie, but that sucks when it comes to
> > portability (there is funopen on bsd, beyond that you are simply
> > screwed).
> >
> 
> Well, after a quick look, I would say it looks cool.
> This work was still motivated by tar database backend, right ?
> (http://bugs.archlinux.org/task/8586)
> How far do you think you are from it ? :)
> 
Not much further since we last talked on IRC, I have a working
version, but I am still debating if basing it on Dan's backend branch
might be better, some input from Dan could be helpful in that regard.

> Anyway, I would like to hear what Dan thinks, with all the backend
> work he did last year which was never finished :
> http://code.toofishes.net/cgit/dan/pacman.git/log/?h=backend
> 
Dito, especially about the introduction of a dboperations struct or
something similar.

> Anyway, your work is on a lower level, and dan's work was on a higher
> level, so the two don't seem incompatible at first look.
> 

It should be, Dan did not touch the parsing stuff on that branch at all
iirc. However the branch is outdated in some places by now.


More information about the pacman-dev mailing list