Skip to content

Commit

Permalink
Merge pull request #2192 from flatcar/krnowak/eclass-automation
Browse files Browse the repository at this point in the history
Add more eclasses to package automation
  • Loading branch information
krnowak authored Aug 8, 2024
2 parents 008947c + 2bdd63e commit 918e66d
Show file tree
Hide file tree
Showing 22 changed files with 746 additions and 420 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/portage-stable-packages-list
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,11 @@ eclass/app-alternatives.eclass
eclass/autotools.eclass
eclass/bash-completion-r1.eclass
eclass/cargo.eclass
eclass/check-reqs.eclass
eclass/cmake-multilib.eclass
eclass/cmake.eclass
eclass/crossdev.eclass
eclass/db-use.eclass
eclass/desktop.eclass
eclass/dist-kernel-utils.eclass
eclass/distutils-r1.eclass
Expand All @@ -382,19 +385,30 @@ eclass/fcaps.eclass
eclass/flag-o-matic.eclass
eclass/git-r3.eclass
eclass/gnome.org.eclass
eclass/gnome2-utils.eclass
eclass/gnuconfig.eclass
eclass/go-env.eclass
eclass/go-module.eclass
eclass/golang-base.eclass
eclass/golang-vcs-snapshot.eclass
eclass/golang-vcs.eclass
eclass/java-pkg-opt-2.eclass
eclass/java-utils-2.eclass
eclass/kernel-2.eclass
eclass/libtool.eclass
eclass/linux-info.eclass
eclass/linux-mod-r1.eclass
eclass/linux-mod.eclass
eclass/llvm-r1.eclass
eclass/llvm-utils.eclass
eclass/llvm.eclass
eclass/ltprune.eclass
eclass/lua-single.eclass
eclass/lua-utils.eclass
eclass/mercurial.eclass
eclass/meson-multilib.eclass
eclass/meson.eclass
eclass/mono-env.eclass
eclass/mount-boot-utils.eclass
eclass/mount-boot.eclass
eclass/multibuild.eclass
Expand All @@ -405,9 +419,11 @@ eclass/multiprocessing.eclass
eclass/ninja-utils.eclass
eclass/optfeature.eclass
eclass/out-of-source-utils.eclass
eclass/out-of-source.eclass
eclass/pam.eclass
eclass/pax-utils.eclass
eclass/perl-functions.eclass
eclass/perl-module.eclass
eclass/plocale.eclass
eclass/portability.eclass
eclass/prefix.eclass
Expand All @@ -417,14 +433,19 @@ eclass/python-any-r1.eclass
eclass/python-r1.eclass
eclass/python-single-r1.eclass
eclass/python-utils-r1.eclass
eclass/qmake-utils.eclass
eclass/readme.gentoo-r1.eclass
eclass/rpm.eclass
eclass/ruby-single.eclass
eclass/ruby-utils.eclass
eclass/rust-toolchain.eclass
eclass/savedconfig.eclass
eclass/secureboot.eclass
eclass/selinux-policy-2.eclass
eclass/sgml-catalog-r1.eclass
eclass/ssl-cert.eclass
eclass/strip-linguas.eclass
eclass/subversion.eclass
eclass/systemd.eclass
eclass/tmpfiles.eclass
eclass/toolchain-autoconf.eclass
Expand All @@ -437,6 +458,7 @@ eclass/user-info.eclass
#
# eclass/usr-ldscript.eclass
eclass/vcs-clean.eclass
eclass/vcs-snapshot.eclass
eclass/verify-sig.eclass
eclass/versionator.eclass
eclass/vim-doc.eclass
Expand All @@ -445,6 +467,7 @@ eclass/virtualx.eclass
eclass/waf-utils.eclass
eclass/wrapper.eclass
eclass/xdg-utils.eclass
eclass/xdg.eclass
eclass/xorg-3.eclass

licenses
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,4 @@ dev-util/bpftool -llvm

# Do not tinker with /boot partition at installation time.
sys-firmware/intel-microcode -initramfs
sys-fs/zfs-kmod -initramfs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2004-2021 Gentoo Authors
# Copyright 2004-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: check-reqs.eclass
Expand Down Expand Up @@ -40,42 +40,46 @@

case ${EAPI} in
6|7|8) ;;
*) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac

EXPORT_FUNCTIONS pkg_pretend pkg_setup

if [[ ! ${_CHECK_REQS_ECLASS} ]]; then
if [[ -z ${_CHECK_REQS_ECLASS} ]]; then
_CHECK_REQS_ECLASS=1

# @ECLASS-VARIABLE: CHECKREQS_MEMORY
# @ECLASS_VARIABLE: CHECKREQS_MEMORY
# @DEFAULT_UNSET
# @DESCRIPTION:
# How much RAM is needed? Eg.: CHECKREQS_MEMORY=15M

# @ECLASS-VARIABLE: CHECKREQS_DISK_BUILD
# @ECLASS_VARIABLE: CHECKREQS_DISK_BUILD
# @DEFAULT_UNSET
# @DESCRIPTION:
# How much diskspace is needed to build the package? Eg.: CHECKREQS_DISK_BUILD=2T

# @ECLASS-VARIABLE: CHECKREQS_DISK_USR
# @ECLASS_VARIABLE: CHECKREQS_DISK_USR
# @DEFAULT_UNSET
# @DESCRIPTION:
# How much space in /usr is needed to install the package? Eg.: CHECKREQS_DISK_USR=15G

# @ECLASS-VARIABLE: CHECKREQS_DISK_VAR
# @ECLASS_VARIABLE: CHECKREQS_DISK_VAR
# @DEFAULT_UNSET
# @DESCRIPTION:
# How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M

# @ECLASS-VARIABLE: CHECKREQS_DONOTHING
# @ECLASS_VARIABLE: CHECKREQS_DONOTHING
# @USER_VARIABLE
# @DEFAULT_UNSET
# @DESCRIPTION:
# Do not error out in _check-reqs_output if requirements are not met.
# This is a user flag and should under _no circumstances_ be set in the ebuild.
[[ -n ${I_KNOW_WHAT_I_AM_DOING} ]] && CHECKREQS_DONOTHING=1

# @ECLASS_VARIABLE: CHECKREQS_FAILED
# @INTERNAL
# @DESCRIPTION:
# If set the checks failed and eclass should abort the build.
# Internal, do not set yourself.

# @FUNCTION: check-reqs_pkg_setup
# @DESCRIPTION:
# Exported function running the resources checks in pkg_setup phase.
Expand Down Expand Up @@ -287,9 +291,11 @@ _check-reqs_output() {
[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && msg="eerror"
if [[ -n ${CHECKREQS_FAILED} ]]; then
${msg}
${msg} "Space constraints set in the ebuild were not met!"
${msg} "The build will most probably fail, you should enhance the space"
${msg} "as per failed tests."
${msg} "Memory or space constraints set in the ebuild were not met!"
${msg} "The build will most probably fail, you should:"
${msg} "- enhance the memory (reduce MAKEOPTS, add swap), or"
${msg} "- add more space"
${msg} "as required depending on the failed tests."
${msg}

[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && \
Expand Down Expand Up @@ -457,12 +463,9 @@ _check-reqs_unsatisfied() {
[[ ${EBUILD_PHASE} == "pretend" && -z ${CHECKREQS_DONOTHING} ]] && msg="eerror"
${msg} "There is NOT at least ${sizeunit} ${location}"

# @ECLASS-VARIABLE: CHECKREQS_FAILED
# @INTERNAL
# @DESCRIPTION:
# If set the checks failed and eclass should abort the build.
# Internal, do not set yourself.
CHECKREQS_FAILED="true"
}

fi

EXPORT_FUNCTIONS pkg_pretend pkg_setup
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
# [email protected]
# @AUTHOR:
# Paul de Vrieze <[email protected]>
# @SUPPORTED_EAPIS: 5 6 7 8
# @SUPPORTED_EAPIS: 7 8
# @BLURB: This is a common location for functions that aid the use of sys-libs/db
# @DESCRIPTION:
# This eclass is designed to provide helpful functions for depending on
# sys-libs/db.

# multilib is used for get_libname in all EAPI
case ${EAPI} in
5|6) inherit eapi7-ver ;& # fallthrough
7|8) inherit multilib ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
Expand Down Expand Up @@ -53,7 +52,7 @@ db_findver() {

PKG="$(best_version $1)"
VER="$(ver_cut 1-2 "${PKG/*db-/}")"
if [ -d "${EPREFIX}"/usr/include/db$(db_ver_to_slot "$VER") ]; then
if [ -d "${ESYSROOT}"/usr/include/db$(db_ver_to_slot "$VER") ]; then
#einfo "Found db version ${VER}" >&2
echo -n "$VER"
return 0
Expand All @@ -72,8 +71,8 @@ db_includedir() {
VER="$(db_findver sys-libs/db)" || return 1
VER="$(db_ver_to_slot "$VER")"
echo "include version ${VER}" >&2
if [ -d "${EPREFIX}/usr/include/db${VER}" ]; then
echo -n "${EPREFIX}/usr/include/db${VER}"
if [ -d "${ESYSROOT}/usr/include/db${VER}" ]; then
echo -n "${ESYSROOT}/usr/include/db${VER}"
return 0
else
eerror "sys-libs/db package requested, but headers not found" >&2
Expand All @@ -84,8 +83,8 @@ db_includedir() {
for x in $@
do
if VER=$(db_findver "=sys-libs/db-${x}*") &&
[ -d "${EPREFIX}/usr/include/db$(db_ver_to_slot $VER)" ]; then
echo -n "${EPREFIX}/usr/include/db$(db_ver_to_slot $VER)"
[ -d "${ESYSROOT}/usr/include/db$(db_ver_to_slot $VER)" ]; then
echo -n "${ESYSROOT}/usr/include/db$(db_ver_to_slot $VER)"
return 0
fi
done
Expand All @@ -103,7 +102,7 @@ db_includedir() {
db_libname() {
if [ $# -eq 0 ]; then
VER="$(db_findver sys-libs/db)" || return 1
if [ -e "${EPREFIX}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
if [ -e "${ESYSROOT}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
echo -n "db-${VER}"
return 0
else
Expand All @@ -115,7 +114,7 @@ db_libname() {
for x in $@
do
if VER=$(db_findver "=sys-libs/db-${x}*"); then
if [ -e "${EPREFIX}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
if [ -e "${ESYSROOT}/usr/$(get_libdir)/libdb-${VER}$(get_libname)" ]; then
echo -n "db-${VER}"
return 0
fi
Expand Down
Loading

0 comments on commit 918e66d

Please sign in to comment.