commit: 9a7e865139b6d1dbace2090895348f87cf2a582e Author: Madhu Priya Murugan <madhu.murugan <AT> rohde-schwarz <DOT> com> AuthorDate: Mon Nov 15 19:24:06 2021 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Fri Nov 19 22:38:45 2021 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9a7e8651
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 <madhu.murugan <AT> rohde-schwarz.com> Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> cnf/make.globals | 2 +- lib/_emerge/EbuildBuild.py | 19 +++++++++++++++++-- lib/portage/const.py | 1 + man/make.conf.5 | 7 ++++++- 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/cnf/make.globals b/cnf/make.globals index b8bc90ae0..cf4ad3533 100644 --- a/cnf/make.globals +++ b/cnf/make.globals @@ -54,7 +54,7 @@ FETCHCOMMAND_SFTP="bash -c \"x=\\\${2#sftp://} ; host=\\\${x%%/*} ; port=\\\${ho # Default user options FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs - binpkg-multi-instance + binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox 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 diff --git a/lib/portage/const.py b/lib/portage/const.py index abe0ef6c6..1edc5fcf1 100644 --- a/lib/portage/const.py +++ b/lib/portage/const.py @@ -131,6 +131,7 @@ SUPPORTED_FEATURES = frozenset( "binpkg-logs", "binpkg-multi-instance", "buildpkg", + "buildpkg-live", "buildsyspkg", "candy", "case-insensitive-fs", diff --git a/man/make.conf.5 b/man/make.conf.5 index 43e70803f..868a2ca50 100644 --- a/man/make.conf.5 +++ b/man/make.conf.5 @@ -1,4 +1,4 @@ -.TH "MAKE.CONF" "5" "Jun 2021" "Portage VERSION" "Portage" +.TH "MAKE.CONF" "5" "Nov 2021" "Portage VERSION" "Portage" .SH "NAME" make.conf \- custom settings for Portage .SH "SYNOPSIS" @@ -323,6 +323,11 @@ Binary packages will be created for all packages that are merged. Also see \fBquickpkg\fR(1) and \fBemerge\fR(1) \fB\-\-buildpkg\fR and \fB\-\-buildpkgonly\fR options. .TP +.B buildpkg\-live +When this option is enabled (the default), \fBbuildpkg\fR will exhibit +the default behavior of building binary cache for all packages. When +it is disabled, binary packages will not be created for live ebuilds. +.TP .B buildsyspkg Build binary packages for just packages in the system set. .TP