Re: Backup package and dpkg (was Re: dpkg-disappear-replace.txt)
Richard Kettlewell <firstname.lastname@example.org> said:
> Bill Mitchell writes:
> [...] The aging mechanism would need to be smart enough to
> >remove entries which, in light of later package operations, no
> >longer make a difference.
> Is the information we already have sufficient?
> [... example, showing empty .list file after package removal ...]
> ...or is more need than that?
I haven't thought much about this, but I'll plunge ahead anyhow.
I'm afraid that the following will probably raise more questions
than it answers. Let's take an example:
dpkg --install textutils.deb
dpkg --install --force-conflcts elv-fmt.deb
dpkg --remove elv-fmt.deb
This leaves us with /usr/bin/fmt and /usr/man/man1/fmt.1 missing.
That's probably not intended, but if that is the state of the system
at backup time, that's the state which should be preserved through
backup+restore operations (or so I presume).
It seems to me that, to restore this system state, dpkg needs
- to realize when installing elv-fmt that files in it overwrite files
in textutils, but that textutils is still needed (it contains other
things than fmt, which need restoring). Textutils --install, then,
would be retained in the ordered list of package operations needed for
restore, and fmt --install added subsequent to that.
- to realize when removing elv-fmt that its removal leaves the
set of files installed by textutils incomplete, and that fmt
needs to be installed and removed after installing textutils
to recover to this state by package operations. The ordered
list of package operations, then, doesn't need the record of the
fmt install operation deleted, then; it needs to have a fmt package
remove operation added to the list. (an alternative would be to
capture the information about which textutils package files would be
left absent by installation and removal of elv-fmt, and directly
remove those files instead of doing the elv-fmt package operations).
If the textutils package is upgraded before removing fmt, /usr/bin/fmt
and /usr/man/man1/fmt.1 would be overwritten, but /usr/doc/copyright/elvis
would remain on the system. In order to restore that state, fmt needs
to be installed, then textutils. The first install operation for
textutils can be safely discarded from the log.
If the textutils package is upgraded after removing fmt, this returns
the system to the state which it was in before the fmt package was
installed and removed, and the package operations on fmt can be
discarded from the log.
(I'm starting to get a headache...)
This ignores the impact of package files which might have been manually
removed or overwritten by users -- removing /usr/man, /usr/doc, and
/usr/info on a disk-constrained system, for example . Such a
system would likely not have sufficient disk space to go through a
restore by repeating package operations without manual file deletions
taking place between package installations.