gentoo portage

ref: http://wiki.gentoo.org/wiki/portage

Gentoo is Portage. Portage is Gentoo.

Getting portage settings right is vitally important. It's not the end of the world, if you don't. But you sure will expend a lot of your time staring at the matrix flowing past, as you compile everything yet again one more time.. just to get it right.

I'm learning the hard way.. Each time I learn what not to do, as opposed to other systems before. Thankfully, the folks at the gentoo forums have been very helpful each time. If not for them, the gentoo journey would probably not have been worthwhile.

Now that I understand a little bit more, I recompile the whole system, during the installation phase itself, right after I extract stage3 and set my environment. Only then do I install those packages required during/post installation.

Starting with a clean slate lessens any starting troubles. The foundation is probably the most important thing to building the rest of our skyscraper.

During installation, I tweak /etc/portage files to my requirements, and run the following command,
# emerge --e @system
# emerge -c

$ man emerge

--emptytree (-e)
Reinstalls target atoms and their entire deep dependency tree, as though no packages are currently installed. You should run this with --pretend first to make sure the result is what you expect.

--depclean (-c)
Cleans the system by removing packages that are not associated with explicitly merged packages. Depclean works by creating the full dependency tree from the @world set, then comparing it to installed packages. Packages installed, but not part of the dependency tree, will be uninstalled by depclean.
See --with-bdeps for behavior with respect to build time dependencies that are not strictly required.

--with-bdeps < y | n >
In dependency calculations, pull in build time dependencies that are not strictly required. This defaults to ´n´ for installation actions, meaning they will not be installed, and ´y´ for the --depclean action, meaning they will not be removed.

For reference, these are my portage files.

$ cat /etc/portage/make.conf
## http://wiki.gentoo.org/wiki/Distcc#With_Portage
## gcc -v -E -x c -march=native -mtune=native - < /dev/null 2>&1 | grep cc1 | perl -pe 's/ -mno-\S+//g; s/^.* - //g;'
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
CHOST="i686-pc-linux-gnu"
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3"

VIDEO_CARDS="i965"
INPUT_DEVICES="evdev synaptics"
#INPUT_DEVICES="libinput"
ALSA_CARDS="hda-intel"
LCD_DEVICES=""

LINGUAS="en_GB en"
L10N="en-GB en"
#PYTHON_SINGLE_TARGET="python2_7"
#PYTHON_TARGETS="python2_7"
RUBY_TARGETS="ruby22"
FFTOOLS=""

PORTDIR="/media/portage"
DISTDIR="/media/distfiles"
#PORTDIR="/usr/portage"
#DISTDIR=${PORTDIR}/distfiles
PKGDIR=${PORTDIR}/packages

#MAKEOPTS="-s -j4 -l2"
MAKEOPTS="--jobs=3 --load-average=2 --silent"
EMERGE_DEFAULT_OPTS="--alert --ask y --ask-enter-invalid --jobs=2 --keep-going y --load-average 2 --quiet n --tree --unordered-display --verbose y --verbose-conflicts --with-bdeps=y"
PORTAGE_NICENESS="19"
PORTAGE_IONICE_COMMAND="ionice -c2 -n7 -p\${PID}"
#PORTAGE_RSYNC_EXTRA_OPTS="--exclude-from=/etc/portage/rsync_excludes"

USE="acpi alsa btrfs drm evdev ffmpeg glamor gstreamer jpeg libnotify minimal opengl png startup-notification threads udev vaapi xcb -X -acl -accessibility -crypt -dbus -debug -deprecated -egl -fortran -gdbm -gnome -gtk3 -introspection -ipv6 -joystick -ncurses -nls -pulseaudio -systemd -xinerama -xv"

$ cat /etc/portage/package.mask
sys-apps/systemd
sys-fs/udev
dev-lang/python:3.4
dev-lang/python:3.5

$ /etc/portage/rsync_excludes
games-*/
sci-*/
dev-ruby/
dev-java/
dev-haskell/

$ cat /etc/portage/profile/use.mask
#-input_devices_libinput

I also replace the package.* directories with files of the same name. For eg,

# cd /etc/portage/
# mv -vi package.use{,.gentoo}
# cat package.use.gentoo/* >>package.use

The currently active USE flags, are the sum of all profiles.
# emerge --info | grep ^USE=

View all portage settings.
# emerge --info

Double check portage settings before starting compile, or it will be recompile everything all over again for each change. Nevertheless and frustratingly, this shall probably happen many times over ;-)
ref: http://wiki.gentoo.org/wiki/handbook:x86/Working/Portage#Updating_the_system

So, we have our settings right, and have rebooted into our gentoo. We probably should update our system.
# emerge --sync
# emerge --update --deep @world

The handbook recommends that we update the build dependencies (packages needed during compile/build process, but no longer required after install), once in a while. I try do this often.
# emerge --update --deep --with-bdeps=y @world

Portage needs to be told about changed useflags.
# emerge --update --deep --with-bdeps=y --newuse @world

Portage can remove orphaned dependencies, but only after a full update.
# emerge --update --deep --newuse @world
# emerge --depclean
# revdep-rebuild

That last command is from gentoolkit, not part of core gentoo. Another useful tool is eix. Install them like so.
# emerge --ask app-portage/{gentoolkit,eix}

And to remove packages safely:
# emerge --ask --depclean app-portage/eix

ref: http://wiki.gentoo.org/wiki/world_set_(Portage)
emerge -auvND world does not upgrade everything.
emerge -auvND --with-bdeps=yes world will attempt to upgrade build-time dependencies. run once a month or so.
emerge -e system maybe once or twice a year.

No comments:

Post a Comment

most viewed