简体   繁体   中英

yum downgrade does not remove new package

Release 1 contains the following packages

Package A-1.0
Package B-1.0

Release 2 contains the following packages

Package A-2.0
Package B-2.0
Package C-2.0

In Release 2 , Package B-1.0 was split into two packages - package B-2.0 and package C-2.0 .

Now when Release 2 is installed, how do I downgrade to Release 1 ?

yum downgrade AB tries to install package B-1.0 which has file conflicts with package C-2.0 .

yum downgrade ABC does not work because there is no older version for Package C .

Is there a single command through which it erases the new package ( package C-2.0 ) and downgrades packages A and B?

If you upgraded several packages and then you want to downgrade just those two, then it cannot be done. Not using just yum (unless you use --nodeps and temporary break deps). There are high level tools like RH Satellite, which can do that.

If you upgrade just those in separate transaction then you can run:

   yum history list
   yum history undo <ID>

or

   yum history undo last

And it will rollback that transaction. Ie in your case downgrade those packages. See man page of yum for details about history command.

It might be too late as you have already released packages A-2.0 and B-2.0, but what you should have done (and can still do if you can delete your A-2.0 and B-2.0 packages):

In spec file of A-2.0 and B-2.0 add: Requires: C

This has multiple advantages you search (and more):

  • when updating A and/or B; C will be automatically installed.
  • when uninstalling CA and B will be downgraded.

However:

  • when downgrading A and B; C will not be uninstalled.

There is an alternative which I use for my projects: I use a meta-package :

  • meta-package-1.0: Requires A-1.0, B-1.0, Conflicts C
  • meta-package-2.0: Requires A-2.0, B-2.0, C-2.0

(and I use a branch with an unstable meta-package preparing next release: meta-package: Requires A, B)

You can use yum shell to write multiple operations before executing them all in a single transaction.

In your case, you can use the following:

yum shell
yum downgrade A B
yum remove C
run

you just need to use the repo that was referred while executing the earlier yum command.

yum history undo <yum_history_id> --enablerepo=<yum_repo>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM