/[gentoo]/xml/htdocs/doc/en/handbook/hb-working-portage.xml
Gentoo

Diff of /xml/htdocs/doc/en/handbook/hb-working-portage.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.15 Revision 1.51
1<?xml version='1.0' encoding='UTF-8'?>
2<!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3
1<!-- The content of this document is licensed under the CC-BY-SA license --> 4<!-- The content of this document is licensed under the CC-BY-SA license -->
2<!-- See http://creativecommons.org/licenses/by-sa/1.0 --> 5<!-- See http://creativecommons.org/licenses/by-sa/2.0 -->
3 6
4<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-portage.xml,v 1.15 2004/01/06 15:28:05 swift Exp $ --> 7<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-portage.xml,v 1.51 2005/05/17 14:39:26 neysx Exp $ -->
5 8
6<sections> 9<sections>
10
11<version>1.46</version>
12<date>2005-05-17</date>
13
7<section> 14<section>
8<title>Obtaining Package Information</title> 15<title>Welcome to Portage</title>
9<subsection>
10<title>The Lord of All Tools: emerge</title>
11<body> 16<body>
12 17
13<p>
14The main Portage tool that most users will use is <c>emerge</c>. We have already
15used it during the Gentoo installation and in the previous chapter, but we just
16briefly explained how to use it. This chapter will elaborate on <c>emerge</c>
17and teach you how to use <c>emerge</c> to fix all your software-related needs.
18</p> 18<p>
19 19Portage is probably Gentoo's most notable innovation in software management.
20With its high flexibility and enormous amount of features it is frequently seen
21as the best software management tool available for Linux.
20<p> 22</p>
21<c>emerge</c> is the command used to install, remove, query and maintain 23
22software packages. It is a front-end for <c>ebuild</c>; people interested in
23becoming Gentoo professionals will learn how to use <c>ebuild</c> later on. For
24now, we will focus on <c>emerge</c> as it has functionality that <c>ebuild</c>
25lacks (such as resolving dependencies, searching the Portage tree, etc.).
26</p> 24<p>
27 25Portage is completely written in <uri link="http://www.python.org">Python</uri>
26and <uri link="http://www.gnu.org/software/bash">Bash</uri> and therefore fully
27visible to the users as both are scripting languages.
28<p> 28</p>
29Since <c>emerge</c> is the most important tool for Gentoo users, it has an 29
30extensive manpage you can read by issuing <c>man emerge</c>. You can also view
31the in-command help by running <c>emerge --help</c>.
32</p> 30<p>
31Most users will work with Portage through the <c>emerge</c> tool. This chapter
32is not meant to duplicate the information available from the emerge man page.
33For a complete rundown of emerge's options, please consult the man page:
34</p>
33 35
34<pre caption="Retrieving help for emerge"> 36<pre caption="Reading the emerge man page">
35# <i>man emerge</i> 37$ <i>man emerge</i>
36# <i>emerge --help</i>
37</pre> 38</pre>
38 39
39</body>
40</subsection>
41<subsection>
42<title>The Portage Tree</title>
43<body> 40</body>
44
45<p>
46Before we continue describing <c>emerge</c>, let us first take a look at the
47Portage Tree. Go to <path>/usr/portage</path> and do a listing of the available
48directories. We use <c>ls --classify</c> to list the contents of a
49directory as it will show directories with a trailing "/".
50</p>
51
52<pre caption="Viewing the Portage Tree">
53# <i>cd /usr/portage; ls --classify</i>
54app-admin/ dev-ml/ gnome-libs/ net-print/
55app-arch/ dev-perl/ gnome-office/ net-wireless/
56app-benchmarks/ dev-php/ header.txt net-www/
57app-cdr/ dev-python/ incoming/ net-zope/
58app-crypt/ dev-ruby/ jython/ packages/
59app-dicts/ dev-tcltk/ kde-apps/ profiles/
60app-doc/ dev-tex/ kde-base/ releases/
61app-editors/ dev-util/ kde-i18n/ scripts/
62app-emacs/ distfiles/ kde-libs/ sec-policy/
63app-emulation/ eclass/ licenses/ skel.ChangeLog
64app-games/ experimental/ media-fonts/ skel.ebuild
65app-gnustep/ files/ media-gfx/ skel.metadata.xml
66app-i18n/ fresco-base/ media-libs/ snapshots/
67app-misc/ games-action/ media-plugins/ sys-apps/
68app-office/ games-arcade/ media-radio/ sys-build/
69app-pda/ games-board/ media-sound/ sys-cluster/
70app-portage/ games-emulation/ media-tv/ sys-devel/
71app-sci/ games-engines/ media-video/ sys-fs/
72app-shells/ games-fps/ metadata/ sys-kernel/
73app-text/ games-kids/ net-analyzer/ sys-kmods/
74app-vim/ games-misc/ net-apache/ sys-libs/
75app-xemacs/ games-mud/ net-dialup/ unix2tcp/
76berlin-base/ games-puzzle/ net-dns/ x11-base/
77dev-ada/ games-roguelike/ net-firewall/ x11-libs/
78dev-cpp/ games-rpg/ net-fs/ x11-misc/
79dev-db/ games-server/ net-ftp/ x11-plugins/
80dev-dotnet/ games-simulation/ net-im/ x11-terms/
81dev-embedded/ games-sports/ net-irc/ x11-themes/
82dev-games/ games-strategy/ net-libs/ x11-wm/
83dev-haskell/ games-util/ net-mail/ xfce-base/
84dev-java/ glep/ net-misc/ xfce-extra/
85dev-lang/ gnome-apps/ net-nds/
86dev-libs/ gnome-base/ net-news/
87dev-lisp/ gnome-extra/ net-p2p/
88</pre>
89
90<p>
91As you can see, the Portage tree has several subdirectories. Most of them are
92the <e>categories</e> in which the Gentoo packages, called <e>ebuilds</e>,
93reside. Take a look at, for instance, <path>app-office</path>:
94</p>
95
96<pre caption="Viewing a category">
97# <i>cd app-office; ls --classify</i>
98abiword/ gnotime/ kmymoney2/ ooodi/ plan/ timestamp.x
99dia/ gnucash/ koffice/ oooqs/ qhacc/
100dia2code/ gnumeric/ lxbank/ openoffice/ sc/
101facturalux/ ical/ lyx/ openoffice-bin/ scribus/
102gaby/ kbudget/ mdbtools/ openoffice-ximian/ siag/
103gnofin/ khacc/ mrproject/ phprojekt/ texmacs/
104</pre>
105
106<p>
107Inside a category you will find the packages belonging to that category, with a
108separate directory for each package. Let us take a look at the <c>openoffice</c>
109package:
110</p>
111
112<pre caption="Viewing a package">
113# <i>cd openoffice; ls --classify</i>
114ChangeLog files/ openoffice-1.0.3-r1.ebuild openoffice-1.1.0-r2.ebuild
115Manifest metadata.xml openoffice-1.1.0-r1.ebuild openoffice-1.1.0.ebuild
116</pre>
117
118<p>
119Remember that we told you that a Gentoo package is called an ebuild? Well, in
120the example directory four of such ebuilds are stored. Their naming is
121almost identical: they only differ in the version name.
122You are free to view the contents of such a package: they are plain scripts. We
123will not discuss it right now as it isn't important to know if you plan on just
124using Gentoo.
125</p>
126
127<p>
128The other files are the <path>ChangeLog</path> (which contains a listing of all
129the changes done to the ebuilds), <path>Manifest</path> (which contains the
130checksums and permissions of all the files in the directory) and
131<path>metadata.xml</path> (which contains more information about the package,
132such as the responsible development group -- called <e>herd</e> -- and a more
133extensive description).
134</p>
135
136<p>
137Inside the <path>files</path> directory you will find extra files, needed by
138Portage: digests (checksums and permissions of the files needed by a single
139version of the package), patches, example configuration files, etc.
140</p>
141
142<pre caption="Viewing the extra files">
143# <i>cd files; ls --classify</i>
1441.0.3/ digest-openoffice-1.0.3-r1 digest-openoffice-1.1.0-r1
1451.1.0/ digest-openoffice-1.1.0 digest-openoffice-1.1.0-r2
146# <i>cd 1.1.0; ls --classify</i>
147fixed-gcc.patch ooffice-wrapper-1.3
148newstlportfix.patch openoffice-1.1.0-linux-2.6-fix.patch
149no-mozab.patch openoffice-1.1.0-sparc64-fix.patch
150nptl.patch
151</pre>
152
153<p>
154If you go back to the root of the Portage tree (<path>/usr/portage</path>) you
155will notice that there are other, non-category directories too. We will discuss
156those later in this chapter.
157</p>
158
159</body>
160</subsection>
161<subsection>
162<title>Search for a Package</title>
163<body>
164
165<p>
166If you are new to Linux or Gentoo, you might not know what tool you need for
167what job. To facilitate searching, <c>emerge</c> provides you with a way to
168search through the available packages on your system. There are two ways you can
169search through packages: by <e>name</e>, or by <e>name</e> and
170<e>description</e>.
171</p>
172
173<p>
174To search through the Portage tree by name, use <c>emerge search</c>. For
175instance, to find out more about <c>mozilla</c>:
176</p>
177
178<pre caption="Showing information about mozilla">
179# <i>emerge search mozilla</i>
180Searching...
181[ Results for search key : mozilla ]
182[ Applications found : 5 ]
183<comment>(Some output removed to improve readability)</comment>
184* net-www/mozilla
185 Latest version available: 1.5-r1
186 Latest version installed: 1.4-r3
187 Size of downloaded files: 29,153 kB
188 Homepage: http://www.mozilla.org
189 Description: The Mozilla Web Browser
190
191* net-www/mozilla-firebird
192 Latest version available: 0.7
193 Latest version installed: [ Not Installed ]
194 Size of downloaded files: 37,850 kB
195 Homepage: http://www.mozilla.org/projects/firebird/
196 Description: The Mozilla Firebird Web Browser
197<comment>(...)</comment>
198</pre>
199
200<p>
201If you want to include a search through the descriptions too, use the
202<c>--searchdesc</c> argument:
203</p>
204
205<pre caption="Search through the descriptions too">
206# <i>emerge --searchdesc mozilla</i>
207Searching...
208[ Results for search key : mozilla ]
209[ Applications found : 10 ]
210<comment>(Some output removed to improve readability)</comment>
211* dev-libs/nss-3.8
212 Latest version available: 3.8
213 Latest version installed: 3.8
214 Size of downloaded files: 2,782 kB
215 Homepage: http://www.mozilla.org/projects/security/pki/nss/
216 Description: Mozilla's Netscape Security Services Library that implements PKI support
217</pre>
218
219<p>
220As you can see, the output of <c>emerge</c> informs you about the category and
221name of the package, the available version, the currently installed version,
222the size of the downloaded files, the homepage and the small description.
223</p>
224
225<p>
226You see something new? Yes, <e>downloaded files</e>. When you tell Portage to
227install a package, it of course needs to have the necessary sources (or
228precompiled packages) available. It therefore checks the contents of
229<path>/usr/portage/distfiles</path> (for source code) or
230<path>/usr/portage/packages/All</path> (for precompiled packages) to see if the
231necessary files are already available. If not, it downloads the necessary files
232and places them in those directories.
233</p>
234
235<!--
236<note>
237Searching the Portage Tree, especially when using <c>- -searchdesc</c>, is very
238time consuming. There are other, more performant tools available. We will
239describe those in the chapter on <uri link="?part=2&amp;chap=7">Gentoolkit and
240Other Tools</uri>.
241</note>
242-->
243
244</body>
245</subsection>
246<subsection>
247<title>Viewing the ChangeLog</title>
248<body>
249
250<p>
251While browsing through the Portage Tree, you saw that there was a ChangeLog for
252each package. You can view this ChangeLog with <c>emerge</c> too. Use the
253<c>--pretend --changelog</c> (<c>-pl</c> in short) options. As an example we
254will view the ChangeLog entries for <c>gnumeric</c>:
255</p>
256
257<pre caption="Viewing the ChangeLog entries for gnumeric">
258# <i>emerge --pretend --changelog gnumeric</i>
259</pre>
260
261</body>
262</subsection>
263</section> 41</section>
264<section> 42<section>
265<title>Updating Portage</title> 43<title>The Portage Tree</title>
266<subsection>
267<title>Introduction</title>
268<body>
269
270<p>
271Searching through Portage is nice, but if you don't update your Portage Tree
272regularly, you will be stuck with the packages and versions available on your
273system. This means that your system will get outdated pretty soon and that
274you will be missing bugfixes and remedies for possible security problems.
275</p>
276
277<p>
278There are several ways to update your Portage Tree. The most popular method is
279by using one of our <uri link="/main/en/mirrors.xml">rsync mirrors</uri>.
280Another one is by using a Portage snapshot (in case a firewall or unavailability
281of a network prohibits the use of the rsync server).
282</p>
283
284</body>
285</subsection> 44<subsection>
45<title>Ebuilds</title>
46<body>
47
48<p>
49When we talk about packages, we often mean software titles that are available to
50the Gentoo users through the Portage tree. The Portage tree is a collection of
51<e>ebuilds</e>, files that contain all information Portage needs to maintain
52software (install, search, query, ...). These ebuilds reside in
53<path>/usr/portage</path> by default.
54</p>
55
56<p>
57Whenever you ask Portage to perform some action regarding software titles, it
58will use the ebuilds on your system as a base. It is therefore important that
59you regularly update the ebuilds on your system so Portage knows about new
60software, security updates, etc.
61</p>
62
63</body>
286<subsection> 64</subsection>
287<title>Selecting a Mirror for rsync</title>
288<body>
289
290<p>
291It is adviseable to first select a fast <uri
292link="/main/en/mirrors.xml">mirror</uri> close to you. You can do this manually
293(by setting the <c>SYNC</c> variable in <path>/etc/make.conf</path>) or use
294<c>mirrorselect</c> to do this for you automatically. As the <c>SYNC</c>
295variable will be discussed later on, we will focus on using <c>mirrorselect</c>.
296First install <c>mirrorselect</c> by emerging it:
297</p>
298
299<pre caption="Installing mirrorselect">
300# <i>emerge --usepkg mirrorselect</i>
301</pre>
302
303<p>
304Now run <c>mirrorselect</c> to automatically select mirrors for you (it will
305also setup Portage to use a mirror for the source code):
306</p>
307
308<pre caption="Running mirrorselect">
309# <i>mirrorselect -a -s3</i>
310</pre>
311
312</body>
313</subsection> 65<subsection>
314<subsection>
315<title>Updating Portage</title> 66<title>Updating the Portage Tree</title>
316<body> 67<body>
317 68
318<p>
319To update Portage using rsync, simply run <c>emerge sync</c>:
320</p> 69<p>
70The Portage tree is usually updated with <uri
71link="http://rsync.samba.org/">rsync</uri>, a fast incremental file transfer
72utility. Updating is fairly simple as the <c>emerge</c> command provides a
73front-end for rsync:
74</p>
321 75
322<pre caption="Updating Portage using emerge sync"> 76<pre caption="Updating the Portage tree">
323# <i>emerge sync</i> 77# <i>emerge --sync</i>
324</pre> 78</pre>
325 79
326<p>
327If this fails (due to network problems, or a firewall), you can try using
328<c>emerge-webrsync</c> which will download a Portage Tree snapshot using
329<c>wget</c>. This also means that you can use proxies if you want. We discussed
330how to setup your system to use proxies during the Gentoo installation.
331</p> 80<p>
81If you are unable to rsync due to firewall restrictions you can still update
82your Portage tree by using our daily generated Portage tree snapshots. The
83<c>emerge-webrsync</c> tool automatically fetches and installs the latest
84snapshot on your system:
85</p>
332 86
333<pre caption="Updating Portage using emerge-webrsync"> 87<pre caption="Running emerge-webrsync">
334# <i>emerge-webrsync</i> 88# <i>emerge-webrsync</i>
335</pre> 89</pre>
336 90
337</body> 91</body>
338</subsection> 92</subsection>
339</section> 93</section>
340<section> 94<section>
341<title>Maintaining Software</title> 95<title>Maintaining Software</title>
342<subsection> 96<subsection>
343<title>Building or Prebuilt?</title> 97<title>Searching for Software</title>
344<body>
345
346<p>
347Gentoo provides ebuilds, the Gentoo packages if you like. But when you want to
348install such an ebuild, you can choose between <e>building</e> the package and
349using a <e>prebuilt</e> package. But what are the advantages/disadvantages of
350both approaches, and can they be used next to each other?
351</p>
352
353<p>
354As you probably have guessed, building packages takes a lot of time (especially
355if you have little resources or want to build big packages, such as <uri
356link="http://www.kde.org">KDE</uri>, <uri
357link="http://www.openoffice.org">OpenOffice.org</uri>, etc.). By building the
358package, you can use the <c>USE</c> setting to tweak the package to your system.
359Of course, you can also define high optimization options (in the <c>CFLAGS</c>
360and <c>CXXFLAGS</c> variables) to compile the package with.
361</p>
362
363<p>
364Using prebuilt packages improves the installation time (as no more compilation
365is needed), but you will lose the advantages of the <c>USE</c> setting and the
366<c>CFLAGS</c> &amp; <c>CXXFLAGS</c> variables.
367</p>
368
369<p>
370As previously stated, prebuilt packages are stored in the
371<path>/usr/portage/packages/All</path> directory, while the source code of the
372packages is placed in <path>/usr/portage/distfiles</path>. If you have finished
373installing a package you can remove the package or source code from the
374respective directory. However, you might want to keep the package/source code of
375the latest version, just in case you want to reinstall the package (so you don't
376have to redownload it).
377</p>
378
379</body> 98<body>
380</subsection> 99
100<p>
101To search through the Portage tree after software titles, you can use
102<c>emerge</c> built-in search capabilities. By default, <c>emerge --search</c>
103returns the names of packages whose title matches (either fully or partially)
104the given search term.
105</p>
106
107<p>
108For instance, to search for all packages who have "pdf" in their name:
109</p>
110
111<pre caption="Searching for pdf-named packages">
112$ <i>emerge --search pdf</i>
113</pre>
114
115<p>
116If you want to search through the descriptions as well you can use the
117<c>--searchdesc</c> (or <c>-S</c>) switch:
118</p>
119
120<pre caption="Searching for pdf-related packages">
121$ <i>emerge --searchdesc pdf</i>
122</pre>
123
124<p>
125When you take a look at the output, you'll notice that it gives you a lot of
126information. The fields are clearly labelled so we won't go further into their
127meanings:
128</p>
129
130<pre caption="Example 'emerge --search' output">
131* net-print/cups-pdf
132 Latest version available: 1.5.2
133 Latest version installed: [ Not Installed ]
134 Size of downloaded files: 15 kB
135 Homepage: http://cip.physik.uni-wuerzburg.de/~vrbehr/cups-pdf/
136 Description: Provides a virtual printer for CUPS to produce PDF files.
137 License: GPL-2
138</pre>
139
140</body>
381<subsection> 141</subsection>
142<subsection>
382<title>Installing Software from Sources</title> 143<title>Installing Software</title>
383<body> 144<body>
384 145
385<p> 146<p>
386Okay, enough talking, let's cut to the chase. To install a package, you will use 147Once you've found a software title to your liking, you can easily install it
387the <c>emerge</c> command. If you don't want to use any prebuilt packages, you 148with <c>emerge</c>: just add the package name. For instance, to install
388can just use <c>emerge &lt;package-name&gt;</c> or <c>emerge
389&lt;category&gt;/&lt;package-name&gt;</c>. As an example we'll install
390<c>gnumeric</c>: 149<c>gnumeric</c>:
391</p> 150</p>
392 151
393<pre caption="Building gnumeric"> 152<pre caption="Installing gnumeric">
394# <i>emerge gnumeric</i> 153# <i>emerge gnumeric</i>
395</pre> 154</pre>
396 155
397<p> 156<p>
398This will download the source code for you and unpacks, compiles and installs 157Since many applications depend on each other, any attempt to install a certain
399the package on your system. It will also do the same for all the dependencies. 158software package might result in the installation of several dependencies as
400If you want to see what dependencies will be installed with it, use the 159well. Don't worry, Portage handles dependencies well. If you want to find out
401<c>--pretend</c> option (<c>-p</c> in short): 160what Portage <e>would</e> install when you ask it to install a certain package,
161add the <c>--pretend</c> switch. For instance:
402</p> 162</p>
403 163
404<pre caption="Pretending to build gnumeric"> 164<pre caption="Pretend to install gnumeric">
405# <i>emerge --pretend gnumeric</i> 165# <i>emerge --pretend gnumeric</i>
406</pre> 166</pre>
407 167
408<p> 168<p>
409If you want to download the source code of the package and its dependencies, 169When you ask Portage to install a package, it will download the necessary source
410but don't want to build the package, use the <c>--fetchonly</c> option 170code from the internet (if necessary) and store it by default in
411(<c>-f</c> in short): 171<path>/usr/portage/distfiles</path>. After this it will unpack, compile and
172install the package. If you want Portage to only download the sources without
173installing them, add the <c>--fetchonly</c> option to the <c>emerge</c> command:
412</p> 174</p>
413 175
414<pre caption="Fetching sources for gnumeric"> 176<pre caption="Download the sourcecode for gnumeric">
415# <i>emerge --fetchonly gnumeric</i> 177# <i>emerge --fetchonly gnumeric</i>
416</pre> 178</pre>
417 179
418<p>
419If you want to see where <c>emerge</c> downloads the sources from, combine the
420<c>--fetchonly</c> and <c>--pretend</c> options:
421</p>
422
423<pre caption="Showing URLs of the sources for gnumeric">
424# <i>emerge --fetchonly --pretend gnumeric</i>
425</pre>
426
427<p>
428You can also opt to install a specific version of a package.
429For instance, if you want to install a gnumeric version older than 1.2 -- for
430any reason whatsoever :) you would type:
431</p>
432
433<pre caption="Installing a specific gnumeric version">
434# <i>emerge "&lt;gnumeric-1.2"</i>
435</pre>
436
437<p>
438Other possibilities are of course "&gt;" (later version) and "=" (the exact
439version).
440</p>
441
442</body> 180</body>
443</subsection>
444<subsection> 181</subsection>
445<title>Installing Prebuilt Packages</title>
446<body>
447
448<p>
449When you want to install a prebuilt package, you should use the <c>--usepkg</c>
450option (<c>-k</c> in short). This will use the binary package available in
451<path>/usr/portage/packages/All</path> <e>if</e> the package and the version of
452the application you want to install match.
453</p>
454
455<pre caption="Installing a prebuilt package for gnumeric">
456# <i>emerge --usepkg gnumeric</i>
457</pre>
458
459<p>
460If you want to use the binary package, even if the versions don't match, use
461<c>--usepkgonly</c> (<c>-K</c> in short).
462</p>
463
464<pre caption="Installing the prebuilt package for gnumeric">
465# <i>emerge --usepkgonly gnumeric</i>
466</pre>
467
468<p>
469If you don't have the prebuilt package on your system yet, you can have
470<c>emerge</c> download it from a mirror, defined in the <c>PORTAGE_BINHOST</c>
471variable declared in <path>/etc/make.conf</path>.
472</p>
473
474<p>
475To download the binary package in case this package doesn't exist on
476your system already, use <c>--getbinpkg</c> (<c>-g</c> in short):
477</p>
478
479<pre caption="Downloading and installing a prebuilt package for gnumeric">
480# <i>emerge --getbinpkg gnumeric</i>
481</pre>
482
483<p>
484This will download the package and the package-related information for you and
485install it on your system, together with the dependencies. If you want to see
486what dependencies will be installed with it, use the <c>--pretend</c> option
487(<c>-p</c> in short):
488</p>
489
490<pre caption="Pretending to download the prebuilt packages for gnumeric">
491# <i>emerge --getbinpkg --pretend gnumeric</i>
492</pre>
493
494<p>
495You can also opt to download the prebuilt package (and the package-related
496information) <e>without</e> checking the information on your local system and
497<e>without</e> using the prebuilt package already on your system (if
498applicable), use the <c>--getbinpkgonly</c> option (<c>-G</c> in short):
499</p>
500
501<pre caption="Installing a prebuilt package without using local information">
502# <i>emerge --getbinpkgonly gnumeric</i>
503</pre>
504
505<p>
506You can also opt to install a specific version of a package.
507For instance, if you want to install a gnumeric version older than 1.2 -- for
508any reason whatsoever :) you would type:
509</p>
510
511<pre caption="Installing a specific gnumeric version">
512# <i>emerge --usepkg "&lt;gnumeric-1.2"</i>
513</pre>
514
515<p>
516Other possibilities are of course "&gt;" (later version) and "=" (the exact
517version).
518</p>
519
520
521</body>
522</subsection> 182<subsection>
523<subsection> 183<title>Removing Software</title>
524<title>Working with Dependencies</title>
525<body> 184<body>
526 185
527<p>
528Portage has an extensive support for dependency handling. Although you usually
529don't need to even think about this (as dependencies are automatically handled
530by Portage) some users might want to know how you can work with <c>emerge</c>
531and dependencies.
532</p> 186<p>
533 187When you want to remove a software package from your system, use <c>emerge
188--unmerge</c>. This will tell Portage to remove all files installed by that
189package from your system <e>except</e> the configuration files of that
190application if you have altered those after the installation. Leaving the
191configuration files allows you to continue working with the package if you ever
192decide to install it again.
534<p> 193</p>
535For instance, if you want Portage to pretend that none of the dependencies of a 194
536package are installed, you can use <c>--emptytree</c> (<c>-e</c> in short). This
537is useful with <c>--pretend</c> to display a complete tree of dependencies for
538any particular package. Without <c>--pretend</c>, <c>emerge</c> will (re)compile
539all listed packages. However, <c>glibc</c> will <e>not</e> be listed as
540dependency for safety reasons.
541</p> 195<p>
542 196However, a <brite>big warning</brite> applies: Portage will <e>not</e> check if
543<pre caption="Show all dependencies of gnumeric"> 197the package you want to remove is required by another package. It will however
544# <i>emerge --emptytree --pretend gnumeric</i> 198warn you when you want to remove an important package that breaks your system
545</pre> 199if you unmerge it.
546
547<p> 200</p>
548Another argument is <c>--nodeps</c>, which will ask Portage to try install the
549given package without taking care of the dependencies. It is trivial that this
550can lead to failures.
551</p>
552 201
553<pre caption="Installing gnumeric without taking care of the dependencies"> 202<pre caption="Removing gnumeric from the system">
554# <i>emerge --nodeps gnumeric</i> 203# <i>emerge --unmerge gnumeric</i>
555</pre> 204</pre>
556 205
557<p>
558The opposite of <c>--nodeps</c> is <c>--onlydeps</c>, which will have Portage
559install all dependencies of a given package, but not the package itself:
560</p> 206<p>
561 207When you remove a package from your system, the dependencies of that package
562<pre caption="Installing the dependencies of gnumeric"> 208that were installed automatically when you installed the software are left. To
563# <i>emerge --onlydeps gnumeric</i> 209have Portage locate all dependencies that can now be removed, use
210<c>emerge</c>'s <c>--depclean</c> functionality. We will talk about this later
211on.
564</pre> 212</p>
565 213
566</body> 214</body>
567</subsection> 215</subsection>
568<subsection> 216<subsection>
569<title>Updating your System</title> 217<title>Updating your System</title>
570<body> 218<body>
571 219
572<p> 220<p>
573Portage knows two special tags to denote a set of software packages: 221To keep your system in perfect shape (and not to mention install the latest
574<e>system</e> and <e>world</e>. You have already seen the former while 222security updates) you need to update your system regularly. Since Portage only
575installing Gentoo if you didn't use a <e>stage3</e> installation. To refresh 223checks the ebuilds in your Portage tree you first have to update your Portage
576things: <e>system</e> is the collection of <e>core</e> packages, necessary to 224tree. When your Portage tree is updated, you can update your system with
577have a working Gentoo system. 225<c>emerge --update world</c>:
578</p>
579
580<p> 226</p>
581The <e>world</e> tag consists of all software you have installed yourself on 227
582your system plus the <e>system</e> information. In other words, every time you 228<pre caption="Updating your system">
583emerge a package using <c>emerge &lt;package-name&gt;</c>, the 229# <i>emerge --update world</i>
584<c>&lt;package-name&gt;</c> is registered in the <e>world</e> file 230</pre>
585(<path>/var/cache/edb/world</path>). Dependencies are <e>not</e> part of the 231
586<e>world</e> file, but we will get to that later.
587</p> 232<p>
588 233Portage will then search for newer version of the applications you have
589<p> 234installed. However, it will only verify the versions for the applications you
590If you want to update the system packages, use the <c>--update</c> option 235have explicitly installed - not the dependencies. If you want to update every
591(<c>-u</c> in short): 236single package on your system, add the <c>--deep</c> argument:
592</p>
593
594<pre caption="Updating the system packages">
595# <i>emerge --update system</i>
596</pre>
597
598<p>
599An identical approach can be used for the world packages:
600</p> 237</p>
601 238
602<pre caption="Updating your entire system"> 239<pre caption="Updating your entire system">
603# <i>emerge --update world</i> 240# <i>emerge --update --deep world</i>
604</pre> 241</pre>
605 242
606<p>
607Again, if you want to see what <c>emerge</c> wants to update, use the
608<c>--pretend</c> option together with the <c>--update</c> option:
609</p> 243<p>
610 244If you have altered any of your <uri link="?part=2&amp;chap=2">USE flags</uri>
611<pre caption="Pretending to update your entire system"> 245lately you might want to add <c>--newuse</c> as well. Portage will then verify
612# <i>emerge --pretend --update world</i> 246if the change requires the installation of new packages or recompilation of
613<comment>(Some output removed to improve readability)</comment> 247existing ones:
614[ebuild U ] net-misc/wget-1.9-r1 [1.9]
615[ebuild UD] media-video/dvdauthor-0.5.0 [0.5.3]
616[ebuild U ] net-analyzer/ethereal-0.9.16 [0.9.14]
617</pre>
618
619<p> 248</p>
620Right next to the word "ebuild" you will notice a letter (or combination of 249
621letters) which gives you more information about the package: 250<pre caption="Performing a full update">
251# <i>emerge --update --deep --newuse world</i>
252</pre>
253
254</body>
255</subsection>
256<subsection>
257<title>Metapackages</title>
258<body>
259
260<p>
261Some packages in the Portage tree don't have any real content but are used to
262install a collection of packages. For instance, the <c>kde</c> package will
263install a complete KDE environment on your system by pulling in various
264KDE-related packages as dependencies.
265</p>
266
267<p>
268If you ever want to remove such a package from your system, running <c>emerge
269--unmerge</c> on the package won't have much effect as the dependencies remain
270on the system.
271</p>
272
273<p>
274Portage has the functionality to remove orphaned dependencies as well, but since
275the availability of software is dynamically dependent you first need to update
276your entire system fully, including the new changes you applied when changing
277USE flags. After this you can run <c>emerge --depclean</c> to remove the
278orphaned dependencies. When this is done, you need to rebuild the applications
279that were dynamically linked to the now-removed software titles but don't
280require them anymore.
281</p>
282
283<p>
284All this is handled with the following three commands:
285</p>
286
287<pre caption="Removing orphaned dependencies">
288# <i>emerge --update --deep --newuse world</i>
289# <i>emerge --depclean</i>
290# <i>revdep-rebuild</i>
291</pre>
292
293<p>
294<c>revdep-rebuild</c> is provided by the <c>gentoolkit</c> package; don't forget
295to emerge it first:
296</p>
297
298<pre caption="Installing the gentoolkit package">
299# <i>emerge gentoolkit</i>
300</pre>
301
302</body>
303</subsection>
304</section>
305<section>
306<title>When Portage is Complaining...</title>
307<subsection>
308<title>About SLOTs, Virtuals, Branches, Architectures and Profiles</title>
309<body>
310
311<p>
312As we stated before, Portage is extremely powerful and supports many features
313that other software management tools lack. To understand this, we explain a few
314aspects of Portage without going into too much detail.
315</p>
316
317<p>
318With Portage different versions of a single package can coexist on a system.
319While other distributions tend to name their package to those versions (like
320<c>freetype</c> and <c>freetype2</c>) Portage uses a technology called
321<e>SLOT</e>s. An ebuild declares a certain SLOT for its version. Ebuilds with
322different SLOTs can coexist on the same system. For instance, the
323<c>freetype</c> package has ebuilds with <c>SLOT="1"</c> and <c>SLOT="2"</c>.
324</p>
325
326<p>
327There are also packages that provide the same functionality but are implemented
328differently. For instance, <c>metalogd</c>, <c>sysklogd</c> and <c>syslog-ng</c>
329are all system loggers. Applications that rely on the availability of "a system
330logger" cannot depend on, for instance, <c>metalogd</c>, as the other system
331loggers are as good a choice as any. Portage allows for <e>virtuals</e>: each
332system logger provides <c>virtual/syslog</c> so that applications can depend on
333<c>virtual/syslog</c>.
334</p>
335
336<p>
337Software in the Portage tree can reside in different branches. By default your
338system only accepts packages that Gentoo deems stable. Most new software titles,
339when committed, are added to the testing branch, meaning more testing needs to
340be done before it is marked as stable. Although you will see the ebuilds for
341those software in the Portage tree, Portage will not update them before they are
342placed in the stable branch.
343</p>
344
345<p>
346Some software is only available for a few architectures. Or the software doesn't
347work on the other architectures, or it needs more testing, or the developer that
348committed the software to the Portage tree is unable to verify if the package
349works on different architectures.
350</p>
351
352<p>
353Each Gentoo installation adheres to a certain <c>profile</c> which contains,
354amongst other information, the list of packages that are required for a system
355to function normally.
356</p>
357
358</body>
359</subsection>
360<subsection id="blocked">
361<title>Blocked Packages</title>
362<body>
363
364<pre caption="Portage warning about blocked packages (with --pretend)">
365[blocks B ] gnome-base/bonobo-activation (from pkg gnome-base/libbonobo-2.4.0)
366</pre>
367
368<pre caption="Portage warning about blocked packages (without --pretend)">
369!!! Error: the gnome-base/bonobo-activation package conflicts with another package.
370!!! both can't be installed on the same system together.
371!!! Please use 'emerge --pretend' to determine blockers.
372</pre>
373
374<p>
375Ebuilds contain specific fields that inform Portage about its dependencies.
376There are two possible dependencies: build dependencies, declared in
377<c>DEPEND</c> and run-time dependencies, declared in <c>RDEPEND</c>. When one of
378these dependencies explicitly marks a package or virtual as being <e>not</e>
379compatible, it triggers a blockage.
380</p>
381
382<p>
383To fix a blockage, you can choose to not install the package or unmerge the
384conflicting package first. In the given example, you can opt not to install
385<c>libbonobo</c> or to remove <c>bonobo-activation</c> first.
386</p>
387
388</body>
389</subsection>
390<subsection id="masked">
391<title>Masked Packages</title>
392<body>
393
394<pre caption="Portage warning about masked packages">
395!!! all ebuilds that could satisfy "bootsplash" have been masked.
396</pre>
397
398<pre caption="Portage warning about masked packages - reason">
399!!! possible candidates are:
400
401- gnome-base/gnome-2.8.0_pre1 (masked by: <i>~x86 keyword</i>)
402- lm-sensors/lm-sensors-2.8.7 (masked by: <i>-sparc keyword</i>)
403- sys-libs/glibc-2.3.4.20040808 (masked by: <i>-* keyword</i>)
404- dev-util/cvsd-1.0.2 (masked by: <i>missing keyword</i>)
405- media-video/ati-gatos-4.3.0 (masked by: <i>package.mask</i>)
406- sys-libs/glibc-2.3.2-r11 (masked by: <i>profile</i>)
407</pre>
408
409<p>
410When you want to install a package that isn't available for your system, you
411will receive this masking error. You should try installing a different
412application that is available for your system or wait until the package is put
413available. There is always a reason why a package is masked:
622</p> 414</p>
623 415
624<ul> 416<ul>
625 <li> 417 <li>
626 <e>B</e> (blocks) The package listed to the left is blocking the emerge of 418 <b>~arch keyword</b> means that the application is not tested sufficiently
627 the package listed to the right 419 to be put in the stable branch. Wait a few days or weeks and try again.
628 </li> 420 </li>
629 <li> 421 <li>
630 <e>N</e> (new) The package is new to your system and will be emerged for the 422 <b>-arch keyword</b> or <b>-* keyword</b> means that the application does
631 first time 423 not work on your architecture. If you believe the package does work file
424 a bug at our <uri link="http://bugs.gentoo.org">bugzilla</uri> website.
632 </li> 425 </li>
633 <li> 426 <li>
634 <e>R</e> (reemerge) The package isn't new, but needs to be reemerged 427 <b>missing keyword</b> means that the application has not been tested on
428 your architecture yet. Ask the architecture porting team to test the package
429 or test it for them and report your findings on our <uri
430 link="http://bugs.gentoo.org">bugzilla</uri> website.
635 </li> 431 </li>
636 <li> 432 <li>
637 <e>F</e> (fetch) The package requires that you download the source code 433 <b>package.mask</b> means that the package has been found corrupt, unstable
638 manually (for instance due to licencing issues) 434 or worse and has been deliberately marked as do-not-use.
639 </li> 435 </li>
640 <li> 436 <li>
641 <e>U</e> (update) The package already exists on your system but will be 437 <b>profile</b> means that the package has been found not suitable for your
642 upgraded 438 profile. The application might break your system if you installed it or is
643 </li> 439 just not compatible with the profile you use.
644 <li>
645 <e>UD</e> (downgrade) The package already exists on your system but will be
646 downgraded
647 </li>
648 <li>
649 <e>U-</e> (slot warning) The package you have installed on your system
650 is listed as a package that can not coexist with a different version, but
651 your update does. The update will be installed and the older version will be
652 removed.
653 </li> 440 </li>
654</ul> 441</ul>
655 442
656<p>
657In certain cases, an update may mean a downgrade (i.e. install an older version
658instead of a newer version). If you don't want this to happen, use the
659<c>--upgradeonly</c> option (<c>-U</c> in short):
660</p>
661
662<pre caption="Upgrading your entire system">
663# <i>emerge --update --upgradeonly world</i>
664</pre>
665
666<p>
667Of course, we are talking here about <e>system</e> and <e>world</e>, but you can
668perform the same actions for individual software packages.
669</p>
670
671</body> 443</body>
672</subsection>
673<subsection> 444</subsection>
674<title>Removing Software</title> 445<subsection id="missingdependencies">
675<body> 446<title>Missing Dependencies</title>
676
677<p>
678If you want to remove software from your system, you can use the <c>unmerge</c>
679option (<c>-C</c> - capital C - in short):
680</p>
681
682<pre caption="Uninstalling software">
683# <i>emerge unmerge gnumeric</i>
684</pre>
685
686<p>
687If you want to test a removal (but not perform it), you can use <c>--pretend</c>
688again:
689</p>
690
691<pre caption="Pretending to uninstall software">
692# <i>emerge --pretend unmerge gnumeric</i>
693</pre>
694
695<warn>
696Portage doesn't verify if a package is a dependency for another
697installed package. It also doesn't warn you if the package is part of
698<e>system</e>, i.e. a core application necessary for the correct functioning of
699your system!
700</warn>
701
702<p>
703Once the unmerge begins you will see a long list of filenames belonging to the
704package. Some of these filenames will have a flag displayed to the
705left of the filename. The flags <c>!mtime</c>, <c>!empty</c>, and <c>cfgpro</c>
706specify reasons why certain files are not being removed while the package is.
707Files listed without any of these three flags are removed from the
708filesystem successfully. The three flags specify the following reasons:
709</p>
710
711<ul>
712 <li>
713 <c>!mtime</c> : The listed file has been changed since it was installed,
714 probably by you or some tool
715 </li>
716 <li>
717 <c>!empty</c> : The listed directory is not empty
718 </li>
719 <li>
720 <c>cfgpro</c> : Another already installed package claims to own this file
721 </li>
722</ul>
723
724</body> 447<body>
725</subsection> 448
726</section> 449<pre caption="Portage warning about missing dependency">
727<section> 450emerge: there are no ebuilds to satisfy "&gt;=sys-devel/gcc-3.4.2-r4".
728<title>Software Availability</title> 451
452!!! Problem with ebuild sys-devel/gcc-3.4.2-r2
453!!! Possibly a DEPEND/*DEPEND problem.
454</pre>
455
456<p>
457The application you are trying to install depends on another package that is not
458available for your system. Please check <uri
459link="http://bugs.gentoo.org">bugzilla</uri> if the issue is known and if not,
460please report it. Unless you are mixing branches this should not occur and is
461therefore a bug.
462</p>
463
464</body>
729<subsection> 465</subsection>
730<title>ARCH or not?</title> 466<subsection id="ambiguousebuild">
731<body> 467<title>Ambiguous Ebuild Name</title>
732
733<p>
734Gentoo places its packages in two possible stadia called <e>ARCH</e> and
735<e>~ARCH</e>. Don't take this literally: the stadia depend on the architecture
736you are using. In other words, for x86-based systems you have <e>x86</e> and
737<e>~x86</e>, for ppc-based systems you have <e>ppc</e> and <e>~ppc</e> etc.
738</p>
739
740<p>
741The <e>~ARCH</e> stadium means that the package works for the developer in
742charge of the package, but that the package hasn't been tested thoroughly enough
743by the community to be placed in <e>ARCH</e>. <e>~ARCH</e> packages usually go
744to <e>ARCH</e> after being bugfree for a sufficient amount of time.
745</p>
746
747<p>
748Your system will use <e>ARCH</e> packages per default. If you want to live on
749the edge, don't mind having a broken package once in a while, and you like
750submitting bugreports to <uri
751link="http://bugs.gentoo.org">bugs.gentoo.org</uri>, then you can opt to use
752<e>~ARCH</e> packages. To "move" your system to a <e>~ARCH</e>-using system,
753edit the <c>ACCEPT_KEYWORDS</c> variable in <path>/etc/make.conf</path> so that
754it reads <e>~ARCH</e> (again: for x86-based systems: <e>~x86</e>, etc.).
755</p>
756
757<p>
758If you want to update your system now, you will notice that <e>a lot</e> of
759packages will be updated!
760</p>
761
762</body> 468<body>
763</subsection> 469
470<pre caption="Portage warning about ambiguous ebuild names">
471!!! The short ebuild name "aterm" is ambiguous. Please specify
472!!! one of the following fully-qualified ebuild names instead:
473
474 dev-libs/aterm
475 x11-terms/aterm
476</pre>
477
478<p>
479The application you want to install has a name that corresponds with more than
480one package. You need to supply the category name as well. Portage will inform
481you of possible matches to choose from.
482</p>
483
484</body>
764<subsection> 485</subsection>
765<title>Masked Packages</title> 486<subsection id="circulardependencies">
766<body> 487<title>Circular Dependencies</title>
767
768<p>
769When you want to install a package, you might come across the following message:
770</p>
771
772<pre caption="Message about masked packages">
773Calculating dependencies
774!!! <comment>all ebuilds that could satisfy </comment>&lt;your package&gt;<comment> have been masked.</comment>
775</pre>
776
777<p>
778A package can be masked due to two reasons:
779</p>
780
781<ol>
782 <li>The package is in <e>~ARCH</e> while you use <e>ARCH</e></li>
783 <li>The package is hard-masked explicitly</li>
784</ol>
785
786<p>
787If the package is masked because of the first reason, and you <e>really</e> want
788to install it (knowing that there <e>is</e> a reason why it isn't available in
789<e>ARCH</e>), you can temporarily accept <e>~ARCH</e> packages:
790</p>
791
792<pre caption="Temporarily accepting ~ARCH packages">
793# <i>ACCEPT_KEYWORDS="~x86" emerge gnumeric</i>
794</pre>
795
796<p>
797A package is hardmasked if it is listed in
798<path>/usr/portage/profiles/package.mask</path>. If you read this file, you
799will also read the reason why the package is hardmasked (it is usually added as
800a comment). If you want to install the package nevertheless (despite all the
801possible warnings we could ever throw at your head about "breaking your system",
802"breaks other packages", or "badly needs testing"), create the
803<path>/etc/portage/package.unmask</path> file and list the package in it (use
804the same format as is used in <path>/usr/portage/profiles/package.mask</path>).
805</p>
806
807<p>
808Do <e>not</e> alter the <path>/usr/portage/profiles/package.mask</path> file as
809all changes are undone the next time you update your Portage tree.
810</p>
811
812<p>
813Another trick to circumvent the "masked package" problem is to install the
814package using the full path. This will ignore both the <c>ACCEPT_KEYWORD</c>
815settings and the <path>package.mask</path> listing.
816</p>
817
818<pre caption="Installing a package without checking for stadium / masking">
819# <i>emerge /usr/portage/app-office/gnumeric/gnumeric-1.2.0.ebuild</i>
820</pre>
821
822</body> 488<body>
823</subsection> 489
490<pre caption="Portage warning about circular dependencies">
491!!! Error: circular dependencies:
492
493ebuild / net-print/cups-1.1.15-r2 depends on ebuild / app-text/ghostscript-7.05.3-r1
494ebuild / app-text/ghostscript-7.05.3-r1 depends on ebuild / net-print/cups-1.1.15-r2
495</pre>
496
497<p>
498Two (or more) packages you want to install depend on each other and can
499therefore not be installed. This is most likely a bug in the Portage tree.
500Please resync after a while and try again. You can also check <uri
501link="http://bugs.gentoo.org">bugzilla</uri> if the issue is known and if not,
502report it.
503</p>
504
505</body>
824<subsection> 506</subsection>
825<title>Blocked Packages</title> 507<subsection id="fetchfailed">
508<title>Fetch failed</title>
509<body>
510
511<pre caption="Portage warning about fetch failed">
512!!! Fetch failed for sys-libs/ncurses-5.4-r5, continuing...
513<comment>(...)</comment>
514!!! Some fetch errors were encountered. Please see above for details.
515</pre>
516
517<p>
518Portage was unable to download the sources for the given application and will
519try to continue installing the other applications (if applicable). This failure
520can be due to a mirror that has not synchronised correctly or because the ebuild
521points to an incorrect location. The server where the sources reside can also be
522down for some reason.
523</p>
524
525<p>
526Retry after one hour to see if the issue still persists.
527</p>
528
826<body> 529</body>
530</subsection>
531<subsection id="profileprotect">
532<title>System Profile Protection</title>
533<body>
827 534
828<p> 535<pre caption="Portage warning about profile-protected package">
829You have a situation when you receive the following error on your screen: 536!!! Trying to unmerge package(s) in system profile. 'sys-apps/portage'
537!!! This could be damaging to your system.
538</pre>
539
830</p> 540<p>
831 541You have asked to remove a package that is part of your system's core packages.
832<pre caption="Blocking package"> 542It is listed in your profile as required and should therefore not be removed
833[blocks B ] gnome-base/bonobo-activation (from pkg gnome-base/libbonobo-2.4.0) 543from the system.
834</pre>
835
836<p> 544</p>
837In the above example, the package <c>bonobo-activation</c> is blocking the
838emerge of <c>libbonobo</c>. To resolve this issue, remove the
839<c>bonobo-activation</c> package and continue:
840</p>
841
842<pre caption="Resolving a blocking situation">
843# <i>emerge unmerge bonobo-activation</i>
844</pre>
845 545
846</body> 546</body>
847</subsection> 547</subsection>
848</section> 548</section>
849</sections> 549</sections>

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.51

  ViewVC Help
Powered by ViewVC 1.1.20