Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

demerge - emerge the other way around

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
34 posts
  • 1
  • 2
  • Next
Author
Message
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

demerge - emerge the other way around

  • Quote

Post by ian! » Wed Apr 11, 2007 10:25 pm

"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: Select all

# 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: Select all

# emerge demerge
# demerge --record
# emerge gentoo
# demerge --record
# emerge -C DateManip
Calling demerge now gives:

Code: Select all

# 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: Select all

# 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: Select all

# 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: Select all

# 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: Select all

# 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: Select all

# 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
Top
purpler
n00b
n00b
User avatar
Posts: 38
Joined: Thu Jan 11, 2007 7:38 pm
Location: /v*/l*/p*/world

  • Quote

Post by purpler » Thu Apr 12, 2007 12:59 am

wowwwww
nice oneeee :D
Our system, who art on raised tile,hallowed be thy OS..
Gentoo.
Top
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

  • Quote

Post by ian! » Thu Apr 12, 2007 8:13 pm

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
Top
likewhoa
l33t
l33t
Posts: 778
Joined: Wed Oct 04, 2006 12:28 pm
Location: Brooklyn, New York
Contact:
Contact likewhoa
Website

  • Quote

Post by likewhoa » Thu Apr 12, 2007 8:29 pm

thanks for this fine package. will come in handy with my bloated test system.
Top
swimmer
Veteran
Veteran
User avatar
Posts: 1330
Joined: Mon Jul 15, 2002 10:42 am
Location: Netherlands

  • Quote

Post by swimmer » Fri Apr 13, 2007 1:41 am

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
Top
mudrii
l33t
l33t
Posts: 789
Joined: Thu Jun 26, 2003 12:27 am
Location: Singapore
Contact:
Contact mudrii
Website

  • Quote

Post by mudrii » Fri Apr 13, 2007 2:33 am

ian!

Big Thank you for this one

Regards
www.gentoo.ro
Top
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

  • Quote

Post by ian! » Fri Apr 13, 2007 6:37 am

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
Top
swimmer
Veteran
Veteran
User avatar
Posts: 1330
Joined: Mon Jul 15, 2002 10:42 am
Location: Netherlands

  • Quote

Post by swimmer » Fri Apr 13, 2007 8:28 am

Thank you :)
Top
salam
Apprentice
Apprentice
Posts: 231
Joined: Thu Sep 29, 2005 8:52 am

  • Quote

Post by salam » Tue Apr 17, 2007 3:43 pm

does it also record the dependecies which are pulled in with emerging a single package?
Top
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

  • Quote

Post by ian! » Tue Apr 17, 2007 7:18 pm

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
Top
sonicbhoc
Veteran
Veteran
User avatar
Posts: 1805
Joined: Mon Oct 24, 2005 7:52 pm
Location: In front of the computer screen
Contact:
Contact sonicbhoc
Website

  • Quote

Post by sonicbhoc » Tue Apr 17, 2007 7:20 pm

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.
Top
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

  • Quote

Post by ian! » Wed Apr 18, 2007 8:11 pm

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: Select all

# 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
Top
plut0
Apprentice
Apprentice
Posts: 272
Joined: Tue Dec 21, 2004 3:13 pm

  • Quote

Post by plut0 » Thu Apr 19, 2007 1:44 pm

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?
Top
Kalin
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 134
Joined: Sun Dec 22, 2002 10:32 am
Location: Germany
Contact:
Contact Kalin
Website

  • Quote

Post by Kalin » Thu Apr 19, 2007 2:14 pm

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.
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/
Top
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

  • Quote

Post by ian! » Thu Apr 19, 2007 4:34 pm

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
Top
avx
Advocate
Advocate
User avatar
Posts: 2152
Joined: Mon Jun 21, 2004 4:06 am

  • Quote

Post by avx » Thu Apr 19, 2007 9:50 pm

Now that's a nice one, thanks! Will this be part of regular emerge at some time?
Top
jesnow
l33t
l33t
Posts: 905
Joined: Wed Apr 26, 2006 11:20 pm

  • Quote

Post by jesnow » Thu Apr 19, 2007 10:28 pm

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

J.
Top
plut0
Apprentice
Apprentice
Posts: 272
Joined: Tue Dec 21, 2004 3:13 pm

  • Quote

Post by plut0 » Mon Apr 23, 2007 2:54 pm

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?
Top
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

  • Quote

Post by ian! » Mon Apr 23, 2007 8:24 pm

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
Top
plut0
Apprentice
Apprentice
Posts: 272
Joined: Tue Dec 21, 2004 3:13 pm

  • Quote

Post by plut0 » Mon Apr 23, 2007 8:52 pm

Thanks, I got it now :) Looks like a great tool!
Top
biatch0
n00b
n00b
Posts: 40
Joined: Tue May 25, 2004 11:11 am

  • Quote

Post by biatch0 » Sat Apr 28, 2007 1:46 pm

How does demerge deal with deprecated and/or masked packages?
Top
ian!
Bodhisattva
Bodhisattva
User avatar
Posts: 3829
Joined: Tue Feb 25, 2003 9:52 am
Location: Essen, Germany
Contact:
Contact ian!
Website

  • Quote

Post by ian! » Sat Apr 28, 2007 2:49 pm

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
Top
kfiadeg
n00b
n00b
User avatar
Posts: 48
Joined: Thu May 04, 2006 8:23 am
Location: Republic of Poland

  • Quote

Post by kfiadeg » Sat Apr 28, 2007 10:12 pm

This is a great piece of good stuff! Thank you!
Hope this will be a part of portage utils soon.
Top
Extintor
Tux's lil' helper
Tux's lil' helper
Posts: 113
Joined: Sat Oct 09, 2004 6:00 pm
Location: Stockholm, Sweden
Contact:
Contact Extintor
Website

  • Quote

Post by Extintor » Sat Apr 28, 2007 10:28 pm

Looks promising. Thanks a bunch!
Beerhazard | Nobelium | VIm | Perl | Ruby
Top
jurrie
Apprentice
Apprentice
User avatar
Posts: 177
Joined: Sun Mar 14, 2004 6:04 pm
Location: Netherlands
Contact:
Contact jurrie
Website

  • Quote

Post by jurrie » Sun May 06, 2007 10:41 am

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 ^_^
Top
Post Reply

34 posts
  • 1
  • 2
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic