[gentoo-dev] [PATCH] qmake-utils.eclass: EAPI 8 support

2021-07-03 Thread David Michael
Signed-off-by: David Michael 
---

Hi,

Maybe the banned functions can be dropped?  I don't see a removal date,
and it's been over half a year since they were made unusable.

Thanks.

David

 eclass/qmake-utils.eclass | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/eclass/qmake-utils.eclass b/eclass/qmake-utils.eclass
index 0d49eb94382..d726b362029 100644
--- a/eclass/qmake-utils.eclass
+++ b/eclass/qmake-utils.eclass
@@ -1,174 +1,174 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: qmake-utils.eclass
 # @MAINTAINER:
 # q...@gentoo.org
 # @AUTHOR:
 # Davide Pesavento 
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
 # @BLURB: Common functions for qmake-based packages.
 # @DESCRIPTION:
 # Utility eclass providing wrapper functions for Qt5 qmake.
 #
 # This eclass does not set any metadata variables nor export any phase
 # functions. It can be inherited safely.
 
-if [[ -z ${_QMAKE_UTILS_ECLASS} ]]; then
-_QMAKE_UTILS_ECLASS=1
-
 case ${EAPI} in
-   7) ;;
-   *) die "EAPI=${EAPI:-0} is not supported" ;;
+   7|8) ;;
+   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_QMAKE_UTILS_ECLASS} ]]; then
+_QMAKE_UTILS_ECLASS=1
+
 inherit toolchain-funcs
 
 # @FUNCTION: _qmake-utils_banned_func
 # @INTERNAL
 # @DESCRIPTION:
 # Banned functions are banned.
 _qmake-utils_banned_func() {
die "${FUNCNAME[1]} is banned in EAPI 7 and later"
 }
 
 # @FUNCTION: qt4_get_bindir
 # @INTERNAL
 # @DESCRIPTION:
 # Banned.
 qt4_get_bindir() {
_qmake-utils_banned_func
 }
 
 # @FUNCTION: qt4_get_headerdir
 # @INTERNAL
 # @DESCRIPTION:
 # Banned.
 qt4_get_headerdir() {
_qmake-utils_banned_func
 }
 
 # @FUNCTION: qt4_get_libdir
 # @INTERNAL
 # @DESCRIPTION:
 # Banned.
 qt4_get_libdir() {
_qmake-utils_banned_func
 }
 
 # @FUNCTION: qt4_get_mkspecsdir
 # @INTERNAL
 # @DESCRIPTION:
 # Banned.
 qt4_get_mkspecsdir() {
_qmake-utils_banned_func
 }
 
 # @FUNCTION: qt4_get_plugindir
 # @INTERNAL
 # @DESCRIPTION:
 # Banned.
 qt4_get_plugindir() {
_qmake-utils_banned_func
 }
 
 # @FUNCTION: qt5_get_bindir
 # @DESCRIPTION:
 # Echoes the directory where Qt5 binaries are installed.
 # EPREFIX is already prepended to the returned path.
 qt5_get_bindir() {
echo ${EPREFIX}$(qt5_get_libdir)/qt5/bin
 }
 
 # @FUNCTION: qt5_get_headerdir
 # @DESCRIPTION:
 # Echoes the directory where Qt5 headers are installed.
 qt5_get_headerdir() {
echo /usr/include/qt5
 }
 
 # @FUNCTION: qt5_get_libdir
 # @DESCRIPTION:
 # Echoes the directory where Qt5 libraries are installed.
 qt5_get_libdir() {
echo /usr/$(get_libdir)
 }
 
 # @FUNCTION: qt5_get_mkspecsdir
 # @DESCRIPTION:
 # Echoes the directory where Qt5 mkspecs are installed.
 qt5_get_mkspecsdir() {
echo $(qt5_get_libdir)/qt5/mkspecs
 }
 
 # @FUNCTION: qt5_get_plugindir
 # @DESCRIPTION:
 # Echoes the directory where Qt5 plugins are installed.
 qt5_get_plugindir() {
echo $(qt5_get_libdir)/qt5/plugins
 }
 
 # @FUNCTION: qmake-utils_find_pro_file
 # @INTERNAL
 # @DESCRIPTION:
 # Banned.
 qmake-utils_find_pro_file() {
_qmake-utils_banned_func
 }
 
 # @FUNCTION: eqmake4
 # @INTERNAL
 # @DESCRIPTION:
 # Banned.
 eqmake4() {
_qmake-utils_banned_func
 }
 
 # @FUNCTION: eqmake5
 # @USAGE: [arguments for qmake]
 # @DESCRIPTION:
 # Wrapper for Qt5's qmake. All arguments are passed to qmake.
 #
 # For recursive build systems, i.e. those based on the subdirs template,
 # you should run eqmake5 on the top-level project file only, unless you
 # have a valid reason to do otherwise. During the building, qmake will
 # be automatically re-invoked with the right arguments on every directory
 # specified inside the top-level project file.
 eqmake5() {
debug-print-function ${FUNCNAME} "$@"
 
ebegin "Running qmake"
 
"$(qt5_get_bindir)"/qmake \
-makefile \
QMAKE_AR="$(tc-getAR) cqs" \
QMAKE_CC="$(tc-getCC)" \
QMAKE_LINK_C="$(tc-getCC)" \
QMAKE_LINK_C_SHLIB="$(tc-getCC)" \
QMAKE_CXX="$(tc-getCXX)" \
QMAKE_LINK="$(tc-getCXX)" \
QMAKE_LINK_SHLIB="$(tc-getCXX)" \
QMAKE_OBJCOPY="$(tc-getOBJCOPY)" \
QMAKE_RANLIB= \
QMAKE_STRIP= \
QMAKE_CFLAGS="${CFLAGS}" \
QMAKE_CFLAGS_RELEASE= \
QMAKE_CFLAGS_DEBUG= \
QMAKE_CXXFLAGS="${CXXFLAGS}" \
QMAKE_CXXFLAGS_RELEASE= \
QMAKE_CXXFLAGS_DEBUG= \
QMAKE_LFLAGS="${LDFLAGS}" \
QMAKE_LFLAGS_RELEASE= \
QMAKE_LFLAGS_DEBUG= \

[gentoo-dev] [PATCH] db-use.eclass: EAPI 8 support

2021-07-03 Thread David Michael
This also includes the following cleanups:
  - Drop support for undocumented banned EAPIs.
  - Properly document functions for manpage generation.
  - Make syntax errors fatal.
  - Support cross-compiling.
  - Allow db_findver to accept zero arguments for consistency.
  - Use modern Gentoo bash conventions.

Signed-off-by: David Michael 
---
 eclass/db-use.eclass | 159 ---
 1 file changed, 58 insertions(+), 101 deletions(-)

diff --git a/eclass/db-use.eclass b/eclass/db-use.eclass
index d23b08d1999..1df07a8a7ac 100644
--- a/eclass/db-use.eclass
+++ b/eclass/db-use.eclass
@@ -1,129 +1,86 @@
 # Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
-# This is a common location for functions that aid the use of sys-libs/db
-#
 
 # @ECLASS: db-use.eclass
 # @MAINTAINER:
 # maintainer-nee...@gentoo.org
 # @AUTHOR:
 # Paul de Vrieze 
-# @SUPPORTED_EAPIS: 5 6 7
-# @BLURB: This is a common location for functions that aid the use of 
sys-libs/db
+# @SUPPORTED_EAPIS: 5 6 7 8
+# @BLURB: functions that aid the use of sys-libs/db
 # @DESCRIPTION:
-# This eclass is designed to provide helpful functions for depending on
-# sys-libs/db.
+# This eclass provides helpful functions for depending on sys-libs/db.
 
-# multilib is used for get_libname in all EAPI
-case "${EAPI:-0}" in
-   0|1|2|3|4|5|6) inherit eapi7-ver multilib ;;
-   *) inherit multilib ;;
+case ${EAPI} in
+   5|6|7|8) ;;
+   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-#Convert a version to a db slot
+# multilib is used for get_libname
+[[ ${EAPI} == [56] ]] && inherit eapi7-ver
+inherit multilib
+
+# @FUNCTION: db_ver_to_slot
+# @USAGE: 
+# @DESCRIPTION:
+# Convert a version to a db slot.
 db_ver_to_slot() {
-   if [ $# -ne 1 ]; then
-   eerror "Function db_ver_to_slot needs one argument" >&2
-   eerror "args given:" >&2
-   for f in $@
-   do
-   eerror " - \"$@\"" >&2
-   done
-   return 1
-   fi
+   [[ $# -eq 1 ]] || die "${FUNCNAME} needs one argument"
+
# 5.0.x uses 5.0 as slot value, so this replacement will break it;
# older sys-libs/db might have been using this but it's no longer
# the case, so make it work for latest rather than older stuff.
-   # echo -n "${1/.0/}"
-   echo -n "$1"
+   echo "$1"
 }
 
-#Find the version that correspond to the given atom
+# @FUNCTION: db_findver
+# @USAGE: [atom]
+# @DESCRIPTION:
+# Output the best version that corresponds to the given atom.  If no atom is
+# given, sys-libs/db is used by default.
 db_findver() {
-   has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
-   if [ $# -ne 1 ]; then
-   eerror "Function db_findver needs one argument" >&2
-   eerror "args given:" >&2
-   for f in $@
-   do
-   eerror " - \"$@\"" >&2
-   done
-   return 1
-   fi
+   [[ $# -le 1 ]] || die "${FUNCNAME} needs zero or one arguments"
 
-   PKG="$(best_version $1)"
-   VER="$(ver_cut 1-2 "${PKG/*db-/}")"
-   if [ -d "${EPREFIX}"/usr/include/db$(db_ver_to_slot "$VER") ]; then
-   #einfo "Found db version ${VER}" >&2
-   echo -n "$VER"
-   return 0
-   else
-   return 1
-   fi
+   local pkg=$(best_version "${1:-sys-libs/db}")
+   local ver=$(ver_cut 1-2 "${pkg#*db-}")
+   [[ -d ${ESYSROOT:-${EPREFIX}}/usr/include/db$(db_ver_to_slot "${ver}") 
]] || return 1
+   echo "${ver}"
 }
 
-# Get the include dir for berkeley db.
-# This function has two modes. Without any arguments it will give the best
-# version available. With arguments that form the versions of db packages
-# to test for, it will aim to find the library corresponding to it.
-
+# @FUNCTION: db_includedir
+# @USAGE: [version]...
+# @DESCRIPTION:
+# Output the include directory for berkeley db.  Without any arguments, it will
+# give the best version available.  With a list of versions, it will output the
+# include directory of the first version found.
 db_includedir() {
-   has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
-   if [ $# -eq 0 ]; then
-   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 -

[gentoo-dev] [PATCH] udev.eclass: EAPI 8 support

2021-06-26 Thread David Michael
This also drops EAPIs < 5 to match toolchain-funcs.eclass.

Signed-off-by: David Michael 
---

This probably could have been sent in a series with
https://archives.gentoo.org/gentoo-dev/message/22db5157cab5d6d173483fbc16377081

 eclass/udev.eclass | 25 +++--
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/eclass/udev.eclass b/eclass/udev.eclass
index 2873ae9a92c..7d5f59ab8d9 100644
--- a/eclass/udev.eclass
+++ b/eclass/udev.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2018 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: udev.eclass
 # @MAINTAINER:
 # udev-b...@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: Default eclass for determining udev directories.
 # @DESCRIPTION:
 # Default eclass for determining udev directories.
@@ -28,18 +28,17 @@
 # }
 # @CODE
 
+case ${EAPI} in
+   5|6|7|8) ;;
+   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
 if [[ -z ${_UDEV_ECLASS} ]]; then
 _UDEV_ECLASS=1
 
 inherit toolchain-funcs
 
-case ${EAPI:-0} in
-   0|1|2|3|4|5|6|7) ;;
-   *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
-esac
-
-if [[ ${EAPI:-0} == [0123456] ]]; then
-   RDEPEND=""
+if [[ ${EAPI} == [56] ]]; then
DEPEND="virtual/pkgconfig"
 else
BDEPEND="virtual/pkgconfig"
@@ -82,8 +81,7 @@ get_udevdir() {
 # @FUNCTION: udev_dorules
 # @USAGE:  [...]
 # @DESCRIPTION:
-# Install udev rule(s). Uses doins, thus it is fatal in EAPI 4
-# and non-fatal in earlier EAPIs.
+# Install udev rule(s). Uses doins, thus it is fatal.
 udev_dorules() {
debug-print-function ${FUNCNAME} "${@}"
 
@@ -97,8 +95,7 @@ udev_dorules() {
 # @FUNCTION: udev_newrules
 # @USAGE:  
 # @DESCRIPTION:
-# Install udev rule with a new name. Uses newins, thus it is fatal
-# in EAPI 4 and non-fatal in earlier EAPIs.
+# Install udev rule with a new name. Uses newins, thus it is fatal.
 udev_newrules() {
debug-print-function ${FUNCNAME} "${@}"
 
@@ -113,7 +110,7 @@ udev_newrules() {
 # @DESCRIPTION:
 # Run udevadm control --reload to refresh rules and databases
 udev_reload() {
-   if [[ ${ROOT} != "" ]] && [[ ${ROOT} != "/" ]]; then
+   if [[ -n ${ROOT%/} ]]; then
return 0
fi
 
-- 
2.31.1



[gentoo-dev] [PATCH] autotools.eclass: EAPI 8 support

2021-06-26 Thread David Michael
Signed-off-by: David Michael 
---

Hi,

Here is a simple update that is blocking a lot of stuff.  It moves the
EAPI check outside the inherit guard for bash future-proofing.

Thanks.

David

 eclass/autotools.eclass | 22 +-
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index b386654c832..214c90d06f9 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -4,7 +4,7 @@
 # @ECLASS: autotools.eclass
 # @MAINTAINER:
 # base-sys...@gentoo.org
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: Regenerates auto* build scripts
 # @DESCRIPTION:
 # This eclass is for safely handling autotooled software packages that need to
@@ -23,18 +23,15 @@ if [[ ${__AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then
fi
 fi
 
-if [[ -z ${_AUTOTOOLS_ECLASS} ]] ; then
-_AUTOTOOLS_ECLASS=1
-
 case ${EAPI} in
-   5|6)
-   # Needed for eqawarn
-   inherit eutils
-   ;;
-   7) ;;
-   *) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
+   5|6) inherit eutils ;; # Needed for eqawarn
+   7|8) ;;
+   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
+if [[ -z ${_AUTOTOOLS_ECLASS} ]] ; then
+_AUTOTOOLS_ECLASS=1
+
 inherit gnuconfig libtool
 
 # @ECLASS-VARIABLE: WANT_AUTOCONF
@@ -119,7 +116,6 @@ fi
 AUTOTOOLS_DEPEND="${_automake_atom}
${_autoconf_atom}
${_libtool_atom}"
-RDEPEND=""
 
 # @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND
 # @PRE_INHERIT
@@ -131,7 +127,7 @@ RDEPEND=""
 if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
case ${EAPI} in
5|6) DEPEND=${AUTOTOOLS_DEPEND} ;;
-   7) BDEPEND=${AUTOTOOLS_DEPEND} ;;
+   *) BDEPEND=${AUTOTOOLS_DEPEND} ;;
esac
 fi
 __AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
@@ -490,7 +486,7 @@ autotools_env_setup() {
5|6)
hv_args="--host-root"
;;
-   7)
+   *)
hv_args="-b"
;;
esac
-- 
2.31.1



[gentoo-dev] Re: [PATCH 1/2] xdg-utils.eclass: EAPI 8 support

2021-06-25 Thread David Michael
On Fri, Jun 25, 2021 at 12:33 PM David Michael  wrote:
> @@ -17,9 +17,9 @@
>  #  * XDG .desktop files cache management
>  #  * XDG mime information database management
>
> -case "${EAPI:-0}" in
> -   0|1|2|3|4|5|6|7) ;;
> -   *) die "EAPI=${EAPI} is not supported" ;;
> +case ${EAPI} in
> +   0|1|2|3|4|5|6|7|8) ;;
> +   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
>  esac
>
>  # @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR

Oops, this one should have kept "case ${EAPI:-0} in" since it actually
claims to support EAPI 0.



[gentoo-dev] [PATCH 2/2] gnome.org.eclass: EAPI 8 support

2021-06-25 Thread David Michael
Signed-off-by: David Michael 
---
 eclass/gnome.org.eclass | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/eclass/gnome.org.eclass b/eclass/gnome.org.eclass
index dba26155d74..7efd03bfa94 100644
--- a/eclass/gnome.org.eclass
+++ b/eclass/gnome.org.eclass
@@ -7,13 +7,13 @@
 # @AUTHOR:
 # Authors: Spidler  with help of carparski.
 # eclass variable additions and documentation: Gilles Dartiguelongue 

-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: Helper eclass for gnome.org hosted archives
 # @DESCRIPTION:
 # Provide a default SRC_URI for tarball hosted on gnome.org mirrors.
 
-case ${EAPI:-0} in
-   [567]) ;;
+case ${EAPI} in
+   5|6|7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
@@ -31,7 +31,7 @@ _GNOME_ORG_ECLASS=1
 # moving to only have xz tarballs for new releases.
 : ${GNOME_TARBALL_SUFFIX:="xz"}
 
-# Even though xz-utils are in @system, they must still be added to DEPEND; see
+# Even though xz-utils are in @system, they must still be added to BDEPEND; see
 # 
https://archives.gentoo.org/gentoo-dev/msg_a0d4833eb314d1be5d5802a3b710e0a4.xml
 if [[ ${GNOME_TARBALL_SUFFIX} == "xz" ]]; then
if [[ ${EAPI} != [56] ]]; then
-- 
2.31.1



[gentoo-dev] [PATCH 1/2] xdg-utils.eclass: EAPI 8 support

2021-06-25 Thread David Michael
Also standardize on one conditional block spacing syntax and drop
some redundant local variables.

Signed-off-by: David Michael 
---

Hi,

Here are some EAPI updates for GNOMEy eclasses.  This one in particular
would benefit from IDEPEND as most of its functions run native programs
at pkg_post* time.

Thanks.

David

 eclass/xdg-utils.eclass | 36 
 1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/eclass/xdg-utils.eclass b/eclass/xdg-utils.eclass
index 738df865891..8b627d33cc6 100644
--- a/eclass/xdg-utils.eclass
+++ b/eclass/xdg-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2019 Gentoo Authors
+# Copyright 2004-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: xdg-utils.eclass
@@ -7,7 +7,7 @@
 # freedesktop-b...@gentoo.org
 # @AUTHOR:
 # Original author: Gilles Dartiguelongue 
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 8
 # @BLURB: Auxiliary functions commonly used by XDG compliant packages.
 # @DESCRIPTION:
 # This eclass provides a set of auxiliary functions needed by most XDG
@@ -17,9 +17,9 @@
 #  * XDG .desktop files cache management
 #  * XDG mime information database management
 
-case "${EAPI:-0}" in
-   0|1|2|3|4|5|6|7) ;;
-   *) die "EAPI=${EAPI} is not supported" ;;
+case ${EAPI} in
+   0|1|2|3|4|5|6|7|8) ;;
+   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 # @ECLASS-VARIABLE: DESKTOP_DATABASE_DIR
@@ -57,7 +57,7 @@ xdg_environment_reset() {
 # Updates the .desktop files database.
 # Generates a list of mimetypes linked to applications that can handle them
 xdg_desktop_database_update() {
-   if [[ ${EBUILD_PHASE} != post* ]] ; then
+   if [[ ${EBUILD_PHASE} != post* ]]; then
die "xdg_desktop_database_update must be used in pkg_post* 
phases."
fi
 
@@ -76,7 +76,7 @@ xdg_desktop_database_update() {
 # Updates icon theme cache files under /usr/share/icons.
 # This function should be called from pkg_postinst and pkg_postrm.
 xdg_icon_cache_update() {
-   if [[ ${EBUILD_PHASE} != post* ]] ; then
+   if [[ ${EBUILD_PHASE} != post* ]]; then
die "xdg_icon_cache_update must be used in pkg_post* phases."
fi
 
@@ -86,21 +86,17 @@ xdg_icon_cache_update() {
fi
 
ebegin "Updating icons cache"
-   local dir f retval=0
-   local fails=( )
-   for dir in "${EROOT%/}"/usr/share/icons/*
-   do
-   if [[ -f "${dir}/index.theme" ]] ; then
-   local rv=0
-   gtk-update-icon-cache -qf "${dir}"
-   rv=$?
-   if [[ ! $rv -eq 0 ]] ; then
+   local dir retval=0
+   local fails=()
+   for dir in "${EROOT%/}"/usr/share/icons/*; do
+   if [[ -f ${dir}/index.theme ]]; then
+   if ! gtk-update-icon-cache -qf "${dir}"; then
debug-print "Updating cache failed on ${dir}"
# Add to the list of failures
fails+=( "${dir}" )
retval=2
fi
-   elif [[ $(ls "${dir}") = "icon-theme.cache" ]]; then
+   elif [[ $(ls "${dir}") = icon-theme.cache ]]; then
# Clear stale cache files after theme uninstallation
rm "${dir}/icon-theme.cache"
fi
@@ -110,8 +106,8 @@ xdg_icon_cache_update() {
fi
done
eend ${retval}
-   for f in "${fails[@]}" ; do
-   eerror "Failed to update cache with icon $f"
+   for dir in "${fails[@]}"; do
+   eerror "Failed to update cache with icon ${dir}"
done
 }
 
@@ -120,7 +116,7 @@ xdg_icon_cache_update() {
 # Update the mime database.
 # Creates a general list of mime types from several sources
 xdg_mimeinfo_database_update() {
-   if [[ ${EBUILD_PHASE} != post* ]] ; then
+   if [[ ${EBUILD_PHASE} != post* ]]; then
die "xdg_mimeinfo_database_update must be used in pkg_post* 
phases."
fi
 
-- 
2.31.1



[gentoo-dev] [PATCH] systemd.eclass: EAPI 8 support

2021-06-24 Thread David Michael
This also drops EAPIs < 5 to match toolchain-funcs.eclass.  (Its
support for EAPI 0 is an implementation detail so crossdev can
source it, which is not relevant here.)

Signed-off-by: David Michael 
---

Hi,

Here is a simple eclass EAPI cleanup with no dependencies.  There are
also small tweaks for style consistency.  Maybe the deprecated tmpfiles
functions ( https://bugs.gentoo.org/740638 ) could be dropped since they
have no removal date, unless they're waiting for the big EAPI 5 cleanup.

Thanks.

David

 eclass/systemd.eclass | 56 ++-
 1 file changed, 23 insertions(+), 33 deletions(-)

diff --git a/eclass/systemd.eclass b/eclass/systemd.eclass
index ab0d6561984..860ba35b35a 100644
--- a/eclass/systemd.eclass
+++ b/eclass/systemd.eclass
@@ -4,7 +4,7 @@
 # @ECLASS: systemd.eclass
 # @MAINTAINER:
 # syst...@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: helper functions to install systemd units
 # @DESCRIPTION:
 # This eclass provides a set of functions to install unit files for
@@ -24,14 +24,14 @@
 # }
 # @CODE
 
-inherit toolchain-funcs
-
-case ${EAPI:-0} in
-   0|1|2|3|4|5|6|7) ;;
-   *) die "${ECLASS}.eclass API in EAPI ${EAPI} not yet established."
+case ${EAPI} in
+   5|6|7|8) ;;
+   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-if [[ ${EAPI:-0} == [0123456] ]]; then
+inherit toolchain-funcs
+
+if [[ ${EAPI} == [56] ]]; then
DEPEND="virtual/pkgconfig"
 else
BDEPEND="virtual/pkgconfig"
@@ -72,7 +72,6 @@ _systemd_get_systemunitdir() {
 # ${D}).  This function always succeeds, even if systemd is not
 # installed.
 systemd_get_systemunitdir() {
-   has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
 
echo "${EPREFIX}$(_systemd_get_systemunitdir)"
@@ -82,7 +81,7 @@ systemd_get_systemunitdir() {
 # @DESCRIPTION:
 # Deprecated alias for systemd_get_systemunitdir.
 systemd_get_unitdir() {
-   [[ ${EAPI} == [012345] ]] || die "${FUNCNAME} is banned in EAPI 6, use 
systemd_get_systemunitdir instead"
+   [[ ${EAPI} == 5 ]] || die "${FUNCNAME} is banned in EAPI 6, use 
systemd_get_systemunitdir instead"
 
systemd_get_systemunitdir
 }
@@ -101,7 +100,6 @@ _systemd_get_userunitdir() {
 # ${D}). This function always succeeds, even if systemd is not
 # installed.
 systemd_get_userunitdir() {
-   has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
 
echo "${EPREFIX}$(_systemd_get_userunitdir)"
@@ -121,7 +119,6 @@ _systemd_get_utildir() {
 # ${D}). This function always succeeds, even if systemd is not
 # installed.
 systemd_get_utildir() {
-   has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
 
echo "${EPREFIX}$(_systemd_get_utildir)"
@@ -138,10 +135,8 @@ _systemd_get_systemgeneratordir() {
 # @FUNCTION: systemd_get_systemgeneratordir
 # @DESCRIPTION:
 # Output the path for the systemd system generator directory (not including
-# ${D}). This function always succeeds, even if systemd is not
-# installed.
+# ${D}). This function always succeeds, even if systemd is not installed.
 systemd_get_systemgeneratordir() {
-   has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
debug-print-function ${FUNCNAME} "${@}"
 
echo "${EPREFIX}$(_systemd_get_systemgeneratordir)"
@@ -150,8 +145,7 @@ systemd_get_systemgeneratordir() {
 # @FUNCTION: systemd_dounit
 # @USAGE: ...
 # @DESCRIPTION:
-# Install systemd unit(s). Uses doins, thus it is fatal in EAPI 4
-# and non-fatal in earlier EAPIs.
+# Install systemd unit(s). Uses doins, thus it is fatal.
 systemd_dounit() {
debug-print-function ${FUNCNAME} "${@}"
 
@@ -165,8 +159,7 @@ systemd_dounit() {
 # @FUNCTION: systemd_newunit
 # @USAGE:  
 # @DESCRIPTION:
-# Install systemd unit with a new name. Uses newins, thus it is fatal
-# in EAPI 4 and non-fatal in earlier EAPIs.
+# Install systemd unit with a new name. Uses newins, thus it is fatal.
 systemd_newunit() {
debug-print-function ${FUNCNAME} "${@}"
 
@@ -180,8 +173,7 @@ systemd_newunit() {
 # @FUNCTION: systemd_douserunit
 # @USAGE: ...
 # @DESCRIPTION:
-# Install systemd user unit(s). Uses doins, thus it is fatal in EAPI 4
-# and non-fatal in earlier EAPIs.
+# Install systemd user unit(s). Uses doins, thus it is fatal.
 systemd_douserunit() {
debug-print-function ${FUNCNAME} "${@}"
 
@@ -196,7 +188,7 @@ systemd_douserunit() {
 # @USAGE:  
 # @DESCRIPTION:
 # Install systemd user unit with a new name. Uses newins, thus it
-# is fatal in EAPI 4 and non-fatal in earlier EAPIs.
+# is fatal.
 sys

Re: [gentoo-dev] [PATCH 1/2] ninja-utils.eclass: EAPI 8 support

2021-06-24 Thread David Michael
On Thu, Jun 24, 2021 at 12:51 PM Ulrich Mueller  wrote:
> >>>>> On Thu, 24 Jun 2021, David Michael wrote:
> > --- a/eclass/ninja-utils.eclass
> > +++ b/eclass/ninja-utils.eclass
> > @@ -1,4 +1,4 @@
> > -# Copyright 1999-2018 Gentoo Foundation
> > +# Copyright 1999-2021 Gentoo Foundation
>
> Please update to "Gentoo Authors".
>
> >  # Distributed under the terms of the GNU General Public License v2
> >
> >  # @ECLASS: ninja-utils.eclass
> > @@ -8,7 +8,7 @@
> >  # @AUTHOR:
> >  # Michał Górny 
> >  # Mike Gilbert 
> > -# @SUPPORTED_EAPIS: 2 4 5 6 7
> > +# @SUPPORTED_EAPIS: 5 6 7 8
> >  # @BLURB: common bits to run dev-util/ninja builder
> >  # @DESCRIPTION:
> >  # This eclass provides a single function -- eninja -- that can be used
> > @@ -21,10 +21,8 @@
> >  if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
> >
> >  case ${EAPI:-0} in
>
> This could be simplified to "case ${EAPI} in".

Okay, I've updated https://github.com/gentoo/gentoo/pull/21409 and
also moved the EAPI check outside the inherit guard, since that's what
other eclasses seem to do.

Thanks.

David



[gentoo-dev] [PATCH 2/2] meson.eclass: EAPI 8 support

2021-06-24 Thread David Michael
Signed-off-by: David Michael 
---

Hi,

This updates meson.eclass to conform to conventions that other eclasses
seem to follow.  E.g. conditional inherits are first (presumably for
function precedence), and defining the inherit guard at the end.  It
also removes the split inherit guard.  The only reason I saw for it is
https://bugs.gentoo.org/619178#c4 with no further details.  Are there
actually any examples of this being a problem?  A couple Python eclasses
seem to be the only other instances of this.

Thanks.

David

 eclass/meson.eclass | 23 ---
 1 file changed, 8 insertions(+), 15 deletions(-)

diff --git a/eclass/meson.eclass b/eclass/meson.eclass
index c9a5e0b5956..583cc30c8c3 100644
--- a/eclass/meson.eclass
+++ b/eclass/meson.eclass
@@ -5,7 +5,7 @@
 # @MAINTAINER:
 # William Hubbs 
 # Mike Gilbert 
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
 # @BLURB: common ebuild functions for meson-based packages
 # @DESCRIPTION:
 # This eclass contains the default phase functions for packages which
@@ -15,7 +15,7 @@
 # Typical ebuild using meson.eclass:
 #
 # @CODE
-# EAPI=6
+# EAPI=8
 #
 # inherit meson
 #
@@ -23,7 +23,7 @@
 #
 # src_configure() {
 #  local emesonargs=(
-#  $(meson_use qt4)
+#  $(meson_use qt5)
 #  $(meson_feature threads)
 #  $(meson_use bindist official_branding)
 #  )
@@ -35,31 +35,23 @@
 # @CODE
 
 case ${EAPI:-0} in
-   6|7) ;;
-   *) die "EAPI=${EAPI} is not supported" ;;
+   6|7|8) ;;
+   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 if [[ -z ${_MESON_ECLASS} ]]; then
 
+[[ ${EAPI} == 6 ]] && inherit eapi7-ver
 inherit multiprocessing ninja-utils python-utils-r1 toolchain-funcs
 
-if [[ ${EAPI} == 6 ]]; then
-   inherit eapi7-ver
-fi
-
-fi
-
 EXPORT_FUNCTIONS src_configure src_compile src_test src_install
 
-if [[ -z ${_MESON_ECLASS} ]]; then
-_MESON_ECLASS=1
-
 MESON_DEPEND=">=dev-util/meson-0.56.0
>=dev-util/ninja-1.8.2
dev-util/meson-format-array
 "
 
-if [[ ${EAPI:-0} == [6] ]]; then
+if [[ ${EAPI} == 6 ]]; then
DEPEND=${MESON_DEPEND}
 else
BDEPEND=${MESON_DEPEND}
@@ -426,4 +418,5 @@ meson_src_install() {
popd > /dev/null || die
 }
 
+_MESON_ECLASS=1
 fi
-- 
2.31.1



[gentoo-dev] [PATCH 1/2] ninja-utils.eclass: EAPI 8 support

2021-06-24 Thread David Michael
Also drop support for EAPIs < 5 to match multiprocessing.eclass.

Signed-off-by: David Michael 
---

Hi,

Here are a couple patches to support EAPI 8 with meson packages.  I also
posted this to https://github.com/gentoo/gentoo/pull/21409 for review.

Thanks.

David

 eclass/ninja-utils.eclass | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/eclass/ninja-utils.eclass b/eclass/ninja-utils.eclass
index ca8d67191dc..f8f088b4209 100644
--- a/eclass/ninja-utils.eclass
+++ b/eclass/ninja-utils.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: ninja-utils.eclass
@@ -8,7 +8,7 @@
 # @AUTHOR:
 # Michał Górny 
 # Mike Gilbert 
-# @SUPPORTED_EAPIS: 2 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: common bits to run dev-util/ninja builder
 # @DESCRIPTION:
 # This eclass provides a single function -- eninja -- that can be used
@@ -21,10 +21,8 @@
 if [[ -z ${_NINJA_UTILS_ECLASS} ]]; then
 
 case ${EAPI:-0} in
-   0|1|3) die "EAPI=${EAPI:-0} is not supported (too old)";;
-   # copied from cmake-utils
-   2|4|5|6|7) ;;
-   *) die "EAPI=${EAPI} is not yet supported" ;;
+   5|6|7|8) ;;
+   *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
 # @ECLASS-VARIABLE: NINJAOPTS
@@ -44,7 +42,7 @@ inherit multiprocessing
 # with EAPI 6, it also supports being called via 'nonfatal'.
 eninja() {
local nonfatal_args=()
-   [[ ${EAPI:-0} != [245] ]] && nonfatal_args+=( -n )
+   [[ ${EAPI} != 5 ]] && nonfatal_args+=( -n )
 
if [[ -z ${NINJAOPTS+set} ]]; then
NINJAOPTS="-j$(makeopts_jobs) -l$(makeopts_loadavg 
"${MAKEOPTS}" 0)"
-- 
2.31.1



Re: [gentoo-dev] [PATCH 3/4] acct-group.eclass: EAPI 8 support

2021-06-22 Thread David Michael
On Tue, Jun 22, 2021 at 1:15 PM Ulrich Mueller  wrote:
> >>>>> On Tue, 22 Jun 2021, David Michael wrote:
> > -# Then you add appropriate dependency to your package.  The dependency
> > -# type(s) should be:
> > -# - DEPEND (+ RDEPEND) if the group is already needed at build time,
> > -# - RDEPEND if it is needed at install time (e.g. you 'fowners' files
> > -#   in pkg_preinst) or run time.
>
> "man acct-group.eclass" currently renders that paragraph like this:
>
>Then you add appropriate dependency to your  package.   The  dependency
>type(s)  should be: - DEPEND (+ RDEPEND) if the group is already needed
>at build time, - RDEPEND if it is needed  at  install  time  (e.g.  you
>'fowners' files
>  in pkg_preinst) or run time.
>
> In other words, there's very little formatting support in eclassdoc.
>
> > +# Then you add appropriate dependencies to your package.  Note that the 
> > build
> > +# system might need to resolve names, too.  The dependency type(s) should 
> > be:
> > +# - BDEPEND if the group must be resolvable at build time (e.g. it is used 
> > by
> > +#   'fowners' in src_install),
> > +# - IDEPEND if it must be resolvable at install time (e.g. it is used by
> > +#   'fowners' in pkg_preinst),
> > +# - RDEPEND in every case.
>
> So, while at it, could you reformat it that it will be better readable
> in the generated man page?
>
> (Same issue in acct-user.eclass.)

I made these changes and pushed the commits to
https://github.com/gentoo/gentoo/pull/21377 in case that's easier to
track changes and merge.  I could resend everything if that's
preferred.

Thanks.

David



[gentoo-dev] [PATCH 4/4] acct-user.eclass: EAPI 8 support

2021-06-22 Thread David Michael
Update the documentation to describe how to depend on GLEP 81
packages with EAPI 8.  There is no NSS module for resolving the
accounts installed in $SYSROOT, so acct-* packages might also need
need to be in $BROOT e.g. for fowners which directly calls chmod.

  - BDEPEND so the build system can resolve names when building
packages in nonempty $SYSROOT at src_install time.

  - IDEPEND so the build system can resolve names when installing
binary packages in nonempty $ROOT at pkg_preinst time.

  - RDEPEND so the target system can use the accounts.

Signed-off-by: David Michael 
---
 eclass/acct-user.eclass | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index ee4358b5c75..4e26c570bc0 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Gentoo Authors
+# Copyright 2019-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: acct-user.eclass
@@ -7,7 +7,7 @@
 # @AUTHOR:
 # Michael Orlitzky 
 # Michał Górny 
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
 # @BLURB: Eclass used to create and maintain a single user entry
 # @DESCRIPTION:
 # This eclass represents and creates a single user entry.  The name
@@ -26,24 +26,26 @@
 # contents:
 #
 # @CODE
-# EAPI=7
+# EAPI=8
 # inherit acct-user
 # ACCT_USER_ID=200
 # ACCT_USER_GROUPS=( foo )
 # acct-user_add_deps
 # @CODE
 #
-# Then you add appropriate dependency to your package.  The dependency
-# type(s) should be:
-# - DEPEND (+ RDEPEND) if the user is already needed at build time,
-# - RDEPEND if it is needed at install time (e.g. you 'fowners' files
-#   in pkg_preinst) or run time.
+# Then you add appropriate dependencies to your package.  Note that the build
+# system might need to resolve names, too.  The dependency type(s) should be:
+# - BDEPEND if the user must be resolvable at build time (e.g. it is used by
+#   'fowners' in src_install),
+# - IDEPEND if it must be resolvable at install time (e.g. it is used by
+#   'fowners' in pkg_preinst),
+# - RDEPEND in every case.
 
 if [[ -z ${_ACCT_USER_ECLASS} ]]; then
 _ACCT_USER_ECLASS=1
 
 case ${EAPI:-0} in
-   7) ;;
+   7|8) ;;
*) die "EAPI=${EAPI:-0} not supported";;
 esac
 
-- 
2.31.1



[gentoo-dev] [PATCH 3/4] acct-group.eclass: EAPI 8 support

2021-06-22 Thread David Michael
Update the documentation to describe how to depend on GLEP 81
packages with EAPI 8.  There is no NSS module for resolving the
accounts installed in $SYSROOT, so acct-* packages might also need
need to be in $BROOT e.g. for fowners which directly calls chmod.

  - BDEPEND so the build system can resolve names when building
packages in nonempty $SYSROOT at src_install time.

  - IDEPEND so the build system can resolve names when installing
binary packages in nonempty $ROOT at pkg_preinst time.

  - RDEPEND so the target system can use the accounts.

Signed-off-by: David Michael 
---
 eclass/acct-group.eclass | 20 +++-
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index 11a9f29e625..e56635d3a09 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 Gentoo Authors
+# Copyright 2019-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: acct-group.eclass
@@ -7,7 +7,7 @@
 # @AUTHOR:
 # Michael Orlitzky 
 # Michał Górny 
-# @SUPPORTED_EAPIS: 7
+# @SUPPORTED_EAPIS: 7 8
 # @BLURB: Eclass used to create and maintain a single group entry
 # @DESCRIPTION:
 # This eclass represents and creates a single group entry.  The name
@@ -20,22 +20,24 @@
 # and add an ebuild with the following contents:
 #
 # @CODE
-# EAPI=7
+# EAPI=8
 # inherit acct-group
 # ACCT_GROUP_ID=200
 # @CODE
 #
-# Then you add appropriate dependency to your package.  The dependency
-# type(s) should be:
-# - DEPEND (+ RDEPEND) if the group is already needed at build time,
-# - RDEPEND if it is needed at install time (e.g. you 'fowners' files
-#   in pkg_preinst) or run time.
+# Then you add appropriate dependencies to your package.  Note that the build
+# system might need to resolve names, too.  The dependency type(s) should be:
+# - BDEPEND if the group must be resolvable at build time (e.g. it is used by
+#   'fowners' in src_install),
+# - IDEPEND if it must be resolvable at install time (e.g. it is used by
+#   'fowners' in pkg_preinst),
+# - RDEPEND in every case.
 
 if [[ -z ${_ACCT_GROUP_ECLASS} ]]; then
 _ACCT_GROUP_ECLASS=1
 
 case ${EAPI:-0} in
-   7) ;;
+   7|8) ;;
*) die "EAPI=${EAPI:-0} not supported";;
 esac
 
-- 
2.31.1



[gentoo-dev] [PATCH 2/4] user.eclass: EAPI 8 support

2021-06-22 Thread David Michael
Signed-off-by: David Michael 
---
 eclass/user.eclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/eclass/user.eclass b/eclass/user.eclass
index e1f87a383ad..a1fb2a9bbaf 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -5,7 +5,7 @@
 # @MAINTAINER:
 # base-sys...@gentoo.org (Linux)
 # Michał Górny  (NetBSD)
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 8
 # @BLURB: user management in ebuilds
 # @DEPRECATED: acct-user/acct-group packages
 # @DESCRIPTION:
-- 
2.31.1



[gentoo-dev] [PATCH 1/4] user-info.eclass: EAPI 8 support

2021-06-22 Thread David Michael
Signed-off-by: David Michael 
---
 eclass/user-info.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/user-info.eclass b/eclass/user-info.eclass
index d349fc17476..8b8538bf843 100644
--- a/eclass/user-info.eclass
+++ b/eclass/user-info.eclass
@@ -5,11 +5,11 @@
 # @MAINTAINER:
 # base-sys...@gentoo.org (Linux)
 # Michał Górny  (NetBSD)
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: Read-only access to user and group information
 
 case ${EAPI:-0} in
-   [567]) ;;
+   [5678]) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
-- 
2.31.1



Re: [gentoo-dev] [PATCH] fcaps.eclass: support EAPI 8

2021-06-17 Thread David Michael
On Thu, Jun 17, 2021 at 7:02 AM Ulrich Mueller  wrote:
> >>>>> On Thu, 17 Jun 2021, Michał Górny wrote:
> > On Thu, 2021-06-17 at 12:10 +0200, Ulrich Mueller wrote:
> >> > > > > > On Thu, 17 Jun 2021, David Michael wrote:
> >> > @@ -33,15 +34,12 @@ _FCAPS_ECLASS=1
> >> >
> >> >  IUSE="+filecaps"
> >> >
> >> > -# Since it is needed in pkg_postinst() it must be in RDEPEND
> >> > +# Since it is needed in pkg_postinst() it must be in IDEPEND
> >> >  case "${EAPI:-0}" in
> >> > -  [0-6])
> >> > -  RDEPEND="filecaps? ( sys-libs/libcap )"
> >> > -  ;;
> >> > -  *)
> >> > -  BDEPEND="filecaps? ( sys-libs/libcap )"
> >> > -  RDEPEND="${BDEPEND}"
> >> > -  ;;
> >> > +  7) BDEPEND="filecaps? ( sys-libs/libcap )" ;&
> >>
> >> This is ill-defined in old EAPIs (5 and before), so the case statement
> >> may fail. You cannot use ;& in global scope of an eclass.
> >>
> >> Why not just change * to 7, and add a new case for 8? It's one
> >> additional line, and IMHO would be better readable than having a
> >> fallthrough.
>
> > I've already left a comment on the PR suggesting to split it into two
> > cases: one to check for valid EAPI, the other for deps.  It would be
> > cleaner IMO, as the second case would cover all future EAPIs via *,
> > and the first one would prevent the syntax error from applying to old
> > EAPIs (I've tested that).
>
> That would work too. But please add a comment making it clear that there
> is a fallthrough.

I've updated https://github.com/gentoo/gentoo/pull/21239 with this.

Thanks.

David



[gentoo-dev] [PATCH] fcaps.eclass: support EAPI 8

2021-06-16 Thread David Michael
This defines the native install-time libcap dependency as:

  - EAPI < 7: RDEPEND
Only regular ROOT=/ builds can be expected to work.

  - EAPI = 7: RDEPEND + BDEPEND
Also install the native setcap at built time, so cross-
compiling will work, but not installing binpkgs in ROOTs.

  - EAPI > 7: IDEPEND
Install native setcap at install-time; it works everywhere.

Since all remaining users are EAPI 6 and above, declare eclass
compatibility with EAPIs 6, 7, and 8.

Signed-off-by: David Michael 
---

Hi,

This is from https://github.com/gentoo/gentoo/pull/21239 .

I noticed a note in the PMS about how ebuilds with later EAPIs should be
remain source-able by old package managers for EAPI parsing.  Does that
extend to eclasses?  It would seem unfortunate for global scope to be
permanently restricted to bash 3.0 syntax.

Thanks.

David

 eclass/fcaps.eclass | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/eclass/fcaps.eclass b/eclass/fcaps.eclass
index 4bef00d40ac..291157fb4a6 100644
--- a/eclass/fcaps.eclass
+++ b/eclass/fcaps.eclass
@@ -1,9 +1,10 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: fcaps.eclass
 # @MAINTAINER:
 # base-sys...@gentoo.org
+# @SUPPORTED_EAPIS: 6 7 8
 # @BLURB: function to set POSIX file-based capabilities
 # @DESCRIPTION:
 # This eclass provides a function to set file-based capabilities on binaries.
@@ -33,15 +34,12 @@ _FCAPS_ECLASS=1
 
 IUSE="+filecaps"
 
-# Since it is needed in pkg_postinst() it must be in RDEPEND
+# Since it is needed in pkg_postinst() it must be in IDEPEND
 case "${EAPI:-0}" in
-   [0-6])
-   RDEPEND="filecaps? ( sys-libs/libcap )"
-   ;;
-   *)
-   BDEPEND="filecaps? ( sys-libs/libcap )"
-   RDEPEND="${BDEPEND}"
-   ;;
+   7) BDEPEND="filecaps? ( sys-libs/libcap )" ;&
+   6) RDEPEND="filecaps? ( sys-libs/libcap )" ;;
+   8) IDEPEND="filecaps? ( sys-libs/libcap )" ;;
+   *) die "EAPI ${EAPI:-0} is unsupported" ;;
 esac
 
 # @ECLASS-VARIABLE: FILECAPS
-- 
2.31.1



Re: [gentoo-dev] [PATCH] toolchain-funcs.eclass: include riscv bitness in tc-arch

2021-05-03 Thread David Michael
On Mon, May 3, 2021 at 4:41 AM Sergei Trofimovich  wrote:
> On Sun, 02 May 2021 18:22:43 -0400 fedora@gmail.com wrote:
> > This makes tc-arch identify RISC-V systems as either "riscv64" or
> > "riscv32".  It will still return "riscv" for the kernel arch or if
> > bitness is not given in the host triplet.
>
> tc-arch returns portage's ARCH= value based on passed tuple.
> There are no ARCH=riscv32 or ARCH=riscv64 in Gentoo. Only ARCH=riscv.

Okay, then I will remap it directly in meson instead.

Thanks.

David



[gentoo-dev] Re: [PATCH] kernel-2.eclass: EAPI 7 support

2021-02-05 Thread David Michael
On Fri, Feb 5, 2021 at 12:58 PM David Michael  wrote:
> This converts installation paths prefixed with EROOT or ED to have
> a leading slash, switches DEPEND to BDEPEND for EAPI 7 so tools are
> installed in BROOT and natively executable, and makes eapply_user
> the default src_prepare behavior for EAPIs since 6.
>
> It also drops the binutils build-time dependency since it was added
> in the original kernel.eclass implementation ~20 years ago to
> enforce a minimum version to avoid old assembly bugs.  All affected
> versions are long gone, and it isn't required to install sources
> anyway, so skip building the unused binutils dependency.

Oops, I forgot about the bug.  If someone applies this, you can add
the following line here:

Closes: https://bugs.gentoo.org/702280



[gentoo-dev] [PATCH] kernel-2.eclass: EAPI 7 support

2021-02-05 Thread David Michael
This converts installation paths prefixed with EROOT or ED to have
a leading slash, switches DEPEND to BDEPEND for EAPI 7 so tools are
installed in BROOT and natively executable, and makes eapply_user
the default src_prepare behavior for EAPIs since 6.

It also drops the binutils build-time dependency since it was added
in the original kernel.eclass implementation ~20 years ago to
enforce a minimum version to avoid old assembly bugs.  All affected
versions are long gone, and it isn't required to install sources
anyway, so skip building the unused binutils dependency.

Signed-off-by: David Michael 
---

Hi,

Can the kernel eclass support EAPI 7 now?  It would help auditing
dependencies to eventually support BDEPEND properly in the ebuilds using
the eclass.

The patch also corrects some whitespace issues that my editor was
highlighting, like extra end-of-line space or random embedded tabs.  I
could drop those changes if needed.

Thanks.

David

 eclass/kernel-2.eclass | 67 +++---
 1 file changed, 31 insertions(+), 36 deletions(-)

diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index dccd39ec8f2..12ab19baee7 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: kernel-2.eclass
@@ -8,7 +8,7 @@
 # John Mylchreest 
 # Mike Pagano 
 # 
-# @SUPPORTED_EAPIS: 2 3 4 5 6
+# @SUPPORTED_EAPIS: 2 3 4 5 6 7
 # @BLURB: Eclass for kernel packages
 # @DESCRIPTION:
 # This is the kernel.eclass rewrite for a clean base regarding the 2.6
@@ -28,7 +28,7 @@
 # @ECLASS-VARIABLE:  K_NODRYRUN
 # @DEFAULT_UNSET
 # @DESCRIPTION:
-# if this is set then patch --dry-run will not 
+# if this is set then patch --dry-run will not
 # be run. Certain patches will fail with this parameter
 # See bug #507656
 
@@ -198,11 +198,11 @@
 # If you do change them, there is a chance that we will not fix resulting bugs;
 # that of course does not mean we're not willing to help.
 
-inherit toolchain-funcs
+inherit estack toolchain-funcs
 [[ ${EAPI:-0} == [012345] ]] && inherit epatch
-[[ ${EAPI:-0} == [0123456] ]] && inherit estack eapi7-ver
+[[ ${EAPI:-0} == [0123456] ]] && inherit eapi7-ver
 case ${EAPI:-0} in
-   2|3|4|5|6)
+   2|3|4|5|6|7)
EXPORT_FUNCTIONS src_{unpack,prepare,compile,install,test} \
pkg_{setup,preinst,postinst,postrm} ;;
*) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
@@ -314,7 +314,6 @@ handle_genpatches() {
 # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
 # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
 detect_version() {
-
# We've already run, so nothing to do here.
[[ -n ${KV_FULL} ]] && return 0
 
@@ -540,7 +539,6 @@ detect_version() {

UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz
 ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz"
fi
 
-
fi
 
debug-print-kernel2-variables
@@ -600,10 +598,8 @@ kernel_is_2_6() {
 
 # Capture the sources type and set DEPENDs
 if [[ ${ETYPE} == sources ]]; then
-   DEPEND="!build? (
-   sys-apps/sed
-   >=sys-devel/binutils-2.11.90.0.31
-   )"
+   [[ ${EAPI} == [0-6] ]] && DEPEND="!build? ( sys-apps/sed )" ||
+   BDEPEND="!build? ( sys-apps/sed )"
RDEPEND="!build? (
dev-lang/perl
sys-devel/bc
@@ -638,7 +634,8 @@ if [[ ${ETYPE} == sources ]]; then
# tree has been dropped from the kernel.
kernel_is lt 4 14 && LICENSE+=" !deblob? ( 
linux-firmware )"
 
-   DEPEND+=" deblob? ( ${PYTHON_DEPS} )"
+   [[ ${EAPI} == [0-6] ]] && DEPEND+=" deblob? ( 
${PYTHON_DEPS} )" ||
+   BDEPEND+=" deblob? ( ${PYTHON_DEPS} )"
 
if [[ -n KV_MINOR ]]; then
DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
@@ -826,7 +823,7 @@ unpack_set_extraversion() {
 
 unpack_fix_install_path() {
cd "${S}"
-   sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
+   sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
 }
 
 # Compile Functions
@@ -855,7 +852,7 @@ compile_headers() {
 
# autoconf.h isnt generated unless it already exists. plus, we 
have
# no guarantee that any headers are installed on the system...
-   [[ -f ${EROOT}usr/include/linux/autoconf.h ]] \
+   [[ -f ${EROOT%/}/usr/include/linux/autoconf.h ]] \
|| touch include/linux/autoconf.h

[gentoo-dev] [PATCH] xorg-3.eclass: Call einstalldocs when not using XORG_MULTILIB

2021-01-09 Thread David Michael
DOCS only got installed from the multilib-minimal_src_install call,
so they were missing from non-multilib packages.  This corrects a
behavior difference from xorg-2.eclass where autotools-utils.eclass
installed DOCS for the non-multilib case.

Signed-off-by: David Michael 
---
 eclass/xorg-3.eclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eclass/xorg-3.eclass b/eclass/xorg-3.eclass
index 399fc8661f4..fcaeb84edca 100644
--- a/eclass/xorg-3.eclass
+++ b/eclass/xorg-3.eclass
@@ -424,6 +424,7 @@ xorg-3_src_install() {
multilib-minimal_src_install "$@"
else
emake DESTDIR="${D}" "${install_args[@]}" "$@" install || die 
"emake install failed"
+   einstalldocs
fi
 
# Many X11 libraries unconditionally install developer documentation
-- 
2.26.2



Re: [gentoo-dev] [PATCH] vala.eclass: make has_version aware of ROOT for EAPI 7

2021-01-08 Thread David Michael
On Thu, Jan 7, 2021 at 3:42 AM Mart Raudsepp  wrote:
> Ühel kenal päeval, K, 06.01.2021 kell 19:27, kirjutas Matt Turner:
> > From: David Michael 
> > The vala dependencies are declared in BDEPEND since EAPI 7 so that
> > the valac command is natively executable.  With no arguments, the
> > has_version function would look for a cross-compiled vala package
> > in the target ROOT and always fail.
>
> I'm not exactly convinced that vapi stuff is arch independent and
> belongs in BDEPEND over DEPEND. Vala ships a lot of .vapi files along
> with valac that get used on compilation. Though the difference might be
> only when different endianness or size_of int

If there are target-specific files that need to be installed via
DEPEND, vala would still need to be installed in BDEPEND so that there
is an executable valac command, right?

In practice, I don't think DEPEND usage matters yet because vala
support seems to require gobject-introspection, which is virtually
impossible to cross-compile.  (I plan to implement something like
Void[0] locally to try it some time.)

This patch is to fix packages like ibus[1] that depend on vala
regardless of my disabling the USE flag, where the current eclass
behavior unconditionally fails.

Thanks.

David

[0] https://maxice8.github.io/8-cross-the-gir
[1] 
https://github.com/gentoo/gentoo/blob/master/app-i18n/ibus/ibus-1.5.23.ebuild#L80



[gentoo-dev] [PATCH] gnome2-utils.eclass: skip executing cross-compiled tools

2020-12-02 Thread David Michael
Executing tools installed in ROOT will fail when cross-compiling,
so this prints a warning about manually running the command instead
in that case.  The warning is copied from dev-libs/glib.

This also reorders the exception handling by increasing severity so
that the "nothing to do" non-error returns first, otherwise the
expected problem of unexecutable cross-compiled commands returns,
otherwise the unexpected problem of missing commands returns.

The immodule cache functions were updated to handle a different
problem.  They run native tools from BROOT, but they are not
guaranteed to exist while cross-compiling (e.g. gtk+ can't BDEPEND
on itself, so the cross-compiled gtk+ can be installed before the
native gtk+, which fails from gtk-query-immodules not existing).

Closes: https://bugs.gentoo.org/757483
Signed-off-by: David Michael 
---

Hi,

Here is an eclass patch to fix bug #757483.  I wasn't sure if the
cross-compiling message should be a warning while everything else was a
debug-print, but I left it matching what glib does.  The message in the
glib ebuilds should be dropped if this is applied.

Thanks.

David

 eclass/gnome2-utils.eclass | 98 +-
 1 file changed, 75 insertions(+), 23 deletions(-)

diff --git a/eclass/gnome2-utils.eclass b/eclass/gnome2-utils.eclass
index 06643db0f60..4abaf3a1a5c 100644
--- a/eclass/gnome2-utils.eclass
+++ b/eclass/gnome2-utils.eclass
@@ -16,8 +16,9 @@
 
 [[ ${EAPI:-0} == [012345] ]] && inherit multilib
 # eutils.eclass: emktemp
+# toolchain-funs.eclass: tc-is-cross-compiler
 # xdg-utils.eclass: xdg_environment_reset, xdg_icon_cache_update
-inherit eutils xdg-utils
+inherit eutils toolchain-funcs xdg-utils
 
 case "${EAPI:-0}" in
0|1|2|3|4|5|6|7) ;;
@@ -125,13 +126,21 @@ gnome2_gconf_install() {
has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
local updater="${EROOT%/}${GCONFTOOL_BIN}"
 
-   if [[ ! -x "${updater}" ]]; then
-   debug-print "${updater} is not executable"
+   if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
+   debug-print "No GNOME 2 GConf schemas found"
return
fi
 
-   if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
-   debug-print "No GNOME 2 GConf schemas found"
+   if tc-is-cross-compiler ; then
+   ewarn "Updating of GNOME 2 GConf schemas skipped due to 
cross-compilation."
+   ewarn "You might want to run gconftool-2 manually on the target 
for"
+   ewarn "your final image and re-run it when packages installing"
+   ewarn "GNOME 2 GConf schemas get upgraded or added to the 
image."
+   return
+   fi
+
+   if [[ ! -x "${updater}" ]]; then
+   debug-print "${updater} is not executable"
return
fi
 
@@ -166,13 +175,20 @@ gnome2_gconf_uninstall() {
has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
local updater="${EROOT%/}${GCONFTOOL_BIN}"
 
-   if [[ ! -x "${updater}" ]]; then
-   debug-print "${updater} is not executable"
+   if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
+   debug-print "No GNOME 2 GConf schemas found"
return
fi
 
-   if [[ -z "${GNOME2_ECLASS_SCHEMAS}" ]]; then
-   debug-print "No GNOME 2 GConf schemas found"
+   if tc-is-cross-compiler ; then
+   ewarn "Removal of GNOME 2 GConf schemas skipped due to 
cross-compilation."
+   ewarn "You might want to run gconftool-2 manually on the target 
for"
+   ewarn "your final image to uninstall this package's schemas."
+   return
+   fi
+
+   if [[ ! -x "${updater}" ]]; then
+   debug-print "${updater} is not executable"
return
fi
 
@@ -269,13 +285,21 @@ gnome2_scrollkeeper_update() {
has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
local updater="${EROOT%/}${SCROLLKEEPER_UPDATE_BIN}"
 
-   if [[ ! -x "${updater}" ]] ; then
-   debug-print "${updater} is not executable"
+   if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
+   debug-print "No scroll cache to update"
return
fi
 
-   if [[ -z "${GNOME2_ECLASS_SCROLLS}" ]]; then
-   debug-print "No scroll cache to update"
+   if tc-is-cross-compiler ; then
+   ewarn "Updating of scrollkeeper database skipped due to 
cross-compilation."
+   ewarn "You might want to run scro

[gentoo-dev] [PATCH v2 2/2] selinux-policy-2.eclass: drop EAPI 5

2020-11-03 Thread David Michael
Signed-off-by: David Michael 
---

Changes since v1:
  - Dropped unnecessary EAPI default value
  - Fixed eapply array awareness

 eclass/selinux-policy-2.eclass | 47 +-
 1 file changed, 12 insertions(+), 35 deletions(-)

diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
index 3ba310e49de..5def86fbef9 100644
--- a/eclass/selinux-policy-2.eclass
+++ b/eclass/selinux-policy-2.eclass
@@ -7,7 +7,7 @@
 # @ECLASS: selinux-policy-2.eclass
 # @MAINTAINER:
 # seli...@gentoo.org
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 6 7
 # @BLURB: This eclass supports the deployment of the various SELinux modules 
in sec-policy
 # @DESCRIPTION:
 # The selinux-policy-2.eclass supports deployment of the various SELinux 
modules
@@ -75,8 +75,8 @@
 : ${SELINUX_GIT_BRANCH:="master"};
 
 case "${EAPI:-0}" in
-   0|1|2|3|4) die "EAPI<5 is not supported";;
-   5|6|7) : ;;
+   0|1|2|3|4|5) die "EAPI<6 is not supported";;
+   6|7) : ;;
*) die "unknown EAPI" ;;
 esac
 
@@ -87,10 +87,6 @@ case ${BASEPOL} in
EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy";;
 esac
 
-if [[ ${EAPI:-0} == 5 ]]; then
-   inherit eutils
-fi
-
 IUSE=""
 
 HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux;
@@ -117,7 +113,7 @@ else
RDEPEND=">=sys-apps/policycoreutils-2.0.82
>=sec-policy/selinux-base-policy-${PV}"
 fi
-if [[ ${EAPI:-0} == [56] ]]; then
+if [[ ${EAPI} == 6 ]]; then
DEPEND="${RDEPEND}
sys-devel/m4
>=sys-apps/checkpolicy-2.0.21"
@@ -162,25 +158,13 @@ selinux-policy-2_src_prepare() {
# Patch the sources with the base patchbundle
if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "" ]]; then
cd "${S}"
-   if [[ ${EAPI:-0} == 5 ]]; then
-   EPATCH_MULTI_MSG="Applying SELinux policy updates ... " 
\
-   EPATCH_SUFFIX="patch" \
-   EPATCH_SOURCE="${WORKDIR}" \
-   EPATCH_FORCE="yes" \
-   epatch
-   else
-   einfo "Applying SELinux policy updates ... "
-   eapply -p0 
"${WORKDIR}/0001-full-patch-against-stable-release.patch"
-   fi
+   einfo "Applying SELinux policy updates ... "
+   eapply -p0 
"${WORKDIR}/0001-full-patch-against-stable-release.patch"
fi
 
-   # Call in epatch_user. We do this early on as we start moving
+   # Call in eapply_user. We do this early on as we start moving
# files left and right hereafter.
-   if [[ ${EAPI:-0} == 5 ]]; then
-   epatch_user
-   else
-   eapply_user
-   fi
+   eapply_user
 
# Copy additional files to the 3rd_party/ location
if [[ "$(declare -p POLICY_FILES 2>/dev/null 2>&1)" == "declare -a"* ]] 
||
@@ -195,17 +179,10 @@ selinux-policy-2_src_prepare() {
 
# Apply the additional patches refered to by the module ebuild.
# But first some magic to differentiate between bash arrays and strings
-   if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* ]] 
||
-  [[ -n ${POLICY_PATCH} ]]; then
-   cd "${S}/refpolicy/policy/modules"
-   for POLPATCH in ${POLICY_PATCH[@]};
-   do
-   if [[ ${EAPI:-0} == 5 ]]; then
-   epatch "${POLPATCH}"
-   else
-   eapply "${POLPATCH}"
-   fi
-   done
+   if [[ "$(declare -p POLICY_PATCH 2>/dev/null 2>&1)" == "declare -a"* 
]]; then
+   [[ -n ${POLICY_PATCH[*]} ]] && eapply -d 
"${S}/refpolicy/policy/modules" "${POLICY_PATCH[@]}"
+   else
+   [[ -n ${POLICY_PATCH} ]] && eapply -d 
"${S}/refpolicy/policy/modules" ${POLICY_PATCH}
fi
 
# Collect only those files needed for this particular module
-- 
2.26.2



Re: [gentoo-dev] [PATCH 1/2] selinux-policy-2.eclass: add EAPI 7

2020-11-03 Thread David Michael
On Tue, Nov 3, 2020 at 2:46 AM Ulrich Mueller  wrote:
> >>>>> On Mon, 02 Nov 2020, David Michael wrote:
>
> > +if [[ ${EAPI:-0} == [56] ]]; then
>
> Substituting 0 is not necessary here.

I wrote it that way to match all other EAPI conditions in the file.
I'll remove it in the second patch where the other instances are
dropped as well so the commits are self-consistent atomic changes.

Thanks.

David



[gentoo-dev] [PATCH 1/2] selinux-policy-2.eclass: add EAPI 7

2020-11-02 Thread David Michael
Closes: https://bugs.gentoo.org/748483
Signed-off-by: David Michael 
---

Hi,

Please start allowing EAPI 7 SELinux policy ebuilds.

Thanks.

David

 eclass/selinux-policy-2.eclass | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
index c1e21974021..3ba310e49de 100644
--- a/eclass/selinux-policy-2.eclass
+++ b/eclass/selinux-policy-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # Eclass for installing SELinux policy, and optionally
@@ -7,7 +7,7 @@
 # @ECLASS: selinux-policy-2.eclass
 # @MAINTAINER:
 # seli...@gentoo.org
-# @SUPPORTED_EAPIS: 5 6
+# @SUPPORTED_EAPIS: 5 6 7
 # @BLURB: This eclass supports the deployment of the various SELinux modules 
in sec-policy
 # @DESCRIPTION:
 # The selinux-policy-2.eclass supports deployment of the various SELinux 
modules
@@ -76,7 +76,7 @@
 
 case "${EAPI:-0}" in
0|1|2|3|4) die "EAPI<5 is not supported";;
-   5|6) : ;;
+   5|6|7) : ;;
*) die "unknown EAPI" ;;
 esac
 
@@ -117,9 +117,15 @@ else
RDEPEND=">=sys-apps/policycoreutils-2.0.82
>=sec-policy/selinux-base-policy-${PV}"
 fi
-DEPEND="${RDEPEND}
-   sys-devel/m4
-   >=sys-apps/checkpolicy-2.0.21"
+if [[ ${EAPI:-0} == [56] ]]; then
+   DEPEND="${RDEPEND}
+   sys-devel/m4
+   >=sys-apps/checkpolicy-2.0.21"
+else
+   DEPEND="${RDEPEND}"
+   BDEPEND="sys-devel/m4
+   >=sys-apps/checkpolicy-2.0.21"
+fi
 
 EXPORT_FUNCTIONS src_unpack src_prepare src_compile src_install pkg_postinst 
pkg_postrm
 
-- 
2.26.2



[gentoo-dev] [PATCH 2/2] selinux-policy-2.eclass: drop EAPI 5

2020-11-02 Thread David Michael
Signed-off-by: David Michael 
---

Grepping through the ebuilds using this eclass shows that they're all on
EAPI 6.  A bunch of workarounds could be dropped along with EAPI 5, but
it isn't necessary to fix anything, so feel free to ignore this patch.

 eclass/selinux-policy-2.eclass | 38 --
 1 file changed, 9 insertions(+), 29 deletions(-)

diff --git a/eclass/selinux-policy-2.eclass b/eclass/selinux-policy-2.eclass
index 3ba310e49de..ce7643ecf15 100644
--- a/eclass/selinux-policy-2.eclass
+++ b/eclass/selinux-policy-2.eclass
@@ -7,7 +7,7 @@
 # @ECLASS: selinux-policy-2.eclass
 # @MAINTAINER:
 # seli...@gentoo.org
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 6 7
 # @BLURB: This eclass supports the deployment of the various SELinux modules 
in sec-policy
 # @DESCRIPTION:
 # The selinux-policy-2.eclass supports deployment of the various SELinux 
modules
@@ -75,8 +75,8 @@
 : ${SELINUX_GIT_BRANCH:="master"};
 
 case "${EAPI:-0}" in
-   0|1|2|3|4) die "EAPI<5 is not supported";;
-   5|6|7) : ;;
+   0|1|2|3|4|5) die "EAPI<6 is not supported";;
+   6|7) : ;;
*) die "unknown EAPI" ;;
 esac
 
@@ -87,10 +87,6 @@ case ${BASEPOL} in
EGIT_CHECKOUT_DIR="${WORKDIR}/refpolicy";;
 esac
 
-if [[ ${EAPI:-0} == 5 ]]; then
-   inherit eutils
-fi
-
 IUSE=""
 
 HOMEPAGE="https://wiki.gentoo.org/wiki/Project:SELinux;
@@ -117,7 +113,7 @@ else
RDEPEND=">=sys-apps/policycoreutils-2.0.82
>=sec-policy/selinux-base-policy-${PV}"
 fi
-if [[ ${EAPI:-0} == [56] ]]; then
+if [[ ${EAPI:-0} == 6 ]]; then
DEPEND="${RDEPEND}
sys-devel/m4
>=sys-apps/checkpolicy-2.0.21"
@@ -162,25 +158,13 @@ selinux-policy-2_src_prepare() {
# Patch the sources with the base patchbundle
if [[ -n ${BASEPOL} ]] && [[ "${BASEPOL}" != "" ]]; then
cd "${S}"
-   if [[ ${EAPI:-0} == 5 ]]; then
-   EPATCH_MULTI_MSG="Applying SELinux policy updates ... " 
\
-   EPATCH_SUFFIX="patch" \
-   EPATCH_SOURCE="${WORKDIR}" \
-   EPATCH_FORCE="yes" \
-   epatch
-   else
-   einfo "Applying SELinux policy updates ... "
-   eapply -p0 
"${WORKDIR}/0001-full-patch-against-stable-release.patch"
-   fi
+   einfo "Applying SELinux policy updates ... "
+   eapply -p0 
"${WORKDIR}/0001-full-patch-against-stable-release.patch"
fi
 
-   # Call in epatch_user. We do this early on as we start moving
+   # Call in eapply_user. We do this early on as we start moving
# files left and right hereafter.
-   if [[ ${EAPI:-0} == 5 ]]; then
-   epatch_user
-   else
-   eapply_user
-   fi
+   eapply_user
 
# Copy additional files to the 3rd_party/ location
if [[ "$(declare -p POLICY_FILES 2>/dev/null 2>&1)" == "declare -a"* ]] 
||
@@ -200,11 +184,7 @@ selinux-policy-2_src_prepare() {
cd "${S}/refpolicy/policy/modules"
for POLPATCH in ${POLICY_PATCH[@]};
do
-   if [[ ${EAPI:-0} == 5 ]]; then
-   epatch "${POLPATCH}"
-   else
-   eapply "${POLPATCH}"
-   fi
+   eapply "${POLPATCH}"
done
fi
 
-- 
2.26.2



Re: [gentoo-dev] Re: [PATCH 1/2] acct-group.eclass: declare the missing dependency on shadow

2020-09-09 Thread David Michael
On Wed, Sep 9, 2020 at 5:37 AM Alexis Ballier  wrote:
> On Tue, 8 Sep 2020 15:54:14 -0400
> David Michael  wrote:
>
> > Hi,
> >
> > This fix might not be so straightforward.  A configuration I tested
> > hit a dependency loop with shadow -> pambase -> systemd -> a bunch of
> > groups -> shadow.  It is possible to bootstrap around by emerging
> > shadow with no USE flags first, but I don't know how acceptable it is
> > to introduce new dep loops like this.
>
> what happens without your change ?

Someone reported an issue in https://bugs.gentoo.org/720948 that
showed shadow and groups are not ordered during installation.  I am
not sure what environment produced those symptoms since I never
encountered it, but you can rage-clean shadow and a group, delete the
group, then reinstall it to reproduce the problem.

Thanks.

David



[gentoo-dev] Re: [PATCH 1/2] acct-group.eclass: declare the missing dependency on shadow

2020-09-08 Thread David Michael
Hi,

This fix might not be so straightforward.  A configuration I tested
hit a dependency loop with shadow -> pambase -> systemd -> a bunch of
groups -> shadow.  It is possible to bootstrap around by emerging
shadow with no USE flags first, but I don't know how acceptable it is
to introduce new dep loops like this.

Thanks.

David



Re: [gentoo-dev] [PATCH 1/2] acct-group.eclass: declare the missing dependency on shadow

2020-09-08 Thread David Michael
On Tue, Sep 8, 2020 at 12:04 PM Michał Górny  wrote:
> On Tue, 2020-09-08 at 11:57 -0400, David Michael wrote:
> > Signed-off-by: David Michael 
> > ---
> >  eclass/acct-group.eclass | 6 +-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
> > index 19a378e0b06..56e6391ef42 100644
> > --- a/eclass/acct-group.eclass
> > +++ b/eclass/acct-group.eclass
> > @@ -34,8 +34,12 @@
> >  if [[ -z ${_ACCT_GROUP_ECLASS} ]]; then
> >  _ACCT_GROUP_ECLASS=1
> >
> > +# The groupadd utility is called in pkg_preinst.  It should be in IDEPEND.
> >  case ${EAPI:-0} in
> > - 7) ;;
> > + 7)
> > + BDEPEND="userland_GNU? ( sys-apps/shadow )"
>
> Nothing from shadow is used in src_install, so this BDEPEND is
> unnecessary.

It is a workaround for EAPI 7's lack of IDEPEND to attempt to handle
cross-compiling, where RDEPEND alone would never attempt to install
the package in the native root.  Other packages and eclasses have been
using this convention for the same reason (Emacs, fcaps.eclass, etc.).

Thanks.

David



[gentoo-dev] [PATCH 2/2] acct-user.eclass: declare the missing dependency on shadow

2020-09-08 Thread David Michael
Signed-off-by: David Michael 
---
 eclass/acct-user.eclass | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/acct-user.eclass b/eclass/acct-user.eclass
index 56a4e83e8bf..96a076e106e 100644
--- a/eclass/acct-user.eclass
+++ b/eclass/acct-user.eclass
@@ -42,8 +42,12 @@
 if [[ -z ${_ACCT_USER_ECLASS} ]]; then
 _ACCT_USER_ECLASS=1
 
+# The useradd utility is called in pkg_preinst.  It should be in IDEPEND.
 case ${EAPI:-0} in
-   7) ;;
+   7)
+   BDEPEND="userland_GNU? ( sys-apps/shadow )"
+   RDEPEND="${BDEPEND}"
+   ;;
*) die "EAPI=${EAPI:-0} not supported";;
 esac
 
-- 
2.26.2




[gentoo-dev] [PATCH 1/2] acct-group.eclass: declare the missing dependency on shadow

2020-09-08 Thread David Michael
Signed-off-by: David Michael 
---
 eclass/acct-group.eclass | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/acct-group.eclass b/eclass/acct-group.eclass
index 19a378e0b06..56e6391ef42 100644
--- a/eclass/acct-group.eclass
+++ b/eclass/acct-group.eclass
@@ -34,8 +34,12 @@
 if [[ -z ${_ACCT_GROUP_ECLASS} ]]; then
 _ACCT_GROUP_ECLASS=1
 
+# The groupadd utility is called in pkg_preinst.  It should be in IDEPEND.
 case ${EAPI:-0} in
-   7) ;;
+   7)
+   BDEPEND="userland_GNU? ( sys-apps/shadow )"
+   RDEPEND="${BDEPEND}"
+   ;;
*) die "EAPI=${EAPI:-0} not supported";;
 esac
 
-- 
2.26.2




[gentoo-dev] [PATCH] rust-toolchain.eclass: support bootstrapping armv5te

2020-07-11 Thread David Michael
This adds support for using system-bootstrap to build Rust for the
armv5tel profile.  It does not add binary bootstrap compilers.

Signed-off-by: David Michael 
---

Hi,

I have an ARM9 chip that I'd like to be able to target for Rust
packages.  Things are getting masked in the armv5tel profile due to it
not having Rust binaries.  Can we start fixing this?

I've bootstrapped armv5te Rust by cross-compiling it, and it seems to
work.  I can send my ebuild changes if anyone wants to build their own
armv5te compiler, but the eclass should at least define its default
builtin target so that it can be built with USE=system-bootstrap.

Thanks.

David

 eclass/rust-toolchain.eclass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/eclass/rust-toolchain.eclass b/eclass/rust-toolchain.eclass
index 9d7360ed1c4..9ae4ad93945 100644
--- a/eclass/rust-toolchain.eclass
+++ b/eclass/rust-toolchain.eclass
@@ -41,6 +41,7 @@ rust_abi() {
powerpc64*)   echo powerpc64-unknown-linux-gnu;;
x86_64*gnu)   echo x86_64-unknown-linux-gnu;;
x86_64*musl)  echo x86_64-unknown-linux-musl;;
+   armv5te*) echo armv5te-unknown-linux-gnueabi;;
armv6j*s*)echo arm-unknown-linux-gnueabi;;
armv6j*h*)echo arm-unknown-linux-gnueabihf;;
armv7a*h*)echo armv7-unknown-linux-gnueabihf;;
-- 
2.26.2




Re: [gentoo-dev] user.eclass ignores ROOT/SYSROOT

2020-05-05 Thread David Michael
On Tue, May 5, 2020 at 4:22 PM Peter Stuge  wrote:
> Hi,
>
> I'm trying something out over here and I'm surprised to find that
> acct-group/* do not work with ROOT+SYSROOT != "/".
>
> Should I file yet another bug about this?
>
> I suppose the limitation is in user.eclass, but what about the 11 bugs
> already filed about exactly this problem?
>
> They are easy to see in the dup bug list at https://bugs.gentoo.org/53269
>
> Unfortunately mgorny closed 53269 WONTFIX because GLEP-27 is Deferred,
> causing all dup and dep bugs to be forgotten. Sad panda.
>
> --8<-- reproduce
> # export r=$(mktemp -d)
> # ROOT=$r SYSROOT=$r strace -fe execve emerge baselayout acct-group/ftp 2>&1 
> | grep groupadd
> [pid 13269] execve("/usr/sbin/groupadd", ["groupadd", "-r", "-g", "21", 
> "ftp"], 0x5d7e299e2340 /* 227 vars */) = 0
> groupadd: cannot lock /etc/group; try again later.
>  *   groupadd -r ${opts} "${egroup}" || die
>  *   groupadd -r ${opts} "${egroup}" || die
> -->8--
>
> In my particular case -R $r would work just fine, but as can be seen
> in several of those 11 dup bugs it is not a general solution.
>
> Any ideas on how to solve this?

I know it's not a general fix, but my solution for building a separate
systemd root was to use sysusers.  You could try the eclass patch(es)
at https://bugs.gentoo.org/702624 if you're using at least systemd
245.  (Older versions work if you apply the upstream commit linked in
the bug.)  If you're running a systemd host with a non-systemd target,
you can still probably run "systemd-sysusers --root=$ROOT" after
emerge to generate the accounts that way.

Thanks.

David



[gentoo-dev] Re: [PATCH] rpm.eclass: use BDEPEND for EAPI 7

2020-04-20 Thread David Michael
On Sat, Apr 18, 2020 at 11:15 AM David Michael  wrote:
> The build system's rpm2tar command is executed during unpack, so it
> must be install in /.
>
> Signed-off-by: David Michael 
> ---
>
> This patch fixes failures like this:
> >>> Unpacking source...
> >>> Unpacking urw-fonts-2.4-9.fc13.src.rpm to 
> /var/tmp/portage/media-fonts/urw-fonts-2.4.9/work
> /var/tmp/portage/media-fonts/urw-fonts-2.4.9/temp/environment: line 850: 
> rpm2tar: command not found
>
>  eclass/rpm.eclass | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/eclass/rpm.eclass b/eclass/rpm.eclass
> index 3a29c7e9f76..d27f0a386c7 100644
> --- a/eclass/rpm.eclass
> +++ b/eclass/rpm.eclass
> @@ -8,7 +8,10 @@
>
>  inherit estack eutils
>
> -DEPEND=">=app-arch/rpm2targz-9.0.0.3g"
> +case "${EAPI:-0}" in
> +   [0-6]) DEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
> +   *) BDEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
> +esac
>
>  # @FUNCTION: rpm_unpack
>  # @USAGE: 
> --
> 2.21.1

Can someone apply this?



[gentoo-dev] [PATCH] rpm.eclass: use BDEPEND for EAPI 7

2020-04-18 Thread David Michael
The build system's rpm2tar command is executed during unpack, so it
must be install in /.

Signed-off-by: David Michael 
---

This patch fixes failures like this:
>>> Unpacking source...
>>> Unpacking urw-fonts-2.4-9.fc13.src.rpm to 
/var/tmp/portage/media-fonts/urw-fonts-2.4.9/work
/var/tmp/portage/media-fonts/urw-fonts-2.4.9/temp/environment: line 850: 
rpm2tar: command not found

 eclass/rpm.eclass | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/eclass/rpm.eclass b/eclass/rpm.eclass
index 3a29c7e9f76..d27f0a386c7 100644
--- a/eclass/rpm.eclass
+++ b/eclass/rpm.eclass
@@ -8,7 +8,10 @@
 
 inherit estack eutils
 
-DEPEND=">=app-arch/rpm2targz-9.0.0.3g"
+case "${EAPI:-0}" in
+   [0-6]) DEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
+   *) BDEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
+esac
 
 # @FUNCTION: rpm_unpack
 # @USAGE: 
-- 
2.21.1



Re: [gentoo-dev] [PATCH] fcaps.eclass: Remove sys-libs/libcap-ng support

2020-04-15 Thread David Michael
On Tue, Apr 14, 2020 at 10:32 PM Matt Turner  wrote:
> At the same time, fix the dependency on sys-libs/libcap by  moving it to
> RDEPEND, as dependencies in DEPEND/BDEPEND are not guaranteed to exist
> during pkg_postinst() when this eclass is intended to run.

The BDEPEND was added for https://bugs.gentoo.org/700018 , which is
still needed so the command is in / during sysroot builds, or
installing fails.  Maybe deps could be:

EAPI < 7: RDEPEND
EAPI = 7: RDEPEND + BDEPEND
EAPI > 7: IDEPEND

Thanks.

David



Re: [gentoo-dev] [PATCH] qt5-build.eclass: support sysroot builds

2020-03-27 Thread David Michael
On Fri, Mar 27, 2020 at 4:49 PM James Le Cuirot  wrote:
> On Fri, 27 Mar 2020 13:10:34 -0400
> David Michael  wrote:
>
> > I'd like to be able to install qt5 packages in a sysroot for staging,
> > and this is an initial patch for it.  The pkg-config variables might not
> > be required, but it seemed appropriate to pass the sysroot-configured
> > versions through the build.  There are a few caveats:
> >
> >   - The upstream configure scripts do some bad things like this:
> > https://code.qt.io/cgit/qt/qtbase.git/tree/configure.pri#n363
> > That makes the build fail for systems using lib64 (e.g. amd64).  I'm
> > able to work around this by defining PKG_CONFIG_LIBDIR for dev-qt/*.
>
> Indeed, that sucks. We should probably patch that out. I don't know
> what it means where it says "or use -pkg-config to override this test",
> do you?

I'm not sure, since -pkg-config is already being used by the eclass.
Maybe it was supposed to reference the -force-pkg-config option, which
I haven't tried.

> I suspect you could define PKG_CONFIG_LIBDIR=/ or anywhere that
> simply exists and it will still work because our wrapper redefines that
> variable anyway.
>
> >   - This isn't for real cross-compiling.  There are places where it
> > tries to execute cross-compiled programs that I haven't investigated
> > yet, so this is only for building a sysroot for an architecture
> > compatible with the build system for now.
>
> Understood. I did try to do cross-compiling with Qt4 once upon a time
> and I did make a little headway but it wasn't fun.
>
> >   - The qt packages depend on each other being installed in / as well as
> > the sysroot, so their ebuilds will need BDEPENDs added.
>
> I imagine you'd at least need qtcore for qmake and moc. Probably not
> the rest though?

I needed qtcore, qtgui, and qtwidgets in /, but it's possible there
are just bad configure scripts that I didn't dig into yet.  As for VLC
deps:
  - qtcore works as is
  - qtgui requires qtcore for bootstrap-private in /
  - qtwidgets requires qtgui in / for some opengl check
  - qtsvg and qtx11extras need qmake to build, but their packages will
be empty unless qtwidgets is installed in /

> >   - I've only gotten to testing a few packages that are dependencies of
> > other applications (like VLC), so I may be missing breakages.
> >
> > The patch basically just sets -sysroot when $SYSROOT is defined.  It
> > also needs to set -extprefix to the normal prefix, since otherwise it
> > would default to installing into /sysroot/prefix.  Is anyone involved in
> > qt maintenance more experienced with this and able to comment?
>
> I'm not the Qt guy but I am the cross guy. I'm not in a position to
> test this right now but it looks good and I love the simplicity of it.
> It's a hell of a lot simpler than Qt4 was. To be honest, we should be
> setting QMAKE_PKG_CONFIG regardless.



[gentoo-dev] [PATCH] qt5-build.eclass: support sysroot builds

2020-03-27 Thread David Michael
Signed-off-by: David Michael 
---

Hi,

I'd like to be able to install qt5 packages in a sysroot for staging,
and this is an initial patch for it.  The pkg-config variables might not
be required, but it seemed appropriate to pass the sysroot-configured
versions through the build.  There are a few caveats:

  - The upstream configure scripts do some bad things like this:
https://code.qt.io/cgit/qt/qtbase.git/tree/configure.pri#n363
That makes the build fail for systems using lib64 (e.g. amd64).  I'm
able to work around this by defining PKG_CONFIG_LIBDIR for dev-qt/*.

  - This isn't for real cross-compiling.  There are places where it
tries to execute cross-compiled programs that I haven't investigated
yet, so this is only for building a sysroot for an architecture
compatible with the build system for now.

  - The qt packages depend on each other being installed in / as well as
the sysroot, so their ebuilds will need BDEPENDs added.

  - I've only gotten to testing a few packages that are dependencies of
other applications (like VLC), so I may be missing breakages.

The patch basically just sets -sysroot when $SYSROOT is defined.  It
also needs to set -extprefix to the normal prefix, since otherwise it
would default to installing into /sysroot/prefix.  Is anyone involved in
qt maintenance more experienced with this and able to comment?

Thanks.

David

 eclass/qt5-build.eclass | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass
index 70e9be80c98..7fe39e6a23b 100644
--- a/eclass/qt5-build.eclass
+++ b/eclass/qt5-build.eclass
@@ -479,7 +479,7 @@ qt5_symlink_tools_to_build_dir() {
 # Runs ./configure for modules belonging to qtbase.
 qt5_base_configure() {
# setup toolchain variables used by configure
-   tc-export AR CC CXX OBJDUMP RANLIB STRIP
+   tc-export AR CC CXX OBJDUMP PKG_CONFIG RANLIB STRIP
export LD="$(tc-getCXX)"
 
# bug 633838
@@ -487,6 +487,8 @@ qt5_base_configure() {
 
# configure arguments
local conf=(
+   ${SYSROOT:+-extprefix "${QT5_PREFIX}" -sysroot "${SYSROOT}"}
+
# installation paths
-prefix "${QT5_PREFIX}"
-bindir "${QT5_BINDIR}"
@@ -677,6 +679,7 @@ qt5_qmake_args() {
QMAKE_LINK=\"$(tc-getCXX)\" \
QMAKE_LINK_SHLIB=\"$(tc-getCXX)\" \
QMAKE_OBJCOPY=\"$(tc-getOBJCOPY)\" \
+   QMAKE_PKG_CONFIG=\"$(tc-getPKG_CONFIG)\" \
QMAKE_RANLIB= \
QMAKE_STRIP=\"$(tc-getSTRIP)\" \
QMAKE_CFLAGS=\"${CFLAGS}\" \
@@ -716,6 +719,7 @@ qt5_qmake() {
QMAKE_LINK="$(tc-getCXX)" \
QMAKE_LINK_SHLIB="$(tc-getCXX)" \
QMAKE_OBJCOPY="$(tc-getOBJCOPY)" \
+   QMAKE_PKG_CONFIG="$(tc-getPKG_CONFIG)" \
QMAKE_RANLIB= \
QMAKE_STRIP="$(tc-getSTRIP)" \
QMAKE_CFLAGS="${CFLAGS}" \
-- 
2.21.1




[gentoo-dev] Re: [PATCH v2] fixheadtails.eclass: drop the sed dependency

2020-03-25 Thread David Michael
On Fri, Mar 20, 2020 at 5:12 PM David Michael  wrote:
> Signed-off-by: David Michael 
> ---
>
> Changes since v1:
>   * Drop the dependency altogether
>
>  eclass/fixheadtails.eclass | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/eclass/fixheadtails.eclass b/eclass/fixheadtails.eclass
> index c19d33924aa..475b182843a 100644
> --- a/eclass/fixheadtails.eclass
> +++ b/eclass/fixheadtails.eclass
> @@ -1,4 +1,4 @@
> -# Copyright 1999-2014 Gentoo Foundation
> +# Copyright 1999-2020 Gentoo Authors
>  # Distributed under the terms of the GNU General Public License v2
>
>  # @ECLASS: fixheadtails.eclass
> @@ -8,8 +8,6 @@
>  # Original author John Mylchreest 
>  # @BLURB: functions to replace obsolete head/tail with POSIX compliant ones
>
> -DEPEND=">=sys-apps/sed-4"
> -
>  _do_sed_fix() {
> einfo " - fixed $1"
> sed -i \
> --
> 2.21.1

Can this patch be applied?

Thanks.

David



[gentoo-dev] [PATCH v2] fixheadtails.eclass: drop the sed dependency

2020-03-20 Thread David Michael
Signed-off-by: David Michael 
---

Changes since v1:
  * Drop the dependency altogether

 eclass/fixheadtails.eclass | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/eclass/fixheadtails.eclass b/eclass/fixheadtails.eclass
index c19d33924aa..475b182843a 100644
--- a/eclass/fixheadtails.eclass
+++ b/eclass/fixheadtails.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: fixheadtails.eclass
@@ -8,8 +8,6 @@
 # Original author John Mylchreest 
 # @BLURB: functions to replace obsolete head/tail with POSIX compliant ones
 
-DEPEND=">=sys-apps/sed-4"
-
 _do_sed_fix() {
einfo " - fixed $1"
sed -i \
-- 
2.21.1




[gentoo-dev] [PATCH] fixheadtails.eclass: move sed to BDEPEND for EAPI 7

2020-03-20 Thread David Michael
It executes sed at build time, so it should be installed in /.

Signed-off-by: David Michael 
---

Hi,

Here is another simple dependency move to put a required program in the
correct ROOT so it can be executed during the build.  It's basically the
same as 814ab1294edf3565fc02fe63d15d6fa7ca886429.

Thanks.

David

 eclass/fixheadtails.eclass | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/eclass/fixheadtails.eclass b/eclass/fixheadtails.eclass
index c19d33924aa..5d221ca678c 100644
--- a/eclass/fixheadtails.eclass
+++ b/eclass/fixheadtails.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: fixheadtails.eclass
@@ -8,7 +8,10 @@
 # Original author John Mylchreest 
 # @BLURB: functions to replace obsolete head/tail with POSIX compliant ones
 
-DEPEND=">=sys-apps/sed-4"
+case "${EAPI:-0}" in
+   [0-6]) DEPEND=">=sys-apps/sed-4" ;;
+   *) BDEPEND=">=sys-apps/sed-4" ;;
+esac
 
 _do_sed_fix() {
einfo " - fixed $1"
-- 
2.21.1




[gentoo-dev] [PATCH v2] fcaps.eclass: use BDEPEND for EAPI 7

2020-03-13 Thread David Michael
The eclass installs libcap to execute the setcap program, so it
must be installed in /.  Optional libcap linking is handled by the
USE=caps flag, which is unrelated to this eclass, so the DEPEND
declaration is not needed on EAPI 7.

Closes: https://bugs.gentoo.org/700018
Signed-off-by: David Michael 
---

Changes since v1:
  * Inverted patterns so EAPI 7+ is the default.

 eclass/fcaps.eclass | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/eclass/fcaps.eclass b/eclass/fcaps.eclass
index 467f955f5e9..2b6e5be4683 100644
--- a/eclass/fcaps.eclass
+++ b/eclass/fcaps.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: fcaps.eclass
@@ -34,7 +34,10 @@ _FCAPS_ECLASS=1
 IUSE="+filecaps"
 
 # We can't use libcap-ng atm due to #471414.
-DEPEND="filecaps? ( sys-libs/libcap )"
+case "${EAPI:-0}" in
+   [0-6]) DEPEND="filecaps? ( sys-libs/libcap )" ;;
+   *) BDEPEND="filecaps? ( sys-libs/libcap )" ;;
+esac
 
 # @ECLASS-VARIABLE: FILECAPS
 # @DEFAULT_UNSET
-- 
2.21.1




[gentoo-dev] [PATCH] autotools.eclass: reorder sysroot M4 include dir option

2020-03-13 Thread David Michael
The old autoconf-2.13 version requires options to be specified
before the file name argument, so packages with WANT_AUTOCONF="2.1"
would fail to build in a sysroot with the -l option at the end.

Closes: https://bugs.gentoo.org/710792
Signed-off-by: David Michael 
---
 eclass/autotools.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index 9df0e1b9366..625abd0e9d1 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: autotools.eclass
@@ -512,7 +512,7 @@ autotools_run_tool() {
fi
 
if ${m4flags} ; then
-   set -- "${1}" $(autotools_m4dir_include) "${@:2}" 
$(autotools_m4sysdir_include)
+   set -- "${1}" $(autotools_m4dir_include) 
$(autotools_m4sysdir_include) "${@:2}"
fi
 
# If the caller wants to probe something, then let them do it directly.
-- 
2.21.1




[gentoo-dev] [PATCH] fcaps.eclass: use BDEPEND for EAPI 7

2020-03-13 Thread David Michael
The eclass installs libcap to execute the setcap program, so it
must be installed in /.  Optional libcap linking is handled by the
USE=caps flag, which is unrelated to this eclass, so the DEPEND
declaration is not needed on EAPI 7.

Closes: https://bugs.gentoo.org/700018
Signed-off-by: David Michael 
---
 eclass/fcaps.eclass | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/eclass/fcaps.eclass b/eclass/fcaps.eclass
index 467f955f5e9..b0479f32456 100644
--- a/eclass/fcaps.eclass
+++ b/eclass/fcaps.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: fcaps.eclass
@@ -34,7 +34,10 @@ _FCAPS_ECLASS=1
 IUSE="+filecaps"
 
 # We can't use libcap-ng atm due to #471414.
-DEPEND="filecaps? ( sys-libs/libcap )"
+case "${EAPI:-0}" in
+   7) BDEPEND="filecaps? ( sys-libs/libcap )" ;;
+   *) DEPEND="filecaps? ( sys-libs/libcap )" ;;
+esac
 
 # @ECLASS-VARIABLE: FILECAPS
 # @DEFAULT_UNSET
-- 
2.21.1