tags 404861 -moreinfo
thanks

Frank Küster <[EMAIL PROTECTED]> wrote:

> Paul Slootman <[EMAIL PROTECTED]> wrote:
>
>>> > IMHO, comments should
>>> > be preserved, 
>>> 
>>> Often this is possible using sed on the configuration file.
>>
>> The thing is, upstream provides a quite complicated perl script to
>> handle the upgrades; and that script is pretty good at doing that,
>> apart from the fact that comments aren't preserved.
>> It will be very difficult to make it preserve comments, if not
>> impossible.
>
> I looked at the script - it *has* clever code to preserve comments.  

Sorry, I was wrong here:  It has code to extract the comments from the
*new* version of the file and mix them with the updated non-comment
parts. 

Which sounds like a very clever idea; outdated comments explaining
outdated syntax are harmful.  Still, user-provided comments are
worthwile preserving.

Maybe using ucf and it's --three-way merging option could help here.  I
have no experience, though, whether this can be used if the version we
upgrade from did not use this option.  But in any case, it might be a
good idea to get a version of wwwoffle into etch that uses ucf
--three-way for wwwoffle.conf, so that this bug can finaly be resolved
post-etch.  The general scheme for this would be:

- copy existing /etc/wwwoffle/wwwoffle.conf to a temporary directory

- let upgrade-wwwoffle.pl handle this tempfile to produce the default
  new file

- call

ucf --three-way $tempdir/wwwoffle.conf /etc/wwwoffle/wwwoffle.conf

This will not ask any question if there are no comment changes.  If
there are, it will show a diff where one version has only
old-package-comments+user-comments, and the other has
new-package-comments. 

Plust the usual things in "postrm purge", checking whether ucf is still
there. 

Unless ucf itself provides options to do a three-way merge when used for
the first time, it could be tweaked to do it like this:

- ship the old default wwwoffle.conf in the deb

- in postinst, do

mv /etc/wwwoffle/wwwoffle.conf /etc/wwwoffle/backup/wwwoffle.conf
ucf --three-way old.default.wwoffle.conf /etc/wwwoffle/wwwoffle.conf
cp /etc/wwwoffle/wwwoffle.conf $tmpdir/wwwoffle.conf
update-wwwoffle.pl # acts on $tmpdir/wwwoffle.conf
                   # produces $tmpdir/new.default.wwoffle.conf
mv /etc/wwwoffle/backup/wwwoffle.conf  /etc/wwwoffle/wwwoffle.conf
ucf --three-way $tmpdir/new.default.wwoffle.conf /etc/wwwoffle/wwwoffle.conf
                   # this asks questions about comment changes

(untested, and I'm going on vacation in a couple of hours).

Regards, Frank
-- 
Dr. Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)

Reply via email to