[Yum-devel] install/update/erase cases
Jeremy Katz
katzj at redhat.com
Wed Oct 26 18:15:26 UTC 2005
On Mon, 2005-10-24 at 11:08 -0400, seth vidal wrote:
> I'm putting some thought into generic install/erase/update methods in
> the base yum class. Some error/sanity checking before passing the
> package objects onto tsInfo.
Also would avoid a lot of cut and paste code which I know exists in a
number of different places at this point. Per what we were talking
about earlier, it would probably be good if these took either a package
object or some way of specifying at least name and arch (although
probably full nevra).
> What I'm running into right now is the
> confusing cases where a package is being put into two, potentially
> opposing, states. Some examples and what I _think_ should happen:
>
> short version:
> - install/update 'wins' over erasures
Yep, definitely sane
> - installs can be converted to updates
Sure. Install vs Update is largely semantics, imho. Arguably, they
could just be one operation
> - update calls for pkgs that do not have an older version installed
> will raise an error
The main reason this is annoying is because it requires finding out from
the caller if the package was already installed. As above, I'm not
convinced that they're really different operations.
> odd cases/questions:
> - if requesting install but same pkg is marked as erase then install
> or - should we remove the pkg marked as erase and mark the newer pkg
> as an update?
Or if it's the _same_ package, do they cancel out and you do nothing for
the package? If it's asking for a different version, then erase +
install gets rid of need to make sure the one being installed is "newer"
> - if requesting install/update but older pkg is marked to be installed.
> If pkgs are install-only - then install them
> If pkgs are not install-only then install/update the newest/best
> one
Agree with Ignacio here I think
> - if requesting install/update but newer pkg is marked to be installed
> If pkgs are install-only - then install them
> if pkgs are not install-only then install/update the newest/best
> one
If a newer package is marked to be installed, then that's fine unless
they're specifying an exact version. Which I think means I agree with
Ignacio again :)
> - if requesting update but package is an install then:
> mark the pkg as an install
> or
> don't do anything - return/raise an error.
> (arguably, earlier functions should have vetted this case and
> returned proper errors but it might make sense to let this function do the
> thinking for this)
This is part of why I think that trying to do update vs install as
different is a path to madness.
> - if requesting erase - but package is marked to be installed/updated
> then:
> - raise an error about the problem
> - discard the erase request and emit log
> - silently discard the erase request
Discard and log. Or provide the information and let the caller go on
anyway in some fashion. This becomes a big deal if you install foo
which requires bar (already installed) and then marked bar for removal.
If you raise an error, then you start going down the path which ends at
dselect ;)
> - if requesting install/update of two mutually obsoleting packages:
> - raise exception?
> - install the first one?
> - install the second one?
Bad monkey! No matter what you do here, the user is going to get
confused when they go to update again (and then again and ...). So I
guess giving back an error is sane :/
> - if requesting install/update of two conflicting packages:
> - raise exception?
> - install the first one?
> - install the second one?
Conflicts I think you have to error about.
Jeremy
More information about the Yum-devel
mailing list