/[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.2 Revision 1.6
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.2 2003/11/25 17:34:47 swift Exp $ --> 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 $ -->
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> 13<p>
14We have briefly encountered <c>emerge</c> in the previous chapter, but not to 14The main Portage tool that most users will use is <c>emerge</c>. We have already
15the extent that you are now able to work with it to its fullest potential. We 15used it during the Gentoo installation and in the previous chapter, but we just
16will fix that right now ;-) 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.
17</p> 18</p>
18 19
19<p> 20<p>
20<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
21software 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
42<body> 43<body>
43 44
44<p> 45<p>
45Before we continue describing <c>emerge</c>, let us first take a look at the 46Before 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 47Portage Tree. Go to <path>/usr/portage</path> and do a listing of the available
47directories. 48directories. We use <c>ls --classify</c> to list the contents of a
49directory as it will show directories with a trailing "/".
48</p> 50</p>
49 51
50<pre caption="Viewing the Portage Tree"> 52<pre caption="Viewing the Portage Tree">
51# <i>cd /usr/portage; ls --classify</i> 53# <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-admin/ dev-ml/ gnome-libs/ net-print/
54app-arch/ dev-perl/ gnome-office/ net-wireless/ 55app-arch/ dev-perl/ gnome-office/ net-wireless/
55app-benchmarks/ dev-php/ header.txt net-www/ 56app-benchmarks/ dev-php/ header.txt net-www/
56app-cdr/ dev-python/ incoming/ net-zope/ 57app-cdr/ dev-python/ incoming/ net-zope/
57app-crypt/ dev-ruby/ jython/ packages/ 58app-crypt/ dev-ruby/ jython/ packages/
126<p> 127<p>
127The other files are the <path>ChangeLog</path> (which contains a listing of all 128The 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 129the changes done to the ebuilds), <path>Manifest</path> (which contains the
129checksums and permissions of all the files in the directory) and 130checksums and permissions of all the files in the directory) and
130<path>metadata.xml</path> (which contains more information about the package, 131<path>metadata.xml</path> (which contains more information about the package,
131such as the responsible development group -- called <e>herd</e> and a more 132such as the responsible development group -- called <e>herd</e> -- and a more
132extensive description). 133extensive description).
133</p> 134</p>
134 135
135<p> 136<p>
136Inside the <path>files</path> directory you will find extra files, needed by 137Inside the <path>files</path> directory you will find extra files, needed by
221the size of the downloaded files, the homepage and the small description. 222the size of the downloaded files, the homepage and the small description.
222</p> 223</p>
223 224
224<p> 225<p>
225You 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
226install a package, it ofcourse needs to have the necessary sources (or 227install a package, it of course needs to have the necessary sources (or
227precompiled packages) available. It therefor checks the contents of 228precompiled packages) available. It therefore checks the contents of
228<path>/usr/portage/distfiles</path> (for sourcecode) or 229<path>/usr/portage/distfiles</path> (for sourcecode) or
229<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
230necessary files are already available. If not, it downloads the necessary files 231necessary files are already available. If not, it downloads the necessary files
231and places them in those directories. 232and places them in those directories.
232</p> 233</p>
238Other Tools</uri>. 239Other Tools</uri>.
239</note> 240</note>
240 241
241</body> 242</body>
242</subsection> 243</subsection>
244<subsection>
245<title>Viewing the ChangeLog</title>
246<body>
247
248<p>
249While 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
251<c>--pretend --changelog</c> (<c>-pl</c> in short) options. As an example we
252will view the ChangeLog entries for <c>gnumeric</c>:
253</p>
254
255<pre caption="Viewing the ChangeLog entries for gnumeric">
256# <i>emerge --pretend --changelog gnumeric</i>
257</pre>
258
259</body>
260</subsection>
243</section> 261</section>
244<section> 262<section>
245<title>Updating Portage</title> 263<title>Updating Portage</title>
246<subsection> 264<subsection>
247<title>Introduction</title> 265<title>Introduction</title>
248<body> 266<body>
249 267
250<p> 268<p>
251Searching through Portage is nice, but if you don't update your Portage Tree 269Searching 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 270regularly, 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 271system. This means that your system will get outdated pretty soon and that
254packages with possible security problems will remain on your system. 272you will be missing bugfixes and remedies for possible security problems.
255</p> 273</p>
256 274
257<p> 275<p>
258There are several ways to update your Portage Tree. The most popular method is 276There 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>. 277by using one of our <uri link="/main/en/mirrors.xml">rsync mirrors</uri>.
318</subsection> 336</subsection>
319</section> 337</section>
320<section> 338<section>
321<title>Maintaining Software</title> 339<title>Maintaining Software</title>
322<subsection> 340<subsection>
323<title>Installing Software</title> 341<title>Building or Prebuild?</title>
324<body>
325
326</body> 342<body>
327</subsection> 343
344<p>
345Gentoo 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
347using a <e>prebuild</e> package. But what are the advantages/disadvantages of
348both approaches, and can they be used next to each other?
349</p>
350
351<p>
352As you probably have guessed, building packages takes a lot of time (especially
353if you have little resources or want to build big packages, such as <uri
354link="http://www.kde.org">KDE</uri>, <uri
355link="http://www.openoffice.org">OpenOffice.org</uri>, etc.). By building the
356package, you can use the <c>USE</c> setting to tweak the package to your system.
357Of course, you can also define high optimization options (in the <c>CFLAGS</c>
358and <c>CXXFLAGS</c> variables) to compile the package with.
359</p>
360
361<p>
362Using prebuild 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
364<c>CFLAGS</c> &amp; <c>CXXFLAGS</c> variables.
365</p>
366
367<p>
368As previously stated, prebuild packages are stored in the
369<path>/usr/portage/packages/All</path> directory, while the sourcecode of the
370packages are placed in <path>/usr/portage/distfiles</path>. If you have finished
371installing a package you can remove the package or sourcecode from the
372respective directory. However, you might want to keep the package/sourcecode of
373the latest version, just in case you want to reinstall the package (so you don't
374have to redownload it).
375</p>
376
377</body>
328<subsection> 378</subsection>
329<title>Updating Software</title> 379<subsection>
380<title>Installing Software from Sources</title>
381<body>
382
383<p>
384Okay, 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
386can 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
388<c>gnumeric</c>:
389</p>
390
391<pre caption="Building gnumeric">
392# <i>emerge gnumeric</i>
393</pre>
394
395<p>
396This will download the sourcecode for you and unpacks, compiles and installs the
397package on your system. It will also do the same for all the dependencies. If
398you want to see what dependencies will be installed with it, use the
399<c>--pretend</c> option (<c>-p</c> in short):
400</p>
401
402<pre caption="Pretending to build gnumeric">
403# <i>emerge --pretend gnumeric</i>
404</pre>
405
406<p>
407If you want to download the sourcecode of the package and its dependencies,
408but don't want to build the package, use the <c>--fetchonly</c> option
409(<c>-f</c> in short):
410</p>
411
412<pre caption="Fetching sources for gnumeric">
413# <i>emerge --fetchonly gnumeric</i>
414</pre>
415
416<p>
417If you want to see where <c>emerge</c> downloads the sources from, combine the
418<c>--fetchonly</c> and <c>--pretend</c> options:
419</p>
420
421<pre caption="Showing URLs of the sources for gnumeric">
422# <i>emerge --fetchonly --pretend gnumeric</i>
423</pre>
424
425<p>
426You can also opt to install a specific version of a package.
427For instance, if you want to install a gnumeric version older than 1.2 -- for
428any reason whatsoever :) you would type:
429</p>
430
431<pre caption="Installing a specific gnumeric version">
432# <i>emerge "&lt;gnumeric-1.2"</i>
433</pre>
434
435<p>
436Other possibilities are of course "&gt;" (later version) and "=" (the exact
437version).
438</p>
439
330<body> 440</body>
441</subsection>
442<subsection>
443<title>Installing Prebuild Packages</title>
444<body>
445
446<p>
447When you want to install a prebuild package, you should use the <c>--usepkg</c>
448option (<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
450the application you want to install match.
451</p>
452
453<pre caption="Installing a prebuild package for gnumeric">
454# <i>emerge --usepkg gnumeric</i>
455</pre>
456
457<p>
458If you want to use the binary package, even if the versions don't match, use
459<c>--usepkgonly</c> (<c>-K</c> in short).
460</p>
461
462<pre caption="Installing the prebuild package for gnumeric">
463# <i>emerge --usepkgonly gnumeric</i>
464</pre>
465
466<!-- TODO When handbook goes life, comment out this parts until the mirrors have
467 been updated with online GRP packages. -->
468<p>
469If you don't have the prebuild 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 prebuild 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 prebuild packages for gnumeric">
491# <i>emerge --ginbinpkg --pretend gnumeric</i>
492</pre>
493
494<p>
495You can also opt to download the prebuild package (and the package-related
496information) <e>without</e> checking the information on your local system and
497<e>without</e> using the prebuild 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 prebuild package without using local information">
502# <i>emerge --getbinpkgonly gnumeric</i>
503</pre>
504
505<!-- TODO Up until here -->
506
507<p>
508You 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
510any reason whatsoever :) you would type:
511</p>
512
513<pre caption="Installing a specific gnumeric version">
514# <i>emerge --usepkg "&lt;gnumeric-1.2"</i>
515</pre>
516
517<p>
518Other possibilities are of course "&gt;" (later version) and "=" (the exact
519version).
520</p>
521
522
523</body>
524</subsection>
525<subsection>
526<title>Updating your System</title>
527<body>
528
529<p>
530Portage knows two special tags to denote a set of software packages:
531<e>system</e> and <e>world</e>. You have already seen the former while
532installing Gentoo if you didn't use a <e>stage3</e> installation. To refresh
533things: <e>system</e> is the collection of <e>core</e> packages, necessary to
534have a working Gentoo system.
535</p>
536
537<p>
538The <e>world</e> tag consists of all software you have installed yourself on
539your system plus the <e>system</e> information. In other words, every time you
540emerge a package using <c>emerge &lt;package-name&gt;</c>, the
541<c>&lt;package-name&gt;</c> is registered in the <e>world</e> file
542(<path>/var/cache/edb/world</path>). Dependencies are <e>not</e> part of the
543<e>world</e> file, but we will get to that later.
544</p>
545
546<p>
547If you want to update the system packages, use the <c>--update</c> option
548(<c>-u</c> in short):
549</p>
550
551<pre caption="Updating the system packages">
552# <i>emerge --update system</i>
553</pre>
554
555<p>
556An identical approach can be used for the world packages:
557</p>
558
559<pre caption="Updating your entire system">
560# <i>emerge --update world</i>
561</pre>
562
563<p>
564Again, if you want to see what <c>emerge</c> wants to update, use the
565<c>--pretend</c> option together with the <c>--update</c> option:
566</p>
567
568<pre caption="Pretending to update your entire system">
569# <i>emerge --pretend --update world</i>
570<comment>(Some output removed to improve readability)</comment>
571[ebuild U ] net-misc/wget-1.9-r1 [1.9]
572[ebuild UD] media-video/dvdauthor-0.5.0 [0.5.3]
573[ebuild U ] net-analyzer/ethereal-0.9.16 [0.9.14]
574</pre>
575
576<p>
577Right next to the word "ebuild" you will notice a letter (or combination of
578letters) which gives you more information about the package:
579</p>
580
581<ul>
582 <li>
583 <e>B</e> (blocks) The package listed to the left is blocking the emerge of
584 the package listed to the right
585 </li>
586 <li>
587 <e>N</e> (new) The package is new to your system and will be emerged for the
588 first time
589 </li>
590 <li>
591 <e>R</e> (reemerge) The package isn't new, but needs to be reemerged
592 </li>
593 <li>
594 <e>F</e> (fetch) The package requires that you download the sourcecode
595 manually (for instance due to licencing issues)
596 </li>
597 <li>
598 <e>U</e> (update) The package already exists on your system but will be
599 upgraded
600 </li>
601 <li>
602 <e>UD</e> (downgrade) The package already exists on your system but will be
603 downgraded
604 </li>
605 <li>
606 <e>U-</e> (slot warning) The package you have installed on your system
607 is listed as a package that can not coexist with a different version, but
608 your update does. The update will be installed and the older version will be
609 removed.
610 </li>
611</ul>
612
613<p>
614In certain cases, an update may mean a downgrade (i.e. install an older version
615instead of a newer version). If you don't want this to happen, use the
616<c>--upgradeonly</c> option (<c>-U</c> in short):
617</p>
618
619<pre caption="Upgrading your entire system">
620# <i>emerge --update --upgradeonly world</i>
621</pre>
622
623<p>
624Of course, we are talking here about <e>system</e> and <e>world</e>, but you can
625perform the same actions for individual software packages.
626</p>
331 627
332</body> 628</body>
333</subsection> 629</subsection>
334<subsection> 630<subsection>
335<title>Removing Software</title> 631<title>Removing Software</title>
336<body> 632<body>
633
634<p>
635If you want to remove software from your system, you can use the <c>unmerge</c>
636option (<c>-C</c> - capital C - in short):
637</p>
638
639<pre caption="Uninstalling software">
640# <i>emerge unmerge gnumeric</i>
641</pre>
642
643<p>
644If you want to test a removal (but not perform it), you can use <c>--pretend</c>
645again:
646</p>
647
648<pre caption="Pretending to uninstall software">
649# <i>emerge --pretend unmerge gnumeric</i>
650</pre>
651
652<warn>
653Portage 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
655<e>system</e>, i.e. a core application necessary for the correct functioning of
656your system!
657</warn>
337 658
338</body> 659</body>
339</subsection> 660</subsection>
340</section> 661</section>
341<section> 662<section>
342<title>Software Availability</title> 663<title>Software Availability</title>
343<subsection> 664<subsection>
344<title>ARCH or not?</title> 665<title>ARCH or not?</title>
345<body> 666<body>
346 667
668<p>
669Gentoo places its packages in two possible stadia called <e>ARCH</e> and
670<e>~ARCH</e>. Don't take this literally: the stadia depend on the architecture
671you are using. In other words, for x86-based systems you have <e>x86</e> and
672<e>~x86</e>, for ppc-based systems you have <e>ppc</e> and <e>~ppc</e> etc.
673</p>
674
675<p>
676The <e>~ARCH</e> stadium means that the package works for the developer in
677charge of the package, but that the package hasn't been tested thoroughly enough
678by the community to be placed in <e>ARCH</e>. <e>~ARCH</e> packages usually go
679to <e>ARCH</e> after being bugfree for a sufficient amount of time.
680</p>
681
682<p>
683Your system will use <e>ARCH</e> packages per default. If you want to live on
684the edge, don't mind having a broken package once in a while, and you like
685submitting bugreports to <uri
686link="http://bugs.gentoo.org">bugs.gentoo.org</uri>, then you can opt to use
687<e>~ARCH</e> packages. To "move" your system to a <e>~ARCH</e>-using system,
688edit the <c>ACCEPT_KEYWORDS</c> variable in <path>/etc/make.conf</path> so that
689it reads <e>~ARCH</e> (again: for x86-based systems: <e>~x86</e>, etc.).
690</p>
691
692<p>
693If you want to update your system now, you will notice that <e>a lot</e> of
694packages will be updated!
695</p>
696
347</body> 697</body>
348</subsection> 698</subsection>
349<subsection> 699<subsection>
350<title>Masked Packages</title> 700<title>Masked Packages</title>
351<body> 701<body>
352 702
703<p>
704When you want to install a package, you might come across the following message:
705</p>
706
707<pre caption="Message about masked packages">
708Calculating dependencies
709!!! <comment>all ebuilds that could satisfy </comment>&lt;your package&gt;<comment> have been masked.</comment>
710</pre>
711
712<p>
713A package can be masked due to two reasons:
714</p>
715
716<ol>
717 <li>The package is in <e>~ARCH</e> while you use <e>ARCH</e></li>
718 <li>The package is hard-masked explicitly</li>
719</ol>
720
721<p>
722If the package is masked because of the first reason, and you <e>really</e> want
723to install it (knowing that there <e>is</e> a reason why it isn't available in
724<e>ARCH</e>), you can temporarily accept <e>~ARCH</e> packages:
725</p>
726
727<pre caption="Temporarily accepting ~ARCH packages">
728# <i>ACCEPT_KEYWORDS="~x86" emerge gnumeric</i>
729</pre>
730
731<p>
732A package is hardmasked if it is listed in
733<path>/usr/portage/profiles/package.mask</path>. If you read this file, you
734will also read the reason why the package is hardmasked (it is usually added as
735a comment). If you want to install the package nevertheless (despite all the
736possible warnings we could ever throw at your head about "breaking your system",
737"breaks other packages", or "badly needs testing"), create the
738<path>/etc/portage/package.unmask</path> file and list the package in it (use
739the same format as is used in <path>/usr/portage/profiles/package.mask</path>).
740</p>
741
742<p>
743Do <e>not</e> alter the <path>/usr/portage/profiles/package.mask</path> file as
744all changes are undone the next time you update your Portage tree.
745</p>
746
747<p>
748Another trick to circumvent the "masked package" problem is to install the
749package using the full path. This will ignore both the <c>ACCEPT_KEYWORD</c>
750settings and the <path>package.mask</path> listing.
751</p>
752
753<pre caption="Installing a package without checking for stadium / masking">
754# <i>emerge /usr/portage/app-office/gnumeric/gnumeric-1.2.0.ebuild</i>
755</pre>
756
353</body> 757</body>
354</subsection> 758</subsection>
355<subsection> 759<subsection>
356<title>Blocked Packages</title> 760<title>Blocked Packages</title>
357<body> 761<body>
762
763<p>
764You have a situation when you receive the following error on your screen:
765</p>
766
767<pre caption="Blocking package">
768[blocks B ] gnome-base/bonobo-activation (from pkg gnome-base/libbonobo-2.4.0)
769</pre>
770
771<p>
772In the above example, the package <c>bonobo-activation</c> is blocking the
773emerge of <c>libbonobo</c>. To resolve this issue, remove the
774<c>bonobo-activation</c> package and continue:
775</p>
776
777<pre caption="Resolving a blocking situation">
778# <i>emerge unmerge bonobo-activation</i>
779</pre>
358 780
359</body> 781</body>
360</subsection> 782</subsection>
361</section> 783</section>
362</sections> 784</sections>

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

  ViewVC Help
Powered by ViewVC 1.1.20