[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt_preferences



>>>>> "Daniel" == Daniel Burrows <dburrows@debian.org> writes:

    Daniel> On Tue, Feb 26, 2002 at 05:32:37PM -0700, Jason Gunthorpe <jgg@debian.org> was heard to say:

    >> IMHO you should take the approach that the user of aptitude should expect
    >> that such changes are permanent and write it to the preferences file. It
    >> was intended to be written by a GUI to retain exactly these sorts of
    >> things.

    Daniel>   Hm, ok.  I'll take a serious look at it sometime.  Clobbering the whole
    Daniel> file isn't nice, but maybe I can use a "##  BEGIN APTITUDE SETTINGS" approach.
    Daniel> (although that means they can't edit the whole file from aptitude)

 You don't have to clobber the whole file if you do it right.  Can't
 you parse it into records where there are several types of record.
 One type is "comment", and you keep them ordered.  Then, your record
 objects have write methods that print themselves back out (to the
 preferences file).  You walk the list and call the write method on
 each object, to save the changes, preserving comments added by a user
 hand-editting the preferences file.

 It would be nice if you'd not keep the data all cached in aptitude,
 but did things in such a way that an edit of preferences from in a
 separate terminal would make that show up right away inside aptitude.
 Maybe use an md5sum or just stat timestamp to see if it's been
 touched, and re-read it if so?  A decent text editor will warn you if
 the file on disk has been changed, so conflict resolution should be
 possible when aptitude writes it's changes out right away after
 making them.

 And then, you can edit the whole file from aptitude.

-- 
mailto: (Karl M. Hegbloom) karlheg@microsharp.com
Free the Software  http://www.debian.org/social_contract
http://www.microsharp.com
phone://USA/WA/360-260-2066



Reply to: