masking a package in gentoo overlay
It’s a post on how to selectively mask an ebuild in the overlay. The
running example will be a package app-misc/foo using systemd
(systemd is masked in selinux profiles).
Here is how our ebuild looks like:
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
DESCRIPTION="An example package with a depend masked in selinux profiles."
HOMEPAGE="https://trofi.github.io/"
KEYWORDS="~amd64 ~x86 ~ppc ~ppc64"
LICENSE="public-domain"
SLOT="0"
# systemd is masked on selinux profiles
DEPEND="sys-apps/systemd"
RDEPEND=${DEPEND}The problem with it is that it’s not usable on selinux profiles due to
systemd mask:
overlay-selective-mask-in-gentoo/app-misc $ repoman full
RepoMan scours the neighborhood...
dependency.bad [fatal] 3
app-misc/foo/foo-0.ebuild: DEPEND: ~amd64(hardened/linux/amd64/no-multilib/selinux)
['sys-apps/systemd']
app-misc/foo/foo-0.ebuild: DEPEND: ~amd64(hardened/linux/amd64/selinux)
['sys-apps/systemd']
app-misc/foo/foo-0.ebuild: DEPEND: ~x86(hardened/linux/x86/selinux)
['sys-apps/systemd']
Thus our goal is to mask this package on selinux profiles. Unfortunately
it requires quite a few steps to do it:
Add
profiles/profiles.descfile and populate it with all profiles we want to override.repomanalready shows us3profiles we need to override.We need to create
profiles/profiles.descfile with the following contents:amd64 hardened/linux/amd64/selinux stable amd64 hardened/linux/amd64/no-multilib/selinux stable x86 hardened/linux/x86/selinux stableCreate
package.maskwhich we will use for our overrides.I’ve added our mask to new
profiles/features/selinux/package.maskfile:# Sergei Trofimovich <slyfox@gentoo.org> (24 Jun 2016) # requires systemd (masked on selinux) app-misc/fooCreate profile overrides for each profile.
Let’s look in detail on
hardened/linux/x86/selinuxprofile. It’s override requires a single file.Let’s create
profiles/hardened/linux/x86/selinux/parentwith the following contents:gentoo:hardened/linux/x86/selinux :features/selinuxHere
gentoo:hardened/linux/x86/selinuxrefers to parent profile and:features/selinuxrefers to our tiny mix in with singlepackage.mask.Enable
portage-2extension tometadata/layout.conf.Unfortunately
[repo]:<absolute-path>is not defined inPMSand is not portable across all Gentoo package managers.To enable it for portage we need to add the following in
metadata/layout.conf:profile-formats = portage-2
Done!
Now repoman is happy:
overlay-selective-mask-in-gentoo/app-misc $ repoman full
RepoMan scours the neighborhood...
Note: use --without-mask to check KEYWORDS on dependencies of masked packages
Note: use --include-dev (-d) to check dependencies for 'dev' profiles
RepoMan sez: "If everyone were like you, I'd be out of business!"
Full example repository is available at: https://github.com/trofi/overlay-selective-mask-in-gentoo