Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TIP] The things I thought I knew about portage...
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
jbNet
n00b
n00b


Joined: 07 Oct 2003
Posts: 39
Location: Oregon, USA

PostPosted: Sat Mar 13, 2004 7:56 am    Post subject: [TIP] The things I thought I knew about portage... Reply with quote

I have been using Gentoo for about a year now, and either I've been doing things wrong, or things have changed

What I used to do: (This means don't do it this way)

To update all packages on the system:
Code:
emerge sync
emerge -upv world
emerge -u world


To install a ~x86 package on a x86 system:
Code:
ACCEPT_KEYWORDS=~x86 emerge samba
emerge -i net-fs/samba-2.2.8a


To clean up unwanted packages on your system:
Code:
cd /var/db/pkg
ls
#look through each directory for packages that aren't needed
emerge unmerge [package]


What I do now:

I've done a lot of reading today in these forums, and found out I was doing it all wrong! I think I'm not the only one, so here is what I have learned:

To update all packages on your system:
Code:
emerge sync
emerge -uDpv world
emerge -uDv world


The D stands for Deep... it not only updates the packages listed in world... but also all dependencies of the things listed in the world file... in other words probably all of the packages installed on your system. I include the v in the second call to emerge because it will show any errors related to info files.

Note: I've seen lots of references to -U instead of -u... this is upgradeonly, and will prevent packages from being downgraded. There are other, better ways to prevent packages from trying to downgrade in the first place, see below...

To install a ~x86 package on a x86 system:
Code:
mkdir /etc/portage
echo "app-office/openoffice-ximian ~x86" >> /etc/portage/package.keywords
emerge openoffice-ximian


Instead of using ACCEPT_KEYWORDS=~x86, if I just want to go unstable with one or just a few packages doing it this way will make portage remember that this package is to be emerged at the unstable version (or in the case of openoffice-ximian, will be emerged at all). This will eliminate the need for the -U instead of -u as described above.

To clean up unwanted packages on your system:
Code:
vim /var/lib/portage/world
# Remove anything you don't want anymore
emerge depclean -p
emerge depclean
rm -f ~/.revdep*
revdep-rebuild -p
revdep-rebuild


First edit your world file to remove any packages that you don't want anymore, then emerge depclean -p to see what would be removed... IMPORTANT: make sure to check this for sanity!! I have read posts where depclean removed some INSANE packages that wound up hosing systems. If you are having problems, check out the regenworld command, it rebuilds your world file from the portage log which records all packages emerged, unmerged, injected, etc.

If it appears to be mostly harmless packages, then go ahead and do emerge depclean to remove the packages listed in the previous step

the rm -f ~/.revdep* cleans up any old revdep-rebuild files to make sure results are accurate, and the revdep-rebuild commands are there to fix anything depclean breaks.

If you complete the above, your system will be squeaky clean with only the packages you actually want installed.

Anyway, maybe everybody else already knew all of this, and some of these features are very new, but they are going to help me manage my software, and I hope they help others discover the power of portage.

Edit: updated location of world file: /var/lib/portage/world


Last edited by jbNet on Wed Aug 10, 2005 5:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Sat Mar 13, 2004 1:24 pm    Post subject: Reply with quote

Another new feature: you can replace
Code:
emerge -uDpv world
emerge -uDv world
with
Code:
emerge -uDav world
The 'a' stands for --ask - Portage will present you with what it's about to do, as with --pretend, then let you say yes or no. This saves time because it doesn't have to calculate dependencies twice.
Back to top
View user's profile Send private message
jbNet
n00b
n00b


Joined: 07 Oct 2003
Posts: 39
Location: Oregon, USA

PostPosted: Sat Mar 13, 2004 6:07 pm    Post subject: Reply with quote

ecatmur wrote:
Another new feature: you can replace
Code:
emerge -uDpv world
emerge -uDv world
with
Code:
emerge -uDav world
The 'a' stands for --ask - Portage will present you with what it's about to do, as with --pretend, then let you say yes or no. This saves time because it doesn't have to calculate dependencies twice.


Yes, very cool indeed! Go Devs!
_________________
~Jake B
Back to top
View user's profile Send private message
curious_bob
l33t
l33t


Joined: 05 Dec 2003
Posts: 636
Location: San Francisco, CA

PostPosted: Mon Mar 15, 2004 6:28 am    Post subject: Reply with quote

This was very helpful. I had been doing it the wrong way too. Thanks a lot! :D
Back to top
View user's profile Send private message
bigcat99
n00b
n00b


Joined: 06 Jan 2004
Posts: 45
Location: Boston

PostPosted: Sun Mar 21, 2004 6:58 pm    Post subject: wow... Reply with quote

I've been doing it your old way as well, and so have all of my gentoo using friends... wow.... one thing i still have questions about... let's saying i'm using kde 3.2.0 for my wm, and I want to update all the packages on my system except for kde because i don't want to upgrade to kde 3.2.1 yet.... how? :?:
Back to top
View user's profile Send private message
the_y_man
Tux's lil' helper
Tux's lil' helper


Joined: 25 Jan 2004
Posts: 80

PostPosted: Sun Mar 21, 2004 7:03 pm    Post subject: Re: wow... Reply with quote

bigcat99 wrote:
I've been doing it your old way as well, and so have all of my gentoo using friends... wow.... one thing i still have questions about... let's saying i'm using kde 3.2.0 for my wm, and I want to update all the packages on my system except for kde because i don't want to upgrade to kde 3.2.1 yet.... how? :?:


emerge --inject kde ......
Back to top
View user's profile Send private message
bigcat99
n00b
n00b


Joined: 06 Jan 2004
Posts: 45
Location: Boston

PostPosted: Sun Mar 21, 2004 7:28 pm    Post subject: Re: wow... Reply with quote

the_y_man wrote:
bigcat99 wrote:
I've been doing it your old way as well, and so have all of my gentoo using friends... wow.... one thing i still have questions about... let's saying i'm using kde 3.2.0 for my wm, and I want to update all the packages on my system except for kde because i don't want to upgrade to kde 3.2.1 yet.... how? :?:


emerge --inject kde ......


THANKS!!! how do i undo that though for when i do want to emerge 3.2.1?
Back to top
View user's profile Send private message
Gruffi
Apprentice
Apprentice


Joined: 15 Aug 2003
Posts: 209
Location: Antwerpen - Flanders - Belgium

PostPosted: Sun Mar 21, 2004 7:46 pm    Post subject: Re: wow... Reply with quote

bigcat99 wrote:
the_y_man wrote:
bigcat99 wrote:
I've been doing it your old way as well, and so have all of my gentoo using friends... wow.... one thing i still have questions about... let's saying i'm using kde 3.2.0 for my wm, and I want to update all the packages on my system except for kde because i don't want to upgrade to kde 3.2.1 yet.... how? :?:


emerge --inject kde ......


THANKS!!! how do i undo that though for when i do want to emerge 3.2.1?


You don't have to... --inject means "emerge all this stuff but pretend that kde is ok"... so if next time you don't use --inject it will upgrade kde as well....
_________________
... and we will show Microsoft, that they cannot take whatever they want. And that Free Software is our software!
Back to top
View user's profile Send private message
HomerSimpson
l33t
l33t


Joined: 25 Jan 2003
Posts: 869
Location: Ohio, USA

PostPosted: Sun Mar 21, 2004 8:05 pm    Post subject: Reply with quote

jbNet, thank you for sharing this. That was very considerate of you.

I have been using portage the "wrong way" for over a year now too.

Finally I can emerge -D without errors! :)
_________________
The strong must protect the Sweet.
Back to top
View user's profile Send private message
myuser
Apprentice
Apprentice


Joined: 31 Jan 2004
Posts: 218

PostPosted: Mon Mar 22, 2004 6:28 am    Post subject: Reply with quote

Thanks for that, I have been using portage incorrectly as well.

The thing was, I knew I was doing it wrong; it just felt wrong when trying to clean up the system.

So, I have in the main left the finer points of package tuning until I would stumble onto a thread like this.

Portage needs a damn good cheat sheet, and this thread is the beginning of one, I salute you.

Perhaps, a portage sticky; crammed with quick portage commands with a brief and succint description, that would do wonders for package maintainance.
Back to top
View user's profile Send private message
bigcat99
n00b
n00b


Joined: 06 Jan 2004
Posts: 45
Location: Boston

PostPosted: Mon Mar 22, 2004 3:27 pm    Post subject: Reply with quote

myuser wrote:
Thanks for that, I have been using portage incorrectly as well.

The thing was, I knew I was doing it wrong; it just felt wrong when trying to clean up the system.

So, I have in the main left the finer points of package tuning until I would stumble onto a thread like this.

Portage needs a damn good cheat sheet, and this thread is the beginning of one, I salute you.

Perhaps, a portage sticky; crammed with quick portage commands with a brief and succint description, that would do wonders for package maintainance.


I agree wholeheartedly. there should be an FAQ or "cheatsheet" with all the commands and proper syntax with descriptions.... :lol:
Back to top
View user's profile Send private message
oldefortran
l33t
l33t


Joined: 28 Feb 2004
Posts: 652

PostPosted: Mon Mar 22, 2004 4:20 pm    Post subject: Reply with quote

Please, put this in a Howto/FAQ or something!
Back to top
View user's profile Send private message
mrmodin
Apprentice
Apprentice


Joined: 24 Jan 2004
Posts: 216
Location: Stockholm, Sweden

PostPosted: Mon Mar 22, 2004 10:00 pm    Post subject: Reply with quote

Nice, thanks alot.
Back to top
View user's profile Send private message
HomerSimpson
l33t
l33t


Joined: 25 Jan 2003
Posts: 869
Location: Ohio, USA

PostPosted: Mon Mar 22, 2004 10:58 pm    Post subject: Reply with quote

I have a question. If I do emerge depclean and accidentally remove something important packages but follow up with a revdep-rebuild won't it install it right back?

Having said that I noticed that revdep-rebuild was going to remove xinetd, python-gnome and a couple of other important things. Luckily I followed your advice and ran revdep-rebuild -p first and then re-emerged the things that I knew I needed. Still emerge depclean removed some important stuff but revdep-rebuild pulled them back in.

Still is revdep-rebuild the failsafe?

Thx
_________________
The strong must protect the Sweet.
Back to top
View user's profile Send private message
richk449
Guru
Guru


Joined: 24 Oct 2003
Posts: 345

PostPosted: Tue Mar 23, 2004 1:09 am    Post subject: Re: The things I thought I knew about portage... Reply with quote

jbNet wrote:


Note: I've seen lots of references to -U instead of -u... this is upgradeonly, and will prevent packages from being downgraded. There are other, better ways to prevent packages from trying to downgrade in the first place, see below...

To install a ~x86 package on a x86 system:
Code:
mkdir /etc/portage
echo "app-office/openoffice-ximian ~x86" >> /etc/portage/package.keywords
emerge openoffice-ximian


Instead of using ACCEPT_KEYWORDS=~x86, if I just want to go unstable with one or just a few packages doing it this way will make portage remember that this package is to be emerged at the unstable version (or in the case of openoffice-ximian, will be emerged at all). This will eliminate the need for the -U instead of -u as described above.


Why is your way better? Isn't the whole point in -U to save me the trouble of having to keep up a package.keywords file? And furthermore, doing the packages.keyword file method means that I will always be running the "unstable" version of openoffice-ximian, instead of just once, which is what I usually want.

Perhaps I am missing someting?
Back to top
View user's profile Send private message
rshetye
n00b
n00b


Joined: 07 Aug 2003
Posts: 42

PostPosted: Tue Mar 23, 2004 2:48 am    Post subject: "concurrent" compile AND download - HOWTO Reply with quote

In case of a large emerge, this is what I do to decrease my overall compile time.

I run
Code:
emerge -Duav world
in one window and make sure it downloads the first file and starts compiling it. Then I hit Ctrl-S to pause this process and in another window I fire off an
Code:
emerge -Duvf world
which sees that the first file has been downloaded and starts with the next one. Once the second (downloading) process is a few files ahead of the first (compiling) process, I unpause the first process with a Ctrl-Q.

This way I end up with one process that is compiling (CPU = 100%) and one process that is pre-downloading (net usage = MAX). Very useful.

Note: NEVER let the compiling process reach the same file that the downloading process is downloading. You will have 2 processes downloading at the same time and you will end up with corrupt files in /usr/portage/distfiles.

I use esync instead of emerge sync and then I use esearch instead of emerge -s, and esearch -S instead of emerge -S, for searching the portage packages. (app-portage/esearch). "esync" takes a bit longer than "emerge sync" due to "eupdatedb", but the resulting speed-up obtained by esearch is TOTALLY worth it.

Also, if you THINK that your system is up-to-date, run porthole. You'll be surprised.

Also waiting for the qpkg, etcat, equery dust to settle.


Last edited by rshetye on Tue Mar 23, 2004 5:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 18084

PostPosted: Tue Mar 23, 2004 2:54 am    Post subject: Reply with quote

oldefortran wrote:
Please, put this in a Howto/FAQ or something!
Moved from Portage & Programming (and added "[TIP]" to the title.
_________________
Those who know what's best for us must rise and save us from ourselves.
Back to top
View user's profile Send private message
Icer
Guru
Guru


Joined: 26 Aug 2003
Posts: 395
Location: @home

PostPosted: Tue Mar 23, 2004 9:25 pm    Post subject: Reply with quote

Here's a n00b question:

I have few programs which were emerged with '~x86' keywords. If I hit emerge -uDv world, do they get removed, downgraded or are they left intact or even updated?
Back to top
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Tue Mar 23, 2004 10:53 pm    Post subject: Reply with quote

Depends. If you merged them with ACCEPT_KEYWORDS= on the command line, they will be downgraded. If you merged them with package.keywords they will be upgraded. If you want them to stay at the same version use a version specifier in package.keywords.
Back to top
View user's profile Send private message
JohnDoe
Tux's lil' helper
Tux's lil' helper


Joined: 15 Dec 2003
Posts: 96
Location: Lisbon, Portugal

PostPosted: Wed Mar 24, 2004 2:44 am    Post subject: Reply with quote

I have one question that came across my mind one of these days.

Imagine I download samba source directly from samba.org. When I unzip it and do ./configure --help I see a lot of options I can use to configure samba (--with-winbind, --with-pam, and so on).

How can I use those (or some options like it) with portage? I've been reading /usr/portage/net-fs/samba/Changelog and Makefile and it seems I can just use USE flags with the options defined in the Makefile. So, for using --with-pam I should use (I'm trying to use Samba 3.0.2a):
USE="pam" ACCEPT_KEYWORDS="~x86" emerge samba

or I'm not understanding it?

Also, what if I'm trying to compile it with USE flags that do not exist. I need the --with-quotas flag and there isn't one in the Makefile. Is there a way to use it? Or do I have to download the source and use it?
Back to top
View user's profile Send private message
nico--
n00b
n00b


Joined: 29 Jul 2002
Posts: 59

PostPosted: Thu Mar 25, 2004 1:12 am    Post subject: Reply with quote

JohnDoe wrote:

How can I use those (or some options like it) with portage? I've been reading /usr/portage/net-fs/samba/Changelog and Makefile and it seems I can just use USE flags with the options defined in the Makefile. So, for using --with-pam I should use (I'm trying to use Samba 3.0.2a):
USE="pam" ACCEPT_KEYWORDS="~x86" emerge samba

'equery uses samba' will show you which use flags are available for that package (available in app-portage/gentoolkit).

You might want pam available for all packages that support it. You can put all your USE flags in /etc/make.conf and they get used automatically when you emerge something.

app-portage/ufed gives you a curses interface for editing your use flags.
_________________
Quidquid latine dictum sit, altum viditur.
Back to top
View user's profile Send private message
dr_strange
Guru
Guru


Joined: 16 Apr 2002
Posts: 480
Location: Cambridge, UK

PostPosted: Thu Mar 25, 2004 7:48 am    Post subject: Reply with quote

JohnDoe wrote:
I have one question that came across my mind one of these days.

Imagine I download samba source directly from samba.org. When I unzip it and do ./configure --help I see a lot of options I can use to configure samba (--with-winbind, --with-pam, and so on).

How can I use those (or some options like it) with portage? I've been reading /usr/portage/net-fs/samba/Changelog and Makefile and it seems I can just use USE flags with the options defined in the Makefile. So, for using --with-pam I should use (I'm trying to use Samba 3.0.2a):
USE="pam" ACCEPT_KEYWORDS="~x86" emerge samba

or I'm not understanding it?

Also, what if I'm trying to compile it with USE flags that do not exist. I need the --with-quotas flag and there isn't one in the Makefile. Is there a way to use it? Or do I have to download the source and use it?


If you need extra options that may not be covered by USE flags, you'll need to modify the ebuild. The Ebuild-HOWTO at www.gentoo.org will give you guidance how to do it.
_________________
shine on,

dr_strange

Set the Controls for the Heart of Gentoo
http://magenta.linuxforum.hu
Back to top
View user's profile Send private message
seppe
Guru
Guru


Joined: 01 Sep 2003
Posts: 431
Location: Hove, Antwerp, Belgium

PostPosted: Sat Mar 27, 2004 4:09 pm    Post subject: Re: [TIP] The things I thought I knew about portage... Reply with quote

Code:

echo "app-office/openoffice-ximian ~x86" >> /etc/portage/package.keywords

Don't do this! This caused me a broken pkg database (take a look here: https://forums.gentoo.org/viewtopic.php?p=991308#991308) ! After searching a whole day, I found out that it should have a '=' in front! So you have to it like this:
Code:

echo "=app-office/openoffice-ximian ~x86" >> /etc/portage/package.keywords


But everything else you posted are really super-tips!
_________________
nitro-sources, because between stable and experimental there exists only speed

Latest release I made: 2.6.13.2-nitro1
Back to top
View user's profile Send private message
ecatmur
Advocate
Advocate


Joined: 20 Oct 2003
Posts: 3595
Location: Edinburgh

PostPosted: Sat Mar 27, 2004 4:26 pm    Post subject: Reply with quote

No, the "=" is only needed when specifying a version of a package. In your link you wanted to unmask porthole 0.2, so that needed an = sign. When unmasking the package openoffice-ximian the = sign is not needed.

However, using the = sign can be useful if you want to prevent Portage from updating an unstable package on the unstable timescale (which is fairly often). So you would put
Code:
=app-office/openoffice-ximian-1.1.51 ~x86
to install that version and not have to update (at least not until a higher version is marked stable) or
Code:
~app-office/openoffice-ximian-1.1.51
to ensure that -r# revision ebuilds (bug fixes and security patches) are installed.
Back to top
View user's profile Send private message
effe
n00b
n00b


Joined: 04 Mar 2004
Posts: 8

PostPosted: Mon Mar 29, 2004 11:37 pm    Post subject: Reply with quote

great guide, thanks a lot jbNet.

I have a couple of questions though.

First of:
From what I've understood the packages listed in /var/cache/edb/world are the once that I emerged explicitly (not their dependencies), is this correct?

Second:
I ran a depclean (after checking for important files, removed 70 packages (!)) then I restored the broken dependencies with revdep-rebuild.
Following the manual so far.
However, the revdep generated errors from time to time, all of which I could solve only by emerging the packages that generated the errors separatly. The reason for the errors while "revdep-ing" were missing dependencies. (why doesn't revdep-rebuild calculate the dependencies of the packages that it should rebuild because of missing dependencies?)
Anyway, I can emerge a couple of packages manually for now but how do I keep depclean to remove dependencies needed by revdep the next time too?

thanks in advance
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