Bug 878348 - 'dnf history undo' support missing
Summary: 'dnf history undo' support missing
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 19
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Radek Holy
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:fc62a8fb1b3df17f85cf8613458...
: 905211 907143 913543 (view as bug list)
Depends On:
Blocks: 871892
TreeView+ depends on / blocked
 
Reported: 2012-11-20 08:45 UTC by Vít Ondruch
Modified: 2015-10-06 02:14 UTC (History)
14 users (show)

Fixed In Version: hawkey-0.4.4-1.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-11-12 00:39:01 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: executable (8 bytes, text/plain)
2012-11-20 08:45 UTC, Vít Ondruch
no flags Details
File: environ (1.71 KB, text/plain)
2012-11-20 08:45 UTC, Vít Ondruch
no flags Details
File: core_backtrace (846 bytes, text/plain)
2012-11-20 08:45 UTC, Vít Ondruch
no flags Details

Description Vít Ondruch 2012-11-20 08:45:37 UTC
Description of problem:
I was trying to "undo" installation.

Version-Release number of selected component:
dnf-0.2.15-3.git5d85f6b.fc18

Additional info:
libreport version: 2.0.18
abrt_version:   2.0.18
cmdline:        /usr/bin/python /bin/dnf history undo 3
kernel:         3.6.6-3.fc18.x86_64

backtrace:
:__init__.py:3755:remove:KeyError: 'pattern'
:
:Traceback (most recent call last):
:  File "/bin/dnf", line 35, in <module>
:    yummain.user_main(sys.argv[1:], exit_code=True)
:  File "/usr/lib/python2.7/site-packages/dnf/cli/yummain.py", line 316, in user_main
:    errcode = main(args)
:  File "/usr/lib/python2.7/site-packages/dnf/cli/yummain.py", line 140, in main
:    result, resultmsgs = base.doCommands()
:  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 483, in doCommands
:    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
:  File "/usr/lib/python2.7/site-packages/dnf/cli/yumcommands.py", line 2439, in doCommand
:    ret = self._hcmd_undo(base, extcmds)
:  File "/usr/lib/python2.7/site-packages/dnf/cli/yumcommands.py", line 2303, in _hcmd_undo
:    if base.history_undo(old):
:  File "/usr/lib/python2.7/site-packages/dnf/yum/__init__.py", line 4305, in history_undo
:    if self.remove(pkgtup=pkg.pkgtup):
:  File "/usr/lib/python2.7/site-packages/dnf/yum/__init__.py", line 3755, in remove
:    pattern = kwargs['pattern']
:KeyError: 'pattern'
:
:Local variables in innermost frame:
:tx_return: []
:po: None
:self: <dnf.cli.cli.YumBaseCli object at 0x25eb6d0>
:pkgs: []
:kwargs: {'pkgtup': (u'celt', u'x86_64', u'0', u'0.11.1', u'4.fc18')}

Comment 1 Vít Ondruch 2012-11-20 08:45:40 UTC
Created attachment 648345 [details]
File: executable

Comment 2 Vít Ondruch 2012-11-20 08:45:43 UTC
Created attachment 648346 [details]
File: environ

Comment 3 Vít Ondruch 2012-11-20 08:45:46 UTC
Created attachment 648347 [details]
File: core_backtrace

Comment 4 Ales Kozumplik 2012-11-20 08:51:43 UTC
Hi Vit,

thanks for the report. Undoing history is not yet supported in DNF. Let's use this bugzilla to track the issue.

Comment 5 Ales Kozumplik 2013-02-04 09:16:02 UTC
*** Bug 905211 has been marked as a duplicate of this bug. ***

Comment 6 Ales Kozumplik 2013-02-04 09:18:01 UTC
*** Bug 907143 has been marked as a duplicate of this bug. ***

Comment 7 Heldwin 2013-02-17 22:28:04 UTC
Hello, was trying dnf, but I am getting an error trying to undo history.

version: dnf-0.2.20-1.gitdec970f.fc18.noarch

dnf install gcalctool

dnf history undo 1
Undoing transaction 1, from Sun Feb 17 23:22:56 2013
    Installation  gcalctool-6.6.2-1.fc18.x86_64 @fedora
Traceback (most recent call last):
  File "/bin/dnf", line 35, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 303, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 131, in main
    result, resultmsgs = cli.do_commands()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1478, in do_commands
    return command.doCommand(self.base.basecmd, self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands.py", line 2269, in doCommand
    ret = self._hcmd_undo(extcmds)
  File "/usr/lib/python2.7/site-packages/dnf/cli/commands.py", line 2135, in _hcmd_undo
    if self.base.history_undo(old):
  File "/usr/lib/python2.7/site-packages/dnf/yum/__init__.py", line 2877, in history_undo
    if self.remove(pkgtup=pkg.pkgtup):
TypeError: remove() got an unexpected keyword argument 'pkgtup'

Comment 8 Heldwin 2013-02-17 23:37:41 UTC
dnf.noarch 0:0.2.21-1.git050524e.fc18 does the same

Comment 9 Ales Kozumplik 2013-02-21 16:13:31 UTC
*** Bug 913543 has been marked as a duplicate of this bug. ***

Comment 10 Ankur Sinha (FranciscoD) 2013-05-30 00:56:48 UTC
Really looking forward to the "undo" command. Quite the only thing keeping me from shifting to dnf completely.

Comment 11 Panu Matilainen 2013-05-31 07:46:24 UTC
Adding support for history undo/redo for at least install and erase operations seems like an trivial "s/pkgtup=pkg.pkgtup/pkg.nevra/" operation - based on brief testing it seems to work.

Upgrade/downgrade stumble into issues with .from_system property of dnf.Package class which the history package class doesn't have so that needs something more involved. OTOH undo/redo of upgrade/downgrade cannot be guaranteed to succeed anyway as the previous version might not be available in the repositories anymore.

Ales, I can provide a patch to enable the easy parts for starters if you want, or would you prefer fixing it all before enabling any of the bits?

Comment 12 Ales Kozumplik 2013-05-31 10:36:01 UTC
> something more involved. OTOH undo/redo of upgrade/downgrade cannot be
> guaranteed to succeed anyway as the previous version might not be available
> in the repositories anymore.

Yeah, nothing we can do anything about.

> Ales, I can provide a patch to enable the easy parts for starters if you
> want, or would you prefer fixing it all before enabling any of the bits?

I guess starting with the easy bits should work as long as we keep this bugzilla open to finish the rest. Do you want to take it?

Comment 13 Ales Kozumplik 2013-08-13 15:06:54 UTC
(not working on this now)

Comment 14 Radek Holy 2013-10-29 17:17:20 UTC
Fixed by 9915abe91b89158f0552d8fa3fbc024a3e9deb16 on master.

Comment 15 Fedora Update System 2013-10-30 10:08:35 UTC
dnf-0.4.6-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/dnf-0.4.6-1.fc20

Comment 16 Fedora Update System 2013-10-30 17:13:46 UTC
Package dnf-0.4.6-1.fc20, libsolv-0.4.0-1.gitd49d319.fc20, hawkey-0.4.4-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.4.6-1.fc20 libsolv-0.4.0-1.gitd49d319.fc20 hawkey-0.4.4-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-20333/libsolv-0.4.0-1.gitd49d319.fc20,hawkey-0.4.4-1.fc20,dnf-0.4.6-1.fc20
then log in and leave karma (feedback).

Comment 17 Fedora Update System 2013-10-31 14:22:10 UTC
hawkey-0.4.4-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/hawkey-0.4.4-1.fc20

Comment 18 Fedora Update System 2013-10-31 17:42:08 UTC
Package hawkey-0.4.4-1.fc20, dnf-0.4.6-1.fc20, libsolv-0.4.0-1.gitd49d319.fc20, librepo-1.3.0-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing hawkey-0.4.4-1.fc20 dnf-0.4.6-1.fc20 libsolv-0.4.0-1.gitd49d319.fc20 librepo-1.3.0-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-20406/dnf-0.4.6-1.fc20,libsolv-0.4.0-1.gitd49d319.fc20,librepo-1.3.0-1.fc20,hawkey-0.4.4-1.fc20
then log in and leave karma (feedback).

Comment 19 Heldwin 2013-10-31 21:23:11 UTC
if I do a: dnf clean all

I get: 

# dnf update
Traceback (most recent call last):
  File "/bin/dnf", line 35, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 277, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 64, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 133, in _main
    result, resultmsgs = cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1360, in run
    load_available_repos=lar)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 223, in activate_sack
    self._add_repo_to_sack(r.id)
  File "/usr/lib/python2.7/site-packages/dnf/base.py", line 133, in _add_repo_to_sack
    repo.load()
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 420, in load
    handle = self._handle_new_remote(tmpdir)
  File "/usr/lib/python2.7/site-packages/dnf/repo.py", line 207, in _handle_new_remote
    h.setopt(librepo.LRO_FASTESTMIRRORCACHE,

But I replace LRO_FASTESTMIRRORCACHE with LRO_FASTESTMIRROR, I can then update, but really not sure it is the correct value. Just changed it as a test.

Comment 20 Heldwin 2013-10-31 21:24:11 UTC
Sorry, was missing the last error:

AttributeError: 'module' object has no attribute 'LRO_FASTESTMIRRORCACHE'

Comment 21 Michal Schmidt 2013-10-31 21:28:14 UTC
(In reply to Heldwin from comment #20)
> AttributeError: 'module' object has no attribute 'LRO_FASTESTMIRRORCACHE'

That's bug 1024776.

Comment 22 lnie 2013-11-05 05:49:19 UTC
fixed with the latest updates.
Installed packages can be erased with undo history command.

Comment 23 lnie 2013-11-05 05:57:09 UTC
Also,"dnf clean all" seems fine

Comment 24 Fedora Update System 2013-11-12 00:39:01 UTC
hawkey-0.4.4-1.fc20, dnf-0.4.6-1.fc20, libsolv-0.4.0-1.gitd49d319.fc20, librepo-1.3.0-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.