/[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.1 Revision 1.2
1<!-- The content of this document is licensed under the CC-BY-SA license --> 1<!-- The content of this document is licensed under the CC-BY-SA license -->
2<!-- See http://creativecommons.org/licenses/by-sa/1.0 --> 2<!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
3 3
4<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-portage.xml,v 1.1 2003/11/20 10:52:35 swift Exp $ --> 4<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-portage.xml,v 1.2 2003/11/25 17:34:47 swift Exp $ -->
5 5
6<sections> 6<sections>
7<section> 7<section>
8<title>Obtaining Package Information</title> 8<title>Obtaining Package Information</title>
9<subsection> 9<subsection>
10<title>The Lord of All Tools: emerge</title> 10<title>The Lord of All Tools: emerge</title>
11<body> 11<body>
12 12
13<p>
14We have briefly encountered <c>emerge</c> in the previous chapter, but not to
15the extent that you are now able to work with it to its fullest potential. We
16will fix that right now ;-)
17</p>
18
19<p>
20<c>emerge</c> is the command used to install, remove, query and maintain
21software packages. It is a front-end for <c>ebuild</c>; people interested in
22becoming Gentoo professionals will learn how to use <c>ebuild</c> later on. For
23now, we will focus on <c>emerge</c> as it has functionality that <c>ebuild</c>
24lacks (such as resolving dependencies, searching the Portage tree, etc.).
25</p>
26
27<p>
28Since <c>emerge</c> is the most important tool for Gentoo users, it has an
29extensive manpage you can read by issuing <c>man emerge</c>. You can also view
30the in-command help by running <c>emerge --help</c>.
31</p>
32
33<pre caption="Retrieving help for emerge">
34# <i>man emerge</i>
35# <i>emerge --help</i>
36</pre>
37
38</body>
39</subsection>
40<subsection>
41<title>The Portage Tree</title>
42<body>
43
44<p>
45Before we continue describing <c>emerge</c>, let us first take a look at the
46Portage Tree. Go to <path>/usr/portage</path> and do a listing of the available
47directories.
48</p>
49
50<pre caption="Viewing the Portage Tree">
51# <i>cd /usr/portage; ls --classify</i>
52<comment>(The --classify will append a special character to note the filetype)</comment>
53app-admin/ dev-ml/ gnome-libs/ net-print/
54app-arch/ dev-perl/ gnome-office/ net-wireless/
55app-benchmarks/ dev-php/ header.txt net-www/
56app-cdr/ dev-python/ incoming/ net-zope/
57app-crypt/ dev-ruby/ jython/ packages/
58app-dicts/ dev-tcltk/ kde-apps/ profiles/
59app-doc/ dev-tex/ kde-base/ releases/
60app-editors/ dev-util/ kde-i18n/ scripts/
61app-emacs/ distfiles/ kde-libs/ sec-policy/
62app-emulation/ eclass/ licenses/ skel.ChangeLog
63app-games/ experimental/ media-fonts/ skel.ebuild
64app-gnustep/ files/ media-gfx/ skel.metadata.xml
65app-i18n/ fresco-base/ media-libs/ snapshots/
66app-misc/ games-action/ media-plugins/ sys-apps/
67app-office/ games-arcade/ media-radio/ sys-build/
68app-pda/ games-board/ media-sound/ sys-cluster/
69app-portage/ games-emulation/ media-tv/ sys-devel/
70app-sci/ games-engines/ media-video/ sys-fs/
71app-shells/ games-fps/ metadata/ sys-kernel/
72app-text/ games-kids/ net-analyzer/ sys-kmods/
73app-vim/ games-misc/ net-apache/ sys-libs/
74app-xemacs/ games-mud/ net-dialup/ unix2tcp/
75berlin-base/ games-puzzle/ net-dns/ x11-base/
76dev-ada/ games-roguelike/ net-firewall/ x11-libs/
77dev-cpp/ games-rpg/ net-fs/ x11-misc/
78dev-db/ games-server/ net-ftp/ x11-plugins/
79dev-dotnet/ games-simulation/ net-im/ x11-terms/
80dev-embedded/ games-sports/ net-irc/ x11-themes/
81dev-games/ games-strategy/ net-libs/ x11-wm/
82dev-haskell/ games-util/ net-mail/ xfce-base/
83dev-java/ glep/ net-misc/ xfce-extra/
84dev-lang/ gnome-apps/ net-nds/
85dev-libs/ gnome-base/ net-news/
86dev-lisp/ gnome-extra/ net-p2p/
87</pre>
88
89<p>
90As you can see, the Portage tree has several subdirectories. Most of them are
91the <e>categories</e> in which the Gentoo packages, called <e>ebuilds</e>,
92reside. Take a look at, for instance, <path>app-office</path>:
93</p>
94
95<pre caption="Viewing a category">
96# <i>cd app-office; ls --classify</i>
97abiword/ gnotime/ kmymoney2/ ooodi/ plan/ timestamp.x
98dia/ gnucash/ koffice/ oooqs/ qhacc/
99dia2code/ gnumeric/ lxbank/ openoffice/ sc/
100facturalux/ ical/ lyx/ openoffice-bin/ scribus/
101gaby/ kbudget/ mdbtools/ openoffice-ximian/ siag/
102gnofin/ khacc/ mrproject/ phprojekt/ texmacs/
103</pre>
104
105<p>
106Inside a category you will find the packages belonging to that category, with a
107seperate directory for each package. Let us take a look at the <c>openoffice</c>
108package:
109</p>
110
111<pre caption="Viewing a package">
112# <i>cd openoffice; ls --classify</i>
113ChangeLog files/ openoffice-1.0.3-r1.ebuild openoffice-1.1.0-r2.ebuild
114Manifest metadata.xml openoffice-1.1.0-r1.ebuild openoffice-1.1.0.ebuild
115</pre>
116
117<p>
118Remember that we told you that a Gentoo package is called an ebuild? Well, in
119the example directory four of such ebuilds are stored. Their naming is
120almost identical: they only differ in the version name.
121You are free to view the contents of such a package: they are plain scripts. We
122will not discuss it right now as it isn't important to know if you plan on just
123using Gentoo.
124</p>
125
126<p>
127The other files are the <path>ChangeLog</path> (which contains a listing of all
128the changes done to the ebuilds), <path>Manifest</path> (which contains the
129checksums and permissions of all the files in the directory) and
130<path>metadata.xml</path> (which contains more information about the package,
131such as the responsible development group -- called <e>herd</e> and a more
132extensive description).
133</p>
134
135<p>
136Inside the <path>files</path> directory you will find extra files, needed by
137Portage: digests (checksums and permissions of the files needed by a single
138version of the package), patches, example configuration files, etc.
139</p>
140
141<pre caption="Viewing the extra files">
142# <i>cd files; ls --classify</i>
1431.0.3/ digest-openoffice-1.0.3-r1 digest-openoffice-1.1.0-r1
1441.1.0/ digest-openoffice-1.1.0 digest-openoffice-1.1.0-r2
145# <i>cd 1.1.0; ls --classify</i>
146fixed-gcc.patch ooffice-wrapper-1.3
147newstlportfix.patch openoffice-1.1.0-linux-2.6-fix.patch
148no-mozab.patch openoffice-1.1.0-sparc64-fix.patch
149nptl.patch
150</pre>
151
152<p>
153If you go back to the root of the Portage tree (<path>/usr/portage</path>) you
154will notice that there are other, non-category directories too. We will discuss
155those later in this chapter.
156</p>
157
13</body> 158</body>
14</subsection> 159</subsection>
15<subsection> 160<subsection>
16<title>Search for a Package</title> 161<title>Search for a Package</title>
17<body> 162<body>
163
164<p>
165If you are new to Linux or Gentoo, you might not know what tool you need for
166what job. To facilitate searching, <c>emerge</c> provides you with a way to
167search through the available packages on your system. There are two ways you can
168search through packages: by <e>name</e>, or by <e>name</e> and
169<e>description</e>.
170</p>
171
172<p>
173To search through the Portage tree by name, use <c>emerge search</c>. For
174instance, to find out more about <c>mozilla</c>:
175</p>
176
177<pre caption="Showing information about mozilla">
178# <i>emerge search mozilla</i>
179Searching...
180[ Results for search key : mozilla ]
181[ Applications found : 5 ]
182<comment>(Some output removed to improve readability)</comment>
183* net-www/mozilla
184 Latest version available: 1.5-r1
185 Latest version installed: 1.4-r3
186 Size of downloaded files: 29,153 kB
187 Homepage: http://www.mozilla.org
188 Description: The Mozilla Web Browser
189
190* net-www/mozilla-firebird
191 Latest version available: 0.7
192 Latest version installed: [ Not Installed ]
193 Size of downloaded files: 37,850 kB
194 Homepage: http://www.mozilla.org/projects/firebird/
195 Description: The Mozilla Firebird Web Browser
196<comment>(...)</comment>
197</pre>
198
199<p>
200If you want to include a search through the descriptions too, use the
201<c>--searchdesc</c> argument:
202</p>
203
204<pre caption="Search through the descriptions too">
205# <i>emerge --searchdesc mozilla</i>
206Searching...
207[ Results for search key : mozilla ]
208[ Applications found : 10 ]
209<comment>(Some output removed to improve readability)</comment>
210* dev-libs/nss-3.8
211 Latest version available: 3.8
212 Latest version installed: 3.8
213 Size of downloaded files: 2,782 kB
214 Homepage: http://www.mozilla.org/projects/security/pki/nss/
215 Description: Mozilla's Netscape Security Services Library that implements PKI support
216</pre>
217
218<p>
219As you can see, the output of <c>emerge</c> informs you about the category and
220name of the package, the available version, the currently installed version,
221the size of the downloaded files, the homepage and the small description.
222</p>
223
224<p>
225You see something new? Yes, <e>downloaded files</e>. When you tell Portage to
226install a package, it ofcourse needs to have the necessary sources (or
227precompiled packages) available. It therefor checks the contents of
228<path>/usr/portage/distfiles</path> (for sourcecode) or
229<path>/usr/portage/packages/All</path> (for precompiled packages) to see if the
230necessary files are already available. If not, it downloads the necessary files
231and places them in those directories.
232</p>
233
234<note>
235Searching the Portage Tree, especially when using <c>--searchdesc</c>, is very
236time consuming. There are other, more performant tools available. We will
237describe those in the chapter on <uri link="?part=2&amp;chap=7">Gentoolkit and
238Other Tools</uri>.
239</note>
18 240
19</body> 241</body>
20</subsection> 242</subsection>
21</section> 243</section>
22<section> 244<section>
23<title>Updating Portage</title> 245<title>Updating Portage</title>
24<subsection> 246<subsection>
25<title>Using rsync</title> 247<title>Introduction</title>
26<body>
27
28</body> 248<body>
29</subsection> 249
250<p>
251Searching through Portage is nice, but if you don't update your Portage Tree
252regularly, you will be stuck with the packages and versions available on your
253system. This means that your system will get outdated pretty soon, and that
254packages with possible security problems will remain on your system.
255</p>
256
257<p>
258There are several ways to update your Portage Tree. The most popular method is
259by using one of our <uri link="/main/en/mirrors.xml">rsync mirrors</uri>.
260Another one is by using a Portage snapshot (in case a firewall or unavailability
261of a network prohibits the use of the rsync server).
262</p>
263
264</body>
30<subsection> 265</subsection>
31<title>Using a Downloaded Snapshot</title> 266<subsection>
267<title>Selecting a Mirror for rsync</title>
268<body>
269
270<p>
271It is adviseable to first select a fast <uri
272link="/main/en/mirrors.xml">mirror</uri> close to you. You can do this manually
273(by setting the <c>SYNC</c> variable in <path>/etc/make.conf</path>) or use
274<c>mirrorselect</c> to do this for you automatically. As the <c>SYNC</c>
275variable will be discussed later on, we will focus on using <c>mirrorselect</c>.
276First install <c>mirrorselect</c> by emerging it:
277</p>
278
279<pre caption="Installing mirrorselect">
280# <i>emerge --usepkg mirrorselect</i>
281</pre>
282
283<p>
284Now run <c>mirrorselect</c> to automatically select mirrors for you (it will
285also setup Portage to use a mirror for the sourcecode):
286</p>
287
288<pre caption="Running mirrorselect">
289# <i>mirrorselect -a -s3</i>
290</pre>
291
32<body> 292</body>
293</subsection>
294<subsection>
295<title>Updating Portage</title>
296<body>
297
298<p>
299To update Portage using rsync, simply run <c>emerge sync</c>:
300</p>
301
302<pre caption="Updating Portage using emerge sync">
303# <i>emerge sync</i>
304</pre>
305
306<p>
307If this fails (due to network problems, or a firewall), you can try using
308<c>emerge-webrsync</c> which will download a Portage Tree snapshot using
309<c>wget</c>. This also means that you can use proxies if you want. We discussed
310how to setup your system to use proxies during the Gentoo installation.
311</p>
312
313<pre caption="Updating Portage using emerge-webrsync">
314# <i>emerge-webrsync</i>
315</pre>
33 316
34</body> 317</body>
35</subsection> 318</subsection>
36</section> 319</section>
37<section> 320<section>
38<title>Maintaining Software</title> 321<title>Maintaining Software</title>
39<subsection> 322<subsection>
40<title>Installing Software</title> 323<title>Installing Software</title>
41<body> 324<body>
42 325
43</body> 326</body>
44</subsection> 327</subsection>
45<subsection> 328<subsection>
46<title>Updating Software</title> 329<title>Updating Software</title>
47<body> 330<body>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.20