The Portage Package Manager

Discussion in 'Installation' started by DevynCJohnson, Feb 9, 2014.

?

Do you think the Ebuild and overlay systems can be improved?

  1. Yes

    75.0%
  2. No

    0 vote(s)
    0.0%
  3. Maybe

    25.0%
  1. DevynCJohnson

    DevynCJohnson Well-Known Member Staff Member Staff Writer

    Messages:
    1,345
    Likes Received:
    1,083
    Trophy Points:
    113
    Among GNU/Linux distros, there are many types of package managers. Gentoo uses one called Portage. Portage uses a ports-like system as seen in FreeBSD. Portage shares a lot in common with Arch's Pacman package management system. Portage is used in Gentoo and Chromium OS as well as the BSD system Gentoo/FreeBSD. Like other package management systems, it is important to understand how Portage works.

    Portage is made up of two parts - ebuild and emerge. Ebuilds are scripts that compile and install the software packages. Ebuilds provide all the needed info for obtaining, patching, compiling, etc. the desired packages. Emerge manages repositories and dependencies and acts as an Portage interface. This means the command used to manage software via command-line is "emerge" just as "apt-get" is used to manage packages on Debian-based systems. Some GUIs exist for emerge such as Porthole and Himerge.

    NOTE: The software packages in Portage systems is usually just source code. However, some compiled files exist. Either way, Portage is still a good package management system.

    In the Portage system, the main repository is called the "Portage Tree" or a "Package Tree". Additional repositories (like a PPA in Ubuntu) are referred to as "overlays". Three types of repositories exist - stable, keyword masked, and hardmasked. The stable overlays contain well tested and stable software. The keyword-masked portage trees hold packages that are not or may not be stable or well tested. Lastly, the hardmasked-repos store software with known issues.

    ports_hardmasked.png

    When software is being installed from the ports, the ebuild file for the desired software is read. The ebuild files contain information about the software, the weblink to the source code, build info, etc. The source code is downloaded and compiled in /var/tmp/portage/ (this is easy; no worries). This directory is deleted after the installation process is complete. Portage also supports binary software that does not require compilation. Such a file has the "tbz2" file extension. The ebuild files are stored in /usr/portage/ and the package trees added by the user are stored in /usr/local/portage/. To add overlays, place the ebuilds in this directory. A sample ebuild can be seen here http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-lang/ruby/ruby-2.1.0.ebuild?view=markup. This site hosts ebuilds – http://packages.gentoo.org/.

    The global Portage build settings are in the /etc/portage/make.conf script. This script creates some default settings and variables for compiling the software for the system.


    To install software via Portage, use this command - "emerge PACKAGE". Software is removed using "emerge --unmerge PACKAGE". To remove unneeded dependencies, try this tool. If a programmer wants the source code for a particular application, then the source code can be downloaded through the ports - “emerge --fetchonly PACKAGE”. To refresh the overlays, type "emerge --sync" in a command-line. This allows users to see new software and updates. The repos can also be searched. This allows users to find "office" applications, they can type "emerge --search office". The command searches packages whose name contains "office", so this should find Libre-Office, Open-Office, and others. To find software whose related to "office", then type - "emerge --searchdesc office".

    To update the applications on the system, try this command "emerge --update --ask @world". The "--ask" parameter produces a list of software Portage will update, but the user will be asked first. This behavior is commonly seen in Debian's apt-get command. To do a full update and update the dependencies and apply security updates, use this command - "emerge --update --deep --with-bdeps=y @world".


    Now for a debate. Do you think the Ebuild and overlay systems can be improved? I think so. Mainly, I think the Ebuild system can be improved if adding an overlay were as easy as adding a PPA on Debian-like distros. Any thoughts on that?

    Links to other package manager topics -

    http://www.linux.org/threads/debian-package-management-apt-deb-and-friends.5410/
    http://www.linux.org/threads/rpm-commands-and-management.5338/

    Attached Files:

    • slide.jpg
      slide.jpg
      File size:
      36.2 KB
      Views:
      108,135
    Last edited: Aug 9, 2014

Share This Page