Table of Content

This is a two-parts article. There are few sections here.

Part One
  • Preface: Test Bed
  • Getting Started With Docker
  • Package Management: Portage Frontend, Get Help
  • Updating System: OS Release, webrsync, Update, Manually, More
  • Package IRSI: Install, Confirmation, Ambiguous, Download, Removal, Query Search, Show Info
  • What's Next
Part Two
  • Dependency: Dependency, Reverse Dependency, Pretend, Verify
  • Group: Metapackages, Sets
  • System Wide: emerge, revdep-rebuild, Upgradables, Installed, Recent, Obsolete
  • Package: Building Package, Extract
  • History: The Log File
  • Clean Up
  • What's Next
Part Three
  • Interesting Tools: Equery, Layman, Eix
  • Repository: Adding, Configuration, List Overlays, Removal, Synchronize, List Packages
  • Mirror: Install, Select Mirror, Configuration, Test
  • Hold Package: Example, Before Mask, Configuration, After Mask
  • Conclusion

Preface

Goal: Examine Package Manager, Focus on Command Line Interface

I am so glad that finally I can learn Gentoo Portage using Docker.

Test Bed

  1. Container: Docker

  2. Operating System: Artix (OpenRC )

  3. Window Manager: Herbstluftwm

Since we are going to use docker again, you can read a common overview here.

Of course you can use virtualization, the issue is distraction. We need to avoid tendency to focus on GUI tools. At the same time, limiting the scope to CLI tools. Most of the time, CLI tools is considered lower level than the GUI one.


Getting Started With Docker

Our first move is, of course attach docker process, as usual.

$ docker pull gentoo/stage3-amd64
$ docker image list 

  --format 'table {{.Repository}}\t{{.Size}}'

REPOSITORY              SIZE
gentoo/stage3-amd64     873MB
vbatts/slackware        86.7MB
voidlinux/voidlinux     202MB
kevinleptons/lfs-auto   753MB
docker run -it gentoo/stage3-amd64
ca9efc06241d / # exit
$ docker ps -a 

  --format 'table {{.Image}}\t{{.Names}}\t{{.Status}}'

IMAGE                 NAMES               STATUS
gentoo/stage3-amd64   amazing_shirley     Exited (0) 24 seconds ago
vbatts/slackware      cranky_keller       Exited (0) 37 minutes ago
$ docker start amazing_shirley
amazing_shirley
$ docker attach amazing_shirley
ca9efc06241d / #

Docker Gentoo: Getting Started


Package Management

Gentoo use Portage to manage their packages.

Portage Frontend

Emerge

Get Help

Read the fine manual instead.

$ man emerge

Updating System

First Thing First

First thing to do in my mind is updating my system.

OS Release

$ cat /etc/gentoo-release 
Gentoo Base System release 2.3

webrsync

ca9efc06241d / # emerge-webrsync
Fetching most recent snapshot ...
 * Latest snapshot date: 20170814
 * 
 * Approximate snapshot timestamp: 1502757900
 *        Current local timestamp: 1502757301
 * 
 * The current local timestamp is possibly identical to the
 * timestamp of the latest snapshot. In order to force sync, use
 * the --revert option or remove the timestamp file located at
 * '/usr/portage/metadata/timestamp.x'.

Docker Gentoo: emerge-webrsync

Update Packages

You can use emerge -u command.

ca9efc06241d / # emerge -u system
Calculating dependencies... done!
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.
ca9efc06241d / # emerge -u world
Calculating dependencies... done!
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.
ca9efc06241d / # eselect news read
No news is good news.

Docker Gentoo: emerge --update

Updating System Manually

As a beginner, I always curious how things works.

Consider a fresh clean gentoo container.

$ emerge
!!! Section 'gentoo' in repos.conf has location attribute set to nonexistent directory: '/usr/portage'
!!! Section 'x-portage' in repos.conf has location attribute set to nonexistent directory: '/usr/portage'
!!! Invalid Repository Location (not a dir): '/usr/portage'


!!! /etc/portage/make.profile is not a symlink and will probably prevent most merges.
!!! It should point into a profile within /usr/portage/profiles/
!!! (You can safely ignore this message when syncing. It's harmless.)


!!! Your current profile is invalid. If you have just changed your profile
!!! configuration, you should revert back to the previous configuration.
!!! Allowed actions are limited to --help, --info, --search, --sync, and
!!! --version.

You can manually populate portage tree. It is about only 70 megabytes download.

$ cd /usr/
$ wget -c http://distfiles.gentoo.org/snapshots/portage-latest.tar.xz
$ tar -xvf portage-latest.tar.xz
$ rm portage-latest.tar.xz

Updating More

There are other command such as emerge --sync Read the fine manual instead.


Package IRSIF

Install, Remove, Search, Info, File

Read the fine manual.

Package Install

What good is it life without our favorites packages ? Consider install it at the first place after system update.

Merge
$ emerge htop fish ncdu

With emerge command, these packages will be compiled, built and installed. emerge has a very nice looks, many colors while building package.

Docker Emerge: Install Package

Ask for Confirmation

Ask
$ emerge -a htop fish ncdu

Docker Emerge: Install

Ambiguous Package

How about this ?

$ emerge mc

Docker Emerge: ebuild name is ambiguous

Use fully qualified ebuild name instead.

$ emerge app-misc/mc 

Download

You can download package and install later on.

$ emerge -a --fetchonly curl

These are the packages that would be fetched, in order:

Calculating dependencies... done!
[ebuild     U  ] net-misc/curl-7.55.1 [7.55.0]

Would you like to fetch the source files for these packages? [Yes/No] y

>>> Fetching (1 of 1) net-misc/curl-7.55.1::gentoo
>>> Downloading 'rsync://ftp.jaist.ac.jp/pub/Linux/Gentoo/distfiles/curl-7.55.1.tar.bz2'
...
receiving incremental file list
curl-7.55.1.tar.bz2
      2,786,830 100%  157.30kB/s    0:00:17 (xfr#1, to-chk=0/1)

sent 43 bytes  received 2,787,617 bytes  50,228.11 bytes/sec
total size is 2,786,830  speedup is 1.00
 * curl-7.55.1.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ...  [ ok ]

Docker Emerge: Fetch Only

Now you can continue to install.

$ emerge -a curl

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild     U  ] net-misc/curl-7.55.1 [7.55.0]

Would you like to merge these packages? [Yes/No] y

>>> Verifying ebuild manifests

>>> Emerging (1 of 1) net-misc/curl-7.55.1::gentoo
...

Only Dependencies

Just any other build system, we can prepare dependency first, before build our package.

$ emerge --onlydeps herbstluftwm
Calculating dependencies... done!

>>> Verifying ebuild manifests

>>> Emerging (1 of 16) dev-libs/libbsd-0.8.3::gentoo
 * libbsd-0.8.3.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ...  [ ok ]
>>> Unpacking source...
>>> Unpacking libbsd-0.8.3.tar.xz to /var/tmp/portage/dev-libs/libbsd-0.8.3/work
>>> Source unpacked in /var/tmp/portage/dev-libs/libbsd-0.8.3/work
>>> Preparing source in /var/tmp/portage/dev-libs/libbsd-0.8.3/work/libbsd-0.8.3 ...
>>> Source prepared.
...

Docker Emerge: onlydeps

If you need a more verbose message, all you need is --ask.

$ emerge --ask --onlydeps herbstluftwm

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] dev-libs/libbsd-0.8.3  USE="-static-libs" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] x11-proto/xproto-7.0.31  USE="-doc" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] x11-proto/xextproto-7.3.0  USE="-doc" ABI_X86="(64) -32 (-x32)" 
[ebuild  N     ] media-fonts/font-util-1.3.1 
[ebuild  N     ] x11-misc/util-macros-1.19.1 
[ebuild  N     ] x11-libs/xtrans-1.3.5  USE="-doc" 
[ebuild  N     ] x11-proto/xf86bigfontproto-1.2.0-r1  ABI_X86="(64) -32 (-x32)" 

Docker Emerge: onlydeps-ask

Package Removal

Depclean
$ emerge -c htop
Unmerge
$ emerge -C htop

Docker Emerge: Remove

Search
$ emerge -s htop
Search Description
$ emerge -S htop

Docker Emerge: Search

Package Show Info

$ emerge -pv htop
$ emerge -S htop

Change Log

$ equery changes ncdu
*ncdu-1.12 (29 Aug 2016)

  29 Aug 2016; Jeroen Roovers <jer@gentoo.org> +ncdu-1.12.ebuild:
  Version bump.

  Package-Manager: portage-2.3.0

  29 Aug 2016; Jeroen Roovers <jer@gentoo.org>
  -files/ncdu-1.9-pkgconfig.patch:
  Drop obsolete patch.

  Package-Manager: portage-2.3.0

Docker Gentoo: equery changes

All change log.

$ equery changes -f ncdu

Check

Verification

$ equery check ncdu
* Checking sys-fs/ncdu-1.12 ...
   11 out of 11 files passed

Docker Gentoo: equery check

Check for Possible Issue

$ repoman ncdu

Package File List

Listing package files can be achieved using equery files.

$ equery files ncdu
 * Searching for ncdu ...
 * Contents of sys-fs/ncdu-1.12:
/usr
/usr/bin
/usr/bin/ncdu
/usr/share
/usr/share/doc
/usr/share/doc/ncdu-1.12
/usr/share/doc/ncdu-1.12/ChangeLog.bz2
/usr/share/doc/ncdu-1.12/README.bz2
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/ncdu.1.bz2

Docker Gentoo: equery files

Searching file owner

$ equery belongs /etc/man.conf 
 * Searching for /etc/man.conf ... 
sys-apps/man-1.6g (/etc/man.conf)

Docker Gentoo: equery belong


What’s Next

No comment yet. I know nothing. Consider finish reading [ Part Two ].


Thank you for reading