Bug 878348 - 'dnf history undo' support missing
'dnf history undo' support missing
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
19
x86_64 Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Radek Holy
Fedora Extras Quality Assurance
abrt_hash:fc62a8fb1b3df17f85cf8613458...
:
: 905211 907143 913543 (view as bug list)
Depends On:
Blocks: 871892
  Show dependency treegraph
 
Reported: 2012-11-20 03:45 EST by Vít Ondruch
Modified: 2015-10-05 22:14 EDT (History)
14 users (show)

See Also:
Fixed In Version: hawkey-0.4.4-1.fc20
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-11-11 19:39:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description Vít Ondruch 2012-11-20 03:45:37 EST
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 03:45:40 EST
Created attachment 648345 [details]
File: executable
Comment 2 Vít Ondruch 2012-11-20 03:45:43 EST
Created attachment 648346 [details]
File: environ
Comment 3 Vít Ondruch 2012-11-20 03:45:46 EST
Created attachment 648347 [details]
File: core_backtrace
Comment 4 Ales Kozumplik 2012-11-20 03:51:43 EST
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 04:16:02 EST
*** Bug 905211 has been marked as a duplicate of this bug. ***
Comment 6 Ales Kozumplik 2013-02-04 04:18:01 EST
*** Bug 907143 has been marked as a duplicate of this bug. ***
Comment 7 Heldwin 2013-02-17 17:28:04 EST
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 18:37:41 EST
dnf.noarch 0:0.2.21-1.git050524e.fc18 does the same
Comment 9 Ales Kozumplik 2013-02-21 11:13:31 EST
*** Bug 913543 has been marked as a duplicate of this bug. ***
Comment 10 Ankur Sinha (FranciscoD) 2013-05-29 20:56:48 EDT
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 03:46:24 EDT
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 06:36:01 EDT
> 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 11:06:54 EDT
(not working on this now)
Comment 14 Radek Holy 2013-10-29 13:17:20 EDT
Fixed by 9915abe91b89158f0552d8fa3fbc024a3e9deb16 on master.
Comment 15 Fedora Update System 2013-10-30 06:08:35 EDT
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 13:13:46 EDT
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 10:22:10 EDT
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 13:42:08 EDT
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 17:23:11 EDT
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 17:24:11 EDT
Sorry, was missing the last error:

AttributeError: 'module' object has no attribute 'LRO_FASTESTMIRRORCACHE'
Comment 21 Michal Schmidt 2013-10-31 17:28:14 EDT
(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 00:49:19 EST
fixed with the latest updates.
Installed packages can be erased with undo history command.
Comment 23 lnie 2013-11-05 00:57:09 EST
Also,"dnf clean all" seems fine
Comment 24 Fedora Update System 2013-11-11 19:39:01 EST
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.