gentoo 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
## 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"
CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3"

INPUT_DEVICES="evdev synaptics"

LINGUAS="en_GB en"
L10N="en-GB en"


#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_IONICE_COMMAND="ionice -c2 -n7 -p\${PID}"

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

$ /etc/portage/rsync_excludes

$ cat /etc/portage/profile/use.mask

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 ;-)

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

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