Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 40127

Summary: Third-Party Tool Request - Checkpointing and restoring packages states, e.g. `emerge undo`.
Product: Portage Development Reporter: rodgling <dav1dr>
Component: Third-Party ToolsAssignee: Portage Tools Team <tools-portage>
Status: CONFIRMED ---    
Severity: enhancement CC: gentoo, kalium, m.debruijne, mmokrejs, pacho, pf_wall79, sam, schulz.benjamin
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://ostreedev.github.io/ostree/
See Also: https://bugs.gentoo.org/show_bug.cgi?id=537080
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 472746, 748108    

Description rodgling 2004-02-01 13:50:01 UTC
This is an idea I've been working on for a little while. In short, it adds a couple of new features to emerge, specifically:

emerge undo  - undo last emerge action
emerge restore [date] - restore installed software to as it was on date X
emerge checkpoint - update installed software list after manually using ebuild as opposed to emerge

where [date] is either:
(a) a number, e.g. "5" = undo last 5 emerges
(b) a date, e.g. "2004/02/01-12:11:29"
(c) a relative time, e.g. "2d" = 2 days ago

Sample output:

 stimpy pym # emerge -p undo

Restoring from 2004/02/01-19:25:30

>>> These are the packages that I would merge, in order:

[ebuild     UD] app-portage/gentoolkit-0.1.38 [0.2.0_pre5]

Package flags, binaries, package renames etc are all handled correctly. It's been well tested over a year or so. For the last six months it's been solid.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.




The relevant patches are at:
http://www.cs.swan.ac.uk/~csdave/portage/

Both /usr/lib/portage/pym/portage.py and /usr/lib/portage/bin/emerge need
patching. Patches are against 2.0.50_pre21.
Comment 1 Marius Mauch (RETIRED) gentoo-dev 2004-02-04 23:02:00 UTC
*** Bug 2042 has been marked as a duplicate of this bug. ***
Comment 2 rodgling 2004-02-08 11:43:52 UTC
You may need to rengenerate /usr/lib/portage/pym/portage.pyc (or emerge will crash). This is done by first patching, and then:

cd /usr/lib/portage/pym
python -c "import portage"

Patches against 2.0.50 are at http://www.cs.swan.ac.uk/~csdave/portage/
Comment 3 SpanKY gentoo-dev 2005-03-14 07:06:02 UTC
*** Bug 85146 has been marked as a duplicate of this bug. ***
Comment 4 Benjamin Schulz 2005-03-14 08:00:05 UTC
I think it would be nice since with emerge -uD world, often many package are emerged, the user could specify the package to undo.

for example, I installed recently with emerge -uD world a buggy graphics driver by nvidia. I only needed the old driver back, but had not noticed it's version number. It would be good if I could type

emerge --undo package

and the last installed package is re emerged.

Also an emerge --undo D package 

that re emerges all older librarys which new versions would not work because of the re- emerge of the old version of "package"
Comment 5 rodgling 2005-03-14 11:47:57 UTC
It already has this exact functionality :-)

Just use emerge --undo [list of packages or regexes]

e.g.

emerge --undo .*nvidia.*

Unfortunately as can be seen by the version of the patch, I haven't updated this for some time, and probably won't as no-one seems really interested in putting it into main-line portage. But it should be easy to get it up to date again.
Comment 6 Jason Stubbs (RETIRED) gentoo-dev 2005-07-28 07:24:38 UTC
Putting a hold on feature requests for portage as they are drowning out the 
bugs. Most of these features should be available in the next major version of 
portage. But for the time being, they are just drowning out the major bugs and 
delaying the next version's progress. 
 
Any bugs that contain patches and any bugs for etc-update or dispatch-conf can 
be reopened. Sorry, I'm just not good enough with bugzilla. ;) 
Comment 7 Alec Warner (RETIRED) archtester gentoo-dev Security 2005-10-31 19:13:30 UTC
*** Bug 111079 has been marked as a duplicate of this bug. ***
Comment 8 Zac Medico gentoo-dev 2006-08-07 12:07:40 UTC
*** Bug 143113 has been marked as a duplicate of this bug. ***
Comment 9 Marius Mauch (RETIRED) gentoo-dev 2007-01-11 13:01:41 UTC
Reopening for duping.
Comment 10 Marius Mauch (RETIRED) gentoo-dev 2007-01-11 13:03:25 UTC
Actually this isn't a dupe of 127797
Comment 11 Zac Medico gentoo-dev 2013-02-15 21:04:55 UTC
I think this kind of functionality is best handled via filesystem-level snapshots, like btrfs supports via subvolume snapshots. I'm not so sure it would be a good idea for portage to be aware of such things, since it's easy enough for the user to manage with the tools of his/her choice.
Comment 12 Zac Medico gentoo-dev 2018-05-02 12:09:17 UTC
*** Bug 654586 has been marked as a duplicate of this bug. ***
Comment 13 Brian Dolbec (RETIRED) gentoo-dev 2020-10-13 21:14:18 UTC
There is also defaulting to building binpkgs, and restoring an unmerged pkg from it.  That won't track any manual config changes though.
Comment 14 Zac Medico gentoo-dev 2020-10-14 07:07:00 UTC
We can create a gentoo-ostree, like https://github.com/coreos/rpm-ostree, but for gentoo.