diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-01-02 12:25:29 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-01-02 16:19:40 +0100 |
commit | 55153bf94ff28a23318e79aa48242244c4d82b3c (patch) | |
tree | 5785ef3cffe2d70ed3e0a581a016b1ed1c3f8cdd /test/integration/test-apt-get-source-arch | |
parent | 5f1b8fadbba7108ba20bd07c7479eb5e5704308e (diff) |
add optional support for comments in pkgTagFile
APT usually deals with perfectly formatted files generated automatically
be other programs – and as it has to parse multiple MBs of such files it
tries to be fast rather than forgiving.
This was always a problem if we reused this parser for files with a
deb822 syntax which are mostly written by hand however, like
apt_preferences or the deb822-style sources as these can include stray
newlines and more importantly comments all over the place.
As a stopgap we had pkgUserTagSection which deals at least with comments
before and after a given stanza, but comments in between weren't really
supported and now that we support parsing debian/control for e.g.
build-dep we face the full comment problem e.g. with comments inbetween
multi-line fields (like Build-Depends).
We can't easily deal with this on the pkgTagSection level as the interface
gives access to 'raw' char-pointers for performance reasons so we would
need to optionally add a buffer here on which we could remove comments
to hand out pointers into this buffer instead. The interface is quite
large already and supports writing stanzas as well, which does not
support comments at all either. So while in future it might make sense
to have a parser setup which deals with and keeps comments in this
commit we opt for the simpler solution for now: We officially declare
that pkgTagSection does not support comments and instead expect the
caller to deal with them, which in our case is pkgTagFile:
pkgTagFile is extended with an additional mode which can deal with
comments by dropping them from the buffer which will later form the
input of pkgTagSection. The actual implementation is slightly more
complex than this sentence suggests at first on one hand to have good
performance and on the other to allow jumping directly to stanzas with
offsets collected in a previous run (like our cache generation does it
for example).
Diffstat (limited to 'test/integration/test-apt-get-source-arch')
0 files changed, 0 insertions, 0 deletions