Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
demerge - emerge the other way around
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
ian!
Bodhisattva
Bodhisattva


Joined: 25 Feb 2003
Posts: 3829
Location: Essen, Germany

PostPosted: Wed Apr 11, 2007 10:25 pm    Post subject: demerge - emerge the other way around Reply with quote

"Gentoo is about choice", guess you heard about it at least once. That's why most of us give a lot of packages a try and probably also remove some of them afterwards. Most of us most likely will not. When I became a dev I faced one problem testing packages: 'Keeping my installation clean.' As a developer you often install a lot of packages. Lots of them are still in testing. Your day often looks like:

Code:
# emerge $this
($this comes with deps $bar and $baz that also get installed)
# emerge $that
(bump $this and $that version)
# emerge $this
# emerge $that
# emerge $some_deps
# USE="foo" emerge $that

In the end you installed a lot of stuff and your world file grows. - Wouldn't it be nice to revert all your changes with one simple command? - With demerge you can. - Lemme give a short example:

Code:

# emerge demerge
# demerge --record
# emerge gentoo
# demerge --record
# emerge -C DateManip

Calling demerge now gives:

Code:
# demerge
demerge version 0.029

  Use this program carefully - otherwise you might run into problems.
  You are root. You are responsible for your actions.
  Bugs and requests go to ian <ian@gentoo.org>.


  Found previous states:
    1172352506 (2007-02-24 22:28:26)
          -app-misc/gentoo-0.11.55 USE="nls -gnome -fam"
          +dev-perl/DateManip-5.44 USE=""

    1172352564 (2007-02-24 22:29:24)
          +dev-perl/DateManip-5.44 USE=""

  To revert to one of the previous system-states run 'demerge --restore timestamp'.

So if you want to go back to the state where 'gentoo' was not installed but 'DateManip' was type:

Code:
# demerge --restore 1172352506
 ..
 Packages that will be uninstalled:
  app-misc/gentoo-0.11.55 USE="nls -gnome -fam"
 
 Packages that will be installed:
  dev-perl/DateManip-5.44 USE=""

 Proceed? (y/n):

Type 'y' and watch demerge revert to the given system state. - Now type `demerge` again..

Code:
# demerge
 ...
 
 1172352506 (2007-02-24 22:28:26)
  No differences found.
 
 ...

Just what you expected, right? Let's see what happens if we do something different:

Code:
# USE="gnome" emerge gentoo
# demerge
 ...
  1172352564 (2007-02-24 22:29:24)
         -app-misc/gentoo-0.11.55 USE="nls gnome -fam"
         +app-misc/gentoo-0.11.55 USE="nls -gnome -fam"


See? demerge is useflag aware.
Ok great. Now you decided to like demerge and want it to record the system-state after every --sync. You can do that by:

Code:
# chmod +x /etc/portage/postsync.d/demerge-record

Now after a `emerge --sync` the current system-state will be recorded by demerge automatically so that you always have states at hand to revert to.

After some time you will have quite some stuff on your harddisk. That is when the option --wipe-older comes in handy:

Code:
# demerge --wipe-older 1172352506

Executing this will remove all stuff recorded older than the given timestamp.

Enjoy! And don't forget about `man demerge` ;)
_________________
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Back to top
View user's profile Send private message
purpler
n00b
n00b


Joined: 11 Jan 2007
Posts: 38
Location: /v*/l*/p*/world

PostPosted: Thu Apr 12, 2007 12:59 am    Post subject: Reply with quote

wowwwww
nice oneeee :D
_________________
Our system, who art on raised tile,hallowed be thy OS..
Gentoo.
Back to top
View user's profile Send private message
ian!
Bodhisattva
Bodhisattva


Joined: 25 Feb 2003
Posts: 3829
Location: Essen, Germany

PostPosted: Thu Apr 12, 2007 8:13 pm    Post subject: Reply with quote

Just released demerge-0.040 which will hit the mirrors in just a few.

Changelog wrote:
0.040
- Speedups/Caching (in memory)
- New storage format (uses less disk space; melts down ~13MB to 60kb per state)
- Converter which converts old states (version >=0.027) to the new format
- Overall performance: up to 5 times faster than 0.035
- Do not call GetTerminalSize() from Term::ReadKey when --postsync is called.
(Problems occured while testing on ppc/efika. Reported by Wernfried Haas <amne@gentoo.org>)
- Moved configfile to /etc/demerge.conf (converter takes care about moving your configfile to the new location)


Enjoy!
_________________
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Back to top
View user's profile Send private message
likewhoa
l33t
l33t


Joined: 04 Oct 2006
Posts: 778
Location: Brooklyn, New York

PostPosted: Thu Apr 12, 2007 8:29 pm    Post subject: Reply with quote

thanks for this fine package. will come in handy with my bloated test system.
Back to top
View user's profile Send private message
swimmer
Veteran
Veteran


Joined: 15 Jul 2002
Posts: 1330
Location: Netherlands

PostPosted: Fri Apr 13, 2007 1:41 am    Post subject: Reply with quote

Will this converter be called automagically with the update? Or do we have to do this manually?

And thanks for the good work!!!

Greetz
swimmer
Back to top
View user's profile Send private message
mudrii
l33t
l33t


Joined: 26 Jun 2003
Posts: 789
Location: Singapore

PostPosted: Fri Apr 13, 2007 2:33 am    Post subject: Reply with quote

ian!

Big Thank you for this one

Regards
_________________
www.gentoo.ro
Back to top
View user's profile Send private message
ian!
Bodhisattva
Bodhisattva


Joined: 25 Feb 2003
Posts: 3829
Location: Essen, Germany

PostPosted: Fri Apr 13, 2007 6:37 am    Post subject: Reply with quote

swimmer wrote:
Will this converter be called automagically with the update?

Yes. It will check for old versions and convert them automatically. (Versions recorded with <demerge-0.0.27 cannot be converted btw because these are missing useflag data. The converter will tell you about it in case you have such.)
_________________
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Back to top
View user's profile Send private message
swimmer
Veteran
Veteran


Joined: 15 Jul 2002
Posts: 1330
Location: Netherlands

PostPosted: Fri Apr 13, 2007 8:28 am    Post subject: Reply with quote

Thank you :)
Back to top
View user's profile Send private message
salam
Apprentice
Apprentice


Joined: 29 Sep 2005
Posts: 226

PostPosted: Tue Apr 17, 2007 3:43 pm    Post subject: Reply with quote

does it also record the dependecies which are pulled in with emerging a single package?
Back to top
View user's profile Send private message
ian!
Bodhisattva
Bodhisattva


Joined: 25 Feb 2003
Posts: 3829
Location: Essen, Germany

PostPosted: Tue Apr 17, 2007 7:18 pm    Post subject: Reply with quote

salam wrote:
does it also record the dependecies which are pulled in with emerging a single package?

Sure.

It records all package changes, which useflags are set (on a per package base) and what packages are recorded in the worldfile and which are not. When restoring a state demerge will take care of restoring all that.
_________________
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Back to top
View user's profile Send private message
sonicbhoc
Veteran
Veteran


Joined: 24 Oct 2005
Posts: 1805
Location: In front of the computer screen

PostPosted: Tue Apr 17, 2007 7:20 pm    Post subject: Reply with quote

Woah. Now that sounds interesting. I might give it a shot if I ever get adventurous.
_________________
I'm too lazy to keep this stupid signature up to date, so here's something more interesting:
My friend Hetdegon can draw if you ask me.
Now using PClinuxOS on my laptop and Gentoo on my desktop and new laptop.
Back to top
View user's profile Send private message
ian!
Bodhisattva
Bodhisattva


Joined: 25 Feb 2003
Posts: 3829
Location: Essen, Germany

PostPosted: Wed Apr 18, 2007 8:11 pm    Post subject: Reply with quote

demerge-0.042 is on the way..

Changelog wrote:
0.042
- New option --comment which allows users to leave comments on each state.
- Autocomment on states being recorded before restoring a state.
- Autocomment on states being recorded in postsync hook.
- Option --wipe can now also be used to just delete a single state.


So - just to give a simple example - you now can do something like:

Code:
# demerge --record --comment='Before fixing GLSA 200703-26 [N] file: Integer underflow ( sys-apps/file )'
..
# glsa-check -f 200703-26
..
# demerge
..
 * Found previous states:

   1176926919 (2007-04-18 22:08:39) - Before fixing GLSA 200703-26 [N] file: Integer underflow ( sys-apps/file )
        -sys-apps/file-4.20 USE="python"
        +sys-apps/file-4.19 USE="python"
..

_________________
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Back to top
View user's profile Send private message
plut0
Apprentice
Apprentice


Joined: 21 Dec 2004
Posts: 272

PostPosted: Thu Apr 19, 2007 1:44 pm    Post subject: Reply with quote

Curious, why is this needed when depclean is available? Wouldn't it be better to oneshot your dependencies instead of putting them in the world file?
Back to top
View user's profile Send private message
Kalin
Tux's lil' helper
Tux's lil' helper


Joined: 22 Dec 2002
Posts: 130
Location: Germany

PostPosted: Thu Apr 19, 2007 2:14 pm    Post subject: Reply with quote

Quote:
Curious, why is this needed when depclean is available?

Well, one example was given above: it is useflag aware.
2nd, it remembers (ian!, thanks for --comment option) states for you, so you can revert several steps at a time.

Quote:
Wouldn't it be better to oneshot your dependencies instead of putting them in the world file?

AFAIK, nothing is put in the world file, everything is stored in ~/.demerge/
Back to top
View user's profile Send private message
ian!
Bodhisattva
Bodhisattva


Joined: 25 Feb 2003
Posts: 3829
Location: Essen, Germany

PostPosted: Thu Apr 19, 2007 4:34 pm    Post subject: Reply with quote

plut0 wrote:
Curious, why is this needed when depclean is available?

demerge does way more then depclean does.

Examples:
1.) Before being able to use depclean you would need to know which packages were installed, unmerge them manually and then call depclean.

2.) depclean relies on the dependency information provided by ebuilds. demerge does not. This makes it a lot more safe and sane in cases where ebuilds are missing vital dependency information.

3.) demerge does recall multiple states.

4.) With demerge you simply can go back in time and switch to previous states, revert them again, copy them on other machines and clone installations etc.

demerge was written with a different goal in mind than just being a better --depclean. (See my first post in this thread.)

plut0 wrote:
Wouldn't it be better to oneshot your dependencies instead of putting them in the world file?

Only packages that were in world before will be recorded in world when restoring a state.
_________________
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Back to top
View user's profile Send private message
avx
Advocate
Advocate


Joined: 21 Jun 2004
Posts: 2152

PostPosted: Thu Apr 19, 2007 9:50 pm    Post subject: Reply with quote

Now that's a nice one, thanks! Will this be part of regular emerge at some time?
Back to top
View user's profile Send private message
jesnow
l33t
l33t


Joined: 26 Apr 2006
Posts: 882

PostPosted: Thu Apr 19, 2007 10:28 pm    Post subject: Reply with quote

ph030 wrote:
Now that's a nice one, thanks! Will this be part of regular emerge at some time?


Second that.

J.
Back to top
View user's profile Send private message
plut0
Apprentice
Apprentice


Joined: 21 Dec 2004
Posts: 272

PostPosted: Mon Apr 23, 2007 2:54 pm    Post subject: Reply with quote

Another question...If you install application 'abc' that depended on say apache, which was not already installed, take a snapshot after this install. Then you install application 'xyz' that also depended on apache and took another snapshot. Now you want to remove application 'abc' using demerge. Does apache get removed also?
Back to top
View user's profile Send private message
ian!
Bodhisattva
Bodhisattva


Joined: 25 Feb 2003
Posts: 3829
Location: Essen, Germany

PostPosted: Mon Apr 23, 2007 8:24 pm    Post subject: Reply with quote

plut0 wrote:
Now you want to remove application 'abc' using demerge.

You can't. demerges purpose is to revert to previous recorded states.

demerge != depclean
_________________
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Back to top
View user's profile Send private message
plut0
Apprentice
Apprentice


Joined: 21 Dec 2004
Posts: 272

PostPosted: Mon Apr 23, 2007 8:52 pm    Post subject: Reply with quote

Thanks, I got it now :) Looks like a great tool!
Back to top
View user's profile Send private message
biatch0
n00b
n00b


Joined: 25 May 2004
Posts: 40

PostPosted: Sat Apr 28, 2007 1:46 pm    Post subject: Reply with quote

How does demerge deal with deprecated and/or masked packages?
Back to top
View user's profile Send private message
ian!
Bodhisattva
Bodhisattva


Joined: 25 Feb 2003
Posts: 3829
Location: Essen, Germany

PostPosted: Sat Apr 28, 2007 2:49 pm    Post subject: Reply with quote

biatch0 wrote:
How does demerge deal with deprecated and/or masked packages?

Currently it does not care about that at all but upcoming versions will.
_________________
"To have a successful open source project, you need to be at least somewhat successful at getting along with people." -- Daniel Robbins
Back to top
View user's profile Send private message
kfiadeg
n00b
n00b


Joined: 04 May 2006
Posts: 48
Location: Republic of Poland

PostPosted: Sat Apr 28, 2007 10:12 pm    Post subject: Reply with quote

This is a great piece of good stuff! Thank you!
Hope this will be a part of portage utils soon.
Back to top
View user's profile Send private message
Extintor
Tux's lil' helper
Tux's lil' helper


Joined: 09 Oct 2004
Posts: 113
Location: Stockholm, Sweden

PostPosted: Sat Apr 28, 2007 10:28 pm    Post subject: Reply with quote

Looks promising. Thanks a bunch!
_________________
Beerhazard | Nobelium | VIm | Perl | Ruby
Back to top
View user's profile Send private message
jurrie
Apprentice
Apprentice


Joined: 14 Mar 2004
Posts: 177
Location: Netherlands

PostPosted: Sun May 06, 2007 10:41 am    Post subject: Reply with quote

Thanks a lot for this. This program has saved me a great deal of pain from reverting back to my 'stable' state after doing some experiments ^_^
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum