/[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.6 Revision 1.17
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.6 2003/11/27 14:45:38 swift Exp $ --> 4<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-portage.xml,v 1.17 2004/01/07 18:01:33 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>
12 12
13<p> 13<p>
14The main Portage tool that most users will use is <c>emerge</c>. We have already 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 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> 16briefly explained how to use it. This chapter will elaborate on <c>emerge</c>
17and learn you how to use <c>emerge</c> to fix all your software-related needs. 17and teach you how to use <c>emerge</c> to fix all your software-related needs.
18</p> 18</p>
19 19
20<p> 20<p>
21<c>emerge</c> is the command used to install, remove, query and maintain 21<c>emerge</c> is the command used to install, remove, query and maintain
22software packages. It is a front-end for <c>ebuild</c>; people interested in 22software packages. It is a front-end for <c>ebuild</c>; people interested in
103gnofin/ khacc/ mrproject/ phprojekt/ texmacs/ 103gnofin/ khacc/ mrproject/ phprojekt/ texmacs/
104</pre> 104</pre>
105 105
106<p> 106<p>
107Inside a category you will find the packages belonging to that category, with a 107Inside a category you will find the packages belonging to that category, with a
108seperate directory for each package. Let us take a look at the <c>openoffice</c> 108separate directory for each package. Let us take a look at the <c>openoffice</c>
109package: 109package:
110</p> 110</p>
111 111
112<pre caption="Viewing a package"> 112<pre caption="Viewing a package">
113# <i>cd openoffice; ls --classify</i> 113# <i>cd openoffice; ls --classify</i>
224 224
225<p> 225<p>
226You see something new? Yes, <e>downloaded files</e>. When you tell Portage to 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 227install a package, it of course needs to have the necessary sources (or
228precompiled packages) available. It therefore checks the contents of 228precompiled packages) available. It therefore checks the contents of
229<path>/usr/portage/distfiles</path> (for sourcecode) or 229<path>/usr/portage/distfiles</path> (for source code) or
230<path>/usr/portage/packages/All</path> (for precompiled packages) to see if the 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 231necessary files are already available. If not, it downloads the necessary files
232and places them in those directories. 232and places them in those directories.
233</p> 233</p>
234 234
235<!--
235<note> 236<note>
236Searching the Portage Tree, especially when using <c>--searchdesc</c>, is very 237Searching the Portage Tree, especially when using <c>- -searchdesc</c>, is very
237time consuming. There are other, more performant tools available. We will 238time consuming. There are other, more performant tools available. We will
238describe those in the chapter on <uri link="?part=2&amp;chap=7">Gentoolkit and 239describe those in the chapter on <uri link="?part=2&amp;chap=7">Gentoolkit and
239Other Tools</uri>. 240Other Tools</uri>.
240</note> 241</note>
242-->
241 243
242</body> 244</body>
243</subsection> 245</subsection>
244<subsection> 246<subsection>
245<title>Viewing the ChangeLog</title> 247<title>Viewing the ChangeLog</title>
246<body> 248<body>
247 249
248<p> 250<p>
249While browsing through the Portage Tree, you saw that there was a ChangeLog for 251While browsing through the Portage Tree, you saw that there was a ChangeLog for
250each package. You can view this ChangeLog with <c>emerge</c> too. Use the 252each package. You can view the ChangeLog entries between the available version
253and the installed version with <c>emerge</c> too. Use the
251<c>--pretend --changelog</c> (<c>-pl</c> in short) options. As an example we 254<c>--pretend --changelog</c> (<c>-pl</c> in short) options. As an example we
252will view the ChangeLog entries for <c>gnumeric</c>: 255will view the ChangeLog entries for <c>gnumeric</c>:
253</p> 256</p>
254 257
255<pre caption="Viewing the ChangeLog entries for gnumeric"> 258<pre caption="Viewing the ChangeLog entries for gnumeric">
256# <i>emerge --pretend --changelog gnumeric</i> 259# <i>emerge --pretend --changelog gnumeric</i>
260<comment>(Some output removed to improve readability)</comment>
261*gnumeric-1.2.2
262
263 27 Nov 2003; foser &lt;foser@gentoo.org&gt; gnumeric-1.2.2.ebuild :
264 New release, requested in #34492
265 updated deps
266
267 12 Nov 2003; Jason Wever &lt;weeve@gentoo.org&gt; gnumeric-1.2.0.ebuild:
268 Marked stable on sparc, fixes bug #32405.
269
270 14 Oct 2003; Jason Wever &lt;weeve@gentoo.org&gt; gnumeric-1.0.8.ebuild:
271 Added ~sparc keyword. Fixes bug #31150.
257</pre> 272</pre>
258 273
259</body> 274</body>
260</subsection> 275</subsection>
261</section> 276</section>
298# <i>emerge --usepkg mirrorselect</i> 313# <i>emerge --usepkg mirrorselect</i>
299</pre> 314</pre>
300 315
301<p> 316<p>
302Now run <c>mirrorselect</c> to automatically select mirrors for you (it will 317Now run <c>mirrorselect</c> to automatically select mirrors for you (it will
303also setup Portage to use a mirror for the sourcecode): 318also setup Portage to use a mirror for the source code):
304</p> 319</p>
305 320
306<pre caption="Running mirrorselect"> 321<pre caption="Running mirrorselect">
307# <i>mirrorselect -a -s3</i> 322# <i>mirrorselect -a -s3</i>
308</pre> 323</pre>
336</subsection> 351</subsection>
337</section> 352</section>
338<section> 353<section>
339<title>Maintaining Software</title> 354<title>Maintaining Software</title>
340<subsection> 355<subsection>
341<title>Building or Prebuild?</title> 356<title>Building or Prebuilt?</title>
342<body> 357<body>
343 358
344<p> 359<p>
345Gentoo provides ebuilds, the Gentoo packages if you like. But when you want to 360Gentoo provides ebuilds, the Gentoo packages if you like. But when you want to
346install such an ebuild, you can choose between <e>building</e> the package, or 361install such an ebuild, you can choose between <e>building</e> the package and
347using a <e>prebuild</e> package. But what are the advantages/disadvantages of 362using a <e>prebuilt</e> package. But what are the advantages/disadvantages of
348both approaches, and can they be used next to each other? 363both approaches, and can they be used next to each other?
349</p> 364</p>
350 365
351<p> 366<p>
352As you probably have guessed, building packages takes a lot of time (especially 367As you probably have guessed, building packages takes a lot of time (especially
357Of course, you can also define high optimization options (in the <c>CFLAGS</c> 372Of course, you can also define high optimization options (in the <c>CFLAGS</c>
358and <c>CXXFLAGS</c> variables) to compile the package with. 373and <c>CXXFLAGS</c> variables) to compile the package with.
359</p> 374</p>
360 375
361<p> 376<p>
362Using prebuild packages improves the installation time (as no more compilation 377Using prebuilt packages improves the installation time (as no more compilation
363is needed), but you will lose the advantages of the <c>USE</c> setting and the 378is needed), but you will lose the advantages of the <c>USE</c> setting and the
364<c>CFLAGS</c> &amp; <c>CXXFLAGS</c> variables. 379<c>CFLAGS</c> &amp; <c>CXXFLAGS</c> variables.
365</p> 380</p>
366 381
367<p> 382<p>
368As previously stated, prebuild packages are stored in the 383As previously stated, prebuilt packages are stored in the
369<path>/usr/portage/packages/All</path> directory, while the sourcecode of the 384<path>/usr/portage/packages/All</path> directory, while the source code of the
370packages are placed in <path>/usr/portage/distfiles</path>. If you have finished 385packages is placed in <path>/usr/portage/distfiles</path>. If you have finished
371installing a package you can remove the package or sourcecode from the 386installing a package you can remove the package or source code from the
372respective directory. However, you might want to keep the package/sourcecode of 387respective directory. However, you might want to keep the package/source code of
373the latest version, just in case you want to reinstall the package (so you don't 388the latest version, just in case you want to reinstall the package (so you don't
374have to redownload it). 389have to redownload it).
375</p> 390</p>
376 391
377</body> 392</body>
380<title>Installing Software from Sources</title> 395<title>Installing Software from Sources</title>
381<body> 396<body>
382 397
383<p> 398<p>
384Okay, enough talking, let's cut to the chase. To install a package, you will use 399Okay, enough talking, let's cut to the chase. To install a package, you will use
385the <c>emerge</c> command. If you don't want to use any prebuild packages, you 400the <c>emerge</c> command. If you don't want to use any prebuilt packages, you
386can just use <c>emerge &lt;package-name&gt;</c> or <c>emerge 401can just use <c>emerge &lt;package-name&gt;</c> or <c>emerge
387&lt;category&gt;/&lt;package-name&gt;</c>. As an example we'll install 402&lt;category&gt;/&lt;package-name&gt;</c>. As an example we'll install
388<c>gnumeric</c>: 403<c>gnumeric</c>:
389</p> 404</p>
390 405
391<pre caption="Building gnumeric"> 406<pre caption="Building gnumeric">
392# <i>emerge gnumeric</i> 407# <i>emerge gnumeric</i>
393</pre> 408</pre>
394 409
395<p> 410<p>
396This will download the sourcecode for you and unpacks, compiles and installs the 411This will download the source code for you and unpacks, compiles and installs
397package on your system. It will also do the same for all the dependencies. If 412the package on your system. It will also do the same for all the dependencies.
398you want to see what dependencies will be installed with it, use the 413If you want to see what dependencies will be installed with it, use the
399<c>--pretend</c> option (<c>-p</c> in short): 414<c>--pretend</c> option (<c>-p</c> in short):
400</p> 415</p>
401 416
402<pre caption="Pretending to build gnumeric"> 417<pre caption="Pretending to build gnumeric">
403# <i>emerge --pretend gnumeric</i> 418# <i>emerge --pretend gnumeric</i>
404</pre> 419</pre>
405 420
406<p> 421<p>
407If you want to download the sourcecode of the package and its dependencies, 422If you want to download the source code of the package and its dependencies,
408but don't want to build the package, use the <c>--fetchonly</c> option 423but don't want to build the package, use the <c>--fetchonly</c> option
409(<c>-f</c> in short): 424(<c>-f</c> in short):
410</p> 425</p>
411 426
412<pre caption="Fetching sources for gnumeric"> 427<pre caption="Fetching sources for gnumeric">
438</p> 453</p>
439 454
440</body> 455</body>
441</subsection> 456</subsection>
442<subsection> 457<subsection>
443<title>Installing Prebuild Packages</title> 458<title>Installing Prebuilt Packages</title>
444<body> 459<body>
445 460
446<p> 461<p>
447When you want to install a prebuild package, you should use the <c>--usepkg</c> 462When you want to install a prebuilt package, you should use the <c>--usepkg</c>
448option (<c>-k</c> in short). This will use the binary package available in 463option (<c>-k</c> in short). This will use the binary package available in
449<path>/usr/portage/packages/All</path> <e>if</e> the package and the version of 464<path>/usr/portage/packages/All</path> <e>if</e> the package and the version of
450the application you want to install match. 465the application you want to install match.
451</p> 466</p>
452 467
453<pre caption="Installing a prebuild package for gnumeric"> 468<pre caption="Installing a prebuilt package for gnumeric">
454# <i>emerge --usepkg gnumeric</i> 469# <i>emerge --usepkg gnumeric</i>
455</pre> 470</pre>
456 471
457<p> 472<p>
458If you want to use the binary package, even if the versions don't match, use 473If you want to use the binary package, even if the versions don't match, use
459<c>--usepkgonly</c> (<c>-K</c> in short). 474<c>--usepkgonly</c> (<c>-K</c> in short).
460</p> 475</p>
461 476
462<pre caption="Installing the prebuild package for gnumeric"> 477<pre caption="Installing the prebuilt package for gnumeric">
463# <i>emerge --usepkgonly gnumeric</i> 478# <i>emerge --usepkgonly gnumeric</i>
464</pre> 479</pre>
465 480
466<!-- TODO When handbook goes life, comment out this parts until the mirrors have
467 been updated with online GRP packages. -->
468<p> 481<p>
469If you don't have the prebuild package on your system yet, you can have 482If 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> 483<c>emerge</c> download it from a mirror, defined in the <c>PORTAGE_BINHOST</c>
471variable declared in <path>/etc/make.conf</path>. 484variable declared in <path>/etc/make.conf</path>.
472</p> 485</p>
473 486
474<p> 487<p>
475To download the binary package in case this package doesn't exist on 488To download the binary package in case this package doesn't exist on
476your system already, use <c>--getbinpkg</c> (<c>-g</c> in short): 489your system already, use <c>--getbinpkg</c> (<c>-g</c> in short):
477</p> 490</p>
478 491
479<pre caption="Downloading and installing a prebuild package for gnumeric"> 492<pre caption="Downloading and installing a prebuilt package for gnumeric">
480# <i>emerge --getbinpkg gnumeric</i> 493# <i>emerge --getbinpkg gnumeric</i>
481</pre> 494</pre>
482 495
483<p> 496<p>
484This will download the package and the package-related information for you and 497This 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 498install 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 499what dependencies will be installed with it, use the <c>--pretend</c> option
487(<c>-p</c> in short): 500(<c>-p</c> in short):
488</p> 501</p>
489 502
490<pre caption="Pretending to download the prebuild packages for gnumeric"> 503<pre caption="Pretending to download the prebuilt packages for gnumeric">
491# <i>emerge --ginbinpkg --pretend gnumeric</i> 504# <i>emerge --getbinpkg --pretend gnumeric</i>
492</pre> 505</pre>
493 506
494<p> 507<p>
495You can also opt to download the prebuild package (and the package-related 508You can also opt to download the prebuilt package (and the package-related
496information) <e>without</e> checking the information on your local system and 509information) <e>without</e> checking the information on your local system and
497<e>without</e> using the prebuild package already on your system (if 510<e>without</e> using the prebuilt package already on your system (if
498applicable), use the <c>--getbinpkgonly</c> option (<c>-G</c> in short): 511applicable), use the <c>--getbinpkgonly</c> option (<c>-G</c> in short):
499</p> 512</p>
500 513
501<pre caption="Installing a prebuild package without using local information"> 514<pre caption="Installing a prebuilt package without using local information">
502# <i>emerge --getbinpkgonly gnumeric</i> 515# <i>emerge --getbinpkgonly gnumeric</i>
503</pre> 516</pre>
504
505<!-- TODO Up until here -->
506 517
507<p> 518<p>
508You can also opt to install a specific version of a package. 519You can also opt to install a specific version of a package.
509For instance, if you want to install a gnumeric version older than 1.2 -- for 520For instance, if you want to install a gnumeric version older than 1.2 -- for
510any reason whatsoever :) you would type: 521any reason whatsoever :) you would type:
517<p> 528<p>
518Other possibilities are of course "&gt;" (later version) and "=" (the exact 529Other possibilities are of course "&gt;" (later version) and "=" (the exact
519version). 530version).
520</p> 531</p>
521 532
533
534</body>
535</subsection>
536<subsection>
537<title>Working with Dependencies</title>
538<body>
539
540<p>
541Portage has an extensive support for dependency handling. Although you usually
542don't need to even think about this (as dependencies are automatically handled
543by Portage) some users might want to know how you can work with <c>emerge</c>
544and dependencies.
545</p>
546
547<p>
548For instance, if you want Portage to pretend that none of the dependencies of a
549package are installed, you can use <c>--emptytree</c> (<c>-e</c> in short). This
550is useful with <c>--pretend</c> to display a complete tree of dependencies for
551any particular package. Without <c>--pretend</c>, <c>emerge</c> will (re)compile
552all listed packages. However, <c>glibc</c> will <e>not</e> be listed as
553dependency for safety reasons.
554</p>
555
556<pre caption="Show all dependencies of gnumeric">
557# <i>emerge --emptytree --pretend gnumeric</i>
558</pre>
559
560<p>
561Another argument is <c>--nodeps</c>, which will ask Portage to try install the
562given package without taking care of the dependencies. It is trivial that this
563can lead to failures.
564</p>
565
566<pre caption="Installing gnumeric without taking care of the dependencies">
567# <i>emerge --nodeps gnumeric</i>
568</pre>
569
570<p>
571The opposite of <c>--nodeps</c> is <c>--onlydeps</c>, which will have Portage
572install all dependencies of a given package, but not the package itself:
573</p>
574
575<pre caption="Installing the dependencies of gnumeric">
576# <i>emerge --onlydeps gnumeric</i>
577</pre>
522 578
523</body> 579</body>
524</subsection> 580</subsection>
525<subsection> 581<subsection>
526<title>Updating your System</title> 582<title>Updating your System</title>
589 </li> 645 </li>
590 <li> 646 <li>
591 <e>R</e> (reemerge) The package isn't new, but needs to be reemerged 647 <e>R</e> (reemerge) The package isn't new, but needs to be reemerged
592 </li> 648 </li>
593 <li> 649 <li>
594 <e>F</e> (fetch) The package requires that you download the sourcecode 650 <e>F</e> (fetch) The package requires that you download the source code
595 manually (for instance due to licencing issues) 651 manually (for instance due to licencing issues)
596 </li> 652 </li>
597 <li> 653 <li>
598 <e>U</e> (update) The package already exists on your system but will be 654 <e>U</e> (update) The package already exists on your system but will be
599 upgraded 655 upgraded
653Portage doesn't verify if a package is a dependency for another 709Portage doesn't verify if a package is a dependency for another
654installed package. It also doesn't warn you if the package is part of 710installed package. It also doesn't warn you if the package is part of
655<e>system</e>, i.e. a core application necessary for the correct functioning of 711<e>system</e>, i.e. a core application necessary for the correct functioning of
656your system! 712your system!
657</warn> 713</warn>
714
715<p>
716Once the unmerge begins you will see a long list of filenames belonging to the
717package. Some of these filenames will have a flag displayed to the
718left of the filename. The flags <c>!mtime</c>, <c>!empty</c>, and <c>cfgpro</c>
719specify reasons why certain files are not being removed while the package is.
720Files listed without any of these three flags are removed from the
721filesystem successfully. The three flags specify the following reasons:
722</p>
723
724<ul>
725 <li>
726 <c>!mtime</c> : The listed file has been changed since it was installed,
727 probably by you or some tool
728 </li>
729 <li>
730 <c>!empty</c> : The listed directory is not empty
731 </li>
732 <li>
733 <c>cfgpro</c> : This file is located inside a protected directory and will
734 not be touched for safety
735 </li>
736</ul>
658 737
659</body> 738</body>
660</subsection> 739</subsection>
661</section> 740</section>
662<section> 741<section>

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20