[pacman-dev] [PATCH] Improve changelog handling

Allan McRae mcrae_allan at hotmail.com
Fri Dec 7 19:38:49 EST 2007


Aaron Griffin wrote:
> On Dec 7, 2007 5:35 PM, Xavier <shiningxc at gmail.com> wrote:
>   
>> On Fri, Dec 07, 2007 at 12:54:36PM -0600, Aaron Griffin wrote:
>>     
>>>> I was thinking exactly the same as Andrew, why not just using
>>>>   ssize_t archive_read_data(struct archive *, void *buff, size_t len);
>>>>
>>>> I don't understand what you are saying however, about returning a fd.
>>>>         
>>> Oh man, ignore what I said - I was overthinking that to the parsing
>>> routines and all that jazz - in this case we're returning the
>>> changelog as an alpm_list_t of strings. Yes, in this case it would
>>> definitely be better to read direct from the archive. HOWEVER, you
>>> can't read line by line... what you need to do is make some sort of
>>> "archive_readline" function that reads one char at a time until a
>>> newline char. It's annoying, but that's the best we can do until
>>> libarchive gets a "readline" function.
>>>
>>>       
>> Oh ok, yes it looks like you are right. However, there is a point that is
>> unclear to me : why exactly do we need to read line by line?
>>     
>
> True, we don't need to. The current function is returning a
> alpm_list_t that contains lines, but i guess it's not really needed.
> We can return the full text as one big string, and leave it up to
> front ends to do some sort of parsing if they wish
>   
I initially tried something like this, using archive_read_data to get 
the data, given it is suggested where pkginfo is read.  However, I was 
finding it it hard to produce output in a consistent format with the 
PKG_FROM_CACHE case in order to pass to dump_pkg_chagnelog.  This was 
likely to be more to do with my lack of experience with C "strings" 
rather than it not being possible...

Allan






More information about the pacman-dev mailing list