Skip to content

Latest commit

 

History

History
159 lines (115 loc) · 4.94 KB

File metadata and controls

159 lines (115 loc) · 4.94 KB

Installing with Gentoo

Home: Software management

Note: Gentoo is more of an advanced topic. Most of the times, you will install software with EasyBuild.

Note: You must always first module load StdEnv/2023 before using Gentoo commands.

The following contain basic commands that you may need for using Gentoo Prefix for the CC central stack. For a much more detailed Gentoo guide, see a basic guide to write Gentoo Ebuilds. See also the Gentoo Cheat Sheet.

Contents

Searching for packages in Gentoo

You can search for packages (existing, installed or not) using this command:

emerge -s [package name]

E.g.:

emerge -s ".*readline.*"

The list of all installed Gentoo-packages can be viewed with:

equery list "*"

Installing a package in Gentoo

Existing recipes

If a package already has an existing recipe, you can install it easily using the following command:

sudo -i -u gentoouser bwrap --dev-bind / / --bind /cvmfs_ceph/soft.computecanada.ca/gentoo /cvmfs/soft.computecanada.ca/gentoo emerge <package name> [--pretend]

This will sometimes ask you to make modifications to configuration files, but generate temporary files first. You then make the modifications using

sudo -i -u gentoouser bwrap --dev-bind / / --bind /cvmfs_ceph/soft.computecanada.ca/gentoo /cvmfs/soft.computecanada.ca/gentoo etc-update

You can use emerge --pretend without sudo and bwrap as well, as it will only do a dry run. This will install the stable version: if the stable version is too old for some reason you need to unmask the "testing" version by adding it to $EPREFIX/etc/portage/package.accept_keywords, e.g. app-misc/tmux ~amd64 unmasked tmux-3.1b.

The ebuilds themselves can be found under $EPREFIX/var/db/repos/gentoo/ (upstream, frozen) and $EPREFIX/var/db/repos/computecanada (ours, updated via sudo -iu gentoouser emerge --sync from the relevant (year, e.g. 2023) branch of CC overlay.

Creating a new recipe

If a package does not exist, you can create a new recipe. Before creating a new recipe, however, you should ask yourself if the package should be installed in Gentoo or in EasyBuild. Often, packages not available in Gentoo will be available in EasyBuild.

To add a new package to Gentoo you will first need to create the package. As an example, we created this one for opa-psm2 (OmniPath libraries): https://github.com/ComputeCanada/gentoo-overlay/blob/2020/sys-fabric/opa-psm2/opa-psm2-11.2.86.ebuild. This file is as follows:

EAPI=7

inherit udev

DESCRIPTION="OpenIB userspace driver for the PathScale InfiniBand HCAs"
SRC_URI="https://github.com/intel/${PN}/archive/PSM2_${PV}.tar.gz -> {P}.tar.gz"

SLOT="0"
KEYWORDS="amd64 ~x86 ~amd64-linux"
IUSE=""

DEPEND="virtual/pkgconfig"
RDEPEND="${DEPEND}
	sys-apps/util-linux
	sys-process/numactl
	virtual/udev"

S="${WORKDIR}/${PN}-PSM2_${PV}"

src_compile() {
	emake arch=x86_64 USE_PSM_UUID=1 WERROR=
}

src_install() {
	emake arch=x86_64 UDEVDIR="/lib/udev" DESTDIR="${D}/${EPREFIX}" install
	dodoc README
}

To enable this we clone or update the Compute Canada gentoo-overlay on GitHub:

cd gentoo-overlay
git pull

The opa-psm2 package can then be test-built using this syntax:

mkdir -p ~/.local/gentoo
rm -rf ~/.local/gentoo/*
PORTAGE_USERNAME=$USER PORTAGE_GRPNAME=$USER PORTAGE_TMPDIR=$HOME/.local/gentoo ebuild opa-psm2-11.2.86.ebuild manifest # in the same directory as the ebuild
PORTAGE_USERNAME=$USER PORTAGE_GRPNAME=$USER PORTAGE_TMPDIR=$HOME/.local/gentoo ebuild opa-psm2-11.2.86.ebuild install

(This command builds and installs under ~/.local/gentoo.)

Once this is done, you should add your new recipe to our repository, using the following:

cd gentoo-overlay/sys-fabric/opa-psm2
git add Manifest opa-psm2-11.2.86.ebuild

# (if not already done so, set name/email)
git config --global user.name “John Doe”
git config --global user.email johndoe@example.com
git pull
git commit
git push

The final step is to install globally; the first command syncs the channel from github:

sudo -u gentoouser -i bwrap --dev-bind / / --bind /cvmfs_ceph/soft.computecanada.ca/gentoo /cvmfs/soft.computecanada.ca/gentoo emerge --sync
sudo -u gentoouser -i bwrap --dev-bind / / --bind /cvmfs_ceph/soft.computecanada.ca/gentoo /cvmfs/soft.computecanada.ca/gentoo emerge sys-fabric/opa-psm2

You will then need to sync to cvmfs, and only when it is pushed to dev it will be generally visible on Archimedes.

In general it is best to work by example. There are thousands of ebuilds under $EPREFIX/var/db/repos.