From 9a7e865139b6d1dbace2090895348f87cf2a582e Mon Sep 17 00:00:00 2001 From: Madhu Priya Murugan Date: Mon, 15 Nov 2021 20:24:06 +0100 Subject: Exclude binary cache build for live ebuilds This commit introduces a new value "buildpkg-live" for FEATURES, which is enabled by default (so the default behavior of building binary cache for all packages is retained). When it is disabled by calling emerge with FEATURES="-buildpkg-live", binary caches will not be built live ebuilds even if we specify --buildpkg. So that it is no longer necessary to pass a list of packages with live ebuilds to --buildpkg-exclude. Before this commit, when an emerge is called with the option '--buildpkg', a binary cache for the package is created under /var/cache/binpkgs. For example, when we do a, 'emerge --ask --verbose --buildpkg some-gitpkg/abc', a binary cache abc-1.1.1.tbz2 is created under /var/cache/binpkgs/some-gitpkg. With this commit, even if we explicitly use the options, '--buildpkg' for the packages with live ebuilds, no binary cache will be created (given we disable it calling emerge with FEATURES="-buildpkg-live"). Motivation: Since binary caches are created for all packages, including packages with live ebuilds, a separate list of (for eg.,) git packages needs to be maintained. And this is then passed to the options '--buildpkg-exclude' via, EMERGE_DEFAULT_OPTS. So the motivation behind this patch was to reduce redundancy, while we can simply disable binary cache for live ebuilds with this option. Closes: https://github.com/gentoo/portage/pull/766 Signed-off-by: Madhu Priya Murugan Signed-off-by: Zac Medico --- lib/_emerge/EbuildBuild.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'lib/_emerge') diff --git a/lib/_emerge/EbuildBuild.py b/lib/_emerge/EbuildBuild.py index 2ed16537b..6d290e116 100644 --- a/lib/_emerge/EbuildBuild.py +++ b/lib/_emerge/EbuildBuild.py @@ -343,9 +343,24 @@ class EbuildBuild(CompositeTask): and opts.buildpkg != "n" ) + # Do not build binary cache for packages from volatile sources. + # For volatile sources (eg., git), the PROPERTIES parameter in + # the ebuild is set to 'live'. + + # The default behavior is to build binary cache for all pkgs. + # "buildpkg-live" is a FEATURE that is enabled by default. + # To not build binary cache for live pkgs, we disable it by + # specifying FEATURES="-buildpkg-live" + + buildpkg_live = "buildpkg-live" in features + live_ebuild = "live" in self.settings.get("PROPERTIES", "").split() + buildpkg_live_disabled = live_ebuild and not buildpkg_live + if ( - "buildpkg" in features or self._issyspkg - ) and not self.opts.buildpkg_exclude.findAtomForPackage(pkg): + ("buildpkg" in features or self._issyspkg) + and not buildpkg_live_disabled + and not self.opts.buildpkg_exclude.findAtomForPackage(pkg) + ): self._buildpkg = True -- cgit v1.2.3-65-gdbad