25
Package management and creation in Gentoo Linux Donnie Berkholz Council Member & Sr. Developer Gentoo Linux [email protected] @dberkholz

Package management and creation in Gentoo Linux

Embed Size (px)

DESCRIPTION

This talk is designed for developers and users of other Linux distributions to gain an understanding of the Gentoo approach and philosophy to package management. The goal isn't to get people using Gentoo but rather for attendees to walk away thinking about how they might be able to apply that to their own distributions or other projects. We'll cover how the package manager (Portage) works, what packages (ebuilds) look like, our focus on ease of use for package authors, how we've iterated on our package format over time, etc.

Citation preview

Page 1: Package management and creation in Gentoo Linux

Package management and creation in Gentoo Linux

Donnie BerkholzCouncil Member & Sr. Developer

Gentoo Linux

[email protected]

@dberkholz

Page 2: Package management and creation in Gentoo Linux

Me in Gentoo

The old me The new me

Blah, blah, blah..

Page 3: Package management and creation in Gentoo Linux

History

Page 4: Package management and creation in Gentoo Linux

Overview

Flickr: Liam Quinn

Page 5: Package management and creation in Gentoo Linux

Gentoo PM goals

• Beautiful and colorful despite CLI

• Fully automated software installation

• Extremely easy maintenance• Available in most architectures and OS's

Page 6: Package management and creation in Gentoo Linux

Gentoo PM goals(con't)

• Configuration file protection and automerge

• Advantages of compiling from source

• Multiple versions/implementations handling

• Binary package support

Page 7: Package management and creation in Gentoo Linux

Portage features

• Customization of CFLAGS, LDFLAGS• USE flags (more on that later)• Various optional FEATURES• Protection for live system• FEATURES sandbox, collision-protect, protect-owned

• Compilation acceleration• FEATURES ccache, distcc

• System trimming• FEATURES nodoc, noman, noinfo• INSTALL_MASK

Page 8: Package management and creation in Gentoo Linux

Portage features (con't)

• Parallelization support• --jobs=JOBS --load-average=LOAD• MAKEOPTS='-jN'• FEATURES parallel-fetch

• Auto resuming after failure• --keep-going

• Blocker automatic solving• com_err and ss V.S. e2fsprogs-libs

• Debugging support• CFLAGS "-g3 -ggdb3 -gdwarf-2"• FEATURES keepwork, nostrip, splitdebug, installsources

Page 9: Package management and creation in Gentoo Linux

Portage features (con't)

• Embedded system support• Features in portage 2.2• License filtering• Generic package sets• FEATURES preserve-libs

Page 10: Package management and creation in Gentoo Linux

Portage tree

• Gentoo's software repository• One of the largest• Branches• Overlays

Page 11: Package management and creation in Gentoo Linux

Ebuild file

• Defines variables and functions used to build/install software

• KEYWORDS• SLOT• DEPEND, RDEPEND, PDEPEND• LICENSE, SRC_URI• Functions - src_unpack(), src_compile(), src_install()

• Eclasses

Page 12: Package management and creation in Gentoo Linux

USE flags

• Map onto ./configure options• Defaults defined by profile• Define your own in addition to defaults

• Install only what you want• Example:• USE="-gnome kde qt -arts -nls"

Page 13: Package management and creation in Gentoo Linux

EAPI: Ebuild API

• EAPI 0: Forever...• EAPI 1: Nov 2007• EAPI 2: Sept 2008• EAPI 3: Jan 2010• EAPI 4: Jan 2011• EAPI 5: Sept 2012

Page 14: Package management and creation in Gentoo Linux

EAPI 0

• dev-libs/mpc/mpc-0.8.2.ebuild

Page 15: Package management and creation in Gentoo Linux

EAPI 1

• IUSE defaults• IUSE=+foo

• SLOT dependencies• DEPEND=dev-libs/foo:slotname

• dev-vcs/statcvs/statcvs-0.4.0-r1.ebuild

Page 16: Package management and creation in Gentoo Linux

EAPI 2

• SRC_URI arrows• http://bar/foo.tar → foo.tar.gz

• USE dependencies• DEPEND=dev-libs/foo[flag]

• [flag]• [-flag]• [flag=]• [?flag=]• [flag?]• [!flag?]

• sci-biology/arb/arb-5.1.ebuild

Page 17: Package management and creation in Gentoo Linux

EAPI 2

• Blocker syntax• !dev-libs/foo• !!dev-libs/foo

• Granular builds• src_configure() from compile• src_prepare() from unpack

• Defaults for phase functions• e.g. default_src_unpack()• Also default()

• x11-libs/cairo/cairo-1.8.10.ebuild

Page 18: Package management and creation in Gentoo Linux

EAPI 3

• Prefix support• Unpacking of .xz archives• media-gfx/graphviz/graphviz-2.26.3-r3.ebuild

Page 19: Package management and creation in Gentoo Linux

EAPI 4

• pkg_pretend()• src_install() not empty by default

• pkg_info() on uninstalled pkgs• USE dependency defaults• flag+ flag-• For flags not in IUSE

• nonfatal prefix for commands• PROPERTIES (=interactive)• dev-vcs/git/git-1.8.1.ebuild

Page 20: Package management and creation in Gentoo Linux

EAPI 4 (cont.)

• REQUIRED_USE: DEPEND for USE• flag1? (!flag2)• flag1? ( || ( flag2 flag3 ) )• ^^ ( flag1 flag2 )

• MERGE_TYPE=(source|binary|etc)• REPLACING_VERSIONS, REPLACED_BY_VERSION

• dev-db/mongodb/mongodb-2.2.2-r1.ebuild

• x11-libs/cairo/cairo-1.12.8.ebuild

Page 21: Package management and creation in Gentoo Linux

EAPI 5

• Sub-slots• Upgrade requires downstream package rebuilds

• SLOT=2/2.30

• Slot operator dependencies• DEPEND=dev-libs/foo:*• DEPEND=dev-libs/foo:=

• Profile IUSE injection• At-most-one-of USE groups• ?? ( flag1 flag2 )

• x11-wm/xmonad/xmonad-0.11.ebuild

Page 22: Package management and creation in Gentoo Linux

EAPI 5

• usex [true1] [false1] [true2] [false2]• true1, false1 default to yes, no

• (do|new)header• new* read from stdin• EBUILD_PHASE_FUNC• Current ebuild phase

• Stable USE masking/forcing

Page 23: Package management and creation in Gentoo Linux

EAPI 6?

bugs.gentoo.org/174380 Gentoo Hosted Projects → PMS/EAPI Summary: [Future EAPI] Blocks: future-eapi

Page 24: Package management and creation in Gentoo Linux

Package management and creation in Gentoo Linux

Donnie BerkholzCouncil Member & Sr. Developer

Gentoo Linux

[email protected]

@dberkholz

Page 25: Package management and creation in Gentoo Linux

<http://dev.gentoo.org/~dberkholz/IntroToGentoo.odp>

Copyright 2006–2013 Rajiv Manglani, Zhang Le, Donnie Berkholz. Some rights reserved.

The Gentoo Linux logo is Copyright 2002 Gentoo Foundation, used with permission.

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit <http://creativecommons.org/licenses/by-nc-sa/2.0> or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.