eclass/bintron.eclass: fix bintron_src_prepare; format

Signed-off-by: Maciej Barć <xgqt@riseup.net>
This commit is contained in:
Maciej Barć 2021-11-17 13:26:38 +01:00
parent c9f0c885ed
commit cb953eeba5
No known key found for this signature in database
GPG Key ID: 031C9FE65BED714A

View File

@ -1,7 +1,6 @@
# Copyright 1999-2021 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# @ECLASS: bintron.eclass # @ECLASS: bintron.eclass
# @MAINTAINER: # @MAINTAINER:
# src_prepare group # src_prepare group
@ -14,16 +13,10 @@
# shellcheck shell=bash disable=2034 # shellcheck shell=bash disable=2034
# Inherits
inherit optfeature xdg inherit optfeature xdg
case "${EAPI}" case "${EAPI}"
in in
[0-6] )
die "EAPI: ${EAPI} too old"
;;
[7-8] ) [7-8] )
true true
;; ;;
@ -32,20 +25,10 @@ in
;; ;;
esac esac
EXPORT_FUNCTIONS src_prepare src_compile src_install pkg_postinst
# Exported functions
export_functions=(
src_prepare
src_compile
src_install
pkg_postinst
)
EXPORT_FUNCTIONS "${export_functions[@]}"
RESTRICT+=" bindist mirror " RESTRICT+=" bindist mirror "
_BINTRON_LANGS=" _BINTRON_LANGS="
am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he
hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr
@ -57,7 +40,6 @@ _BINTRON_LANGS="
# List of language packs available for this package. # List of language packs available for this package.
: ${BINTRON_LANGS:=${_BINTRON_LANGS}} : ${BINTRON_LANGS:=${_BINTRON_LANGS}}
# Adapted from chromium-2.eclass # Adapted from chromium-2.eclass
# @FUNCTION: _bintron_set_l10n_IUSE # @FUNCTION: _bintron_set_l10n_IUSE
@ -80,7 +62,6 @@ if [[ ${BINTRON_LANGS} ]]; then
_bintron_set_l10n_IUSE _bintron_set_l10n_IUSE
fi fi
BINTRON_DEPEND=" BINTRON_DEPEND="
>=app-accessibility/at-spi2-atk-2.26:2 >=app-accessibility/at-spi2-atk-2.26:2
>=app-accessibility/at-spi2-core-2.26:2 >=app-accessibility/at-spi2-core-2.26:2
@ -118,19 +99,16 @@ RDEPEND+="${BINTRON_DEPEND}"
IUSE+=" +system-ffmpeg +system-vulkan " IUSE+=" +system-ffmpeg +system-vulkan "
# The package will be already compiled, # The package will be already compiled,
# also most likely the package will be pre-stripped too. # also most likely the package will be pre-stripped too.
QA_PREBUILT='*' QA_PREBUILT='*'
QA_PRESTRIPPED='*' QA_PRESTRIPPED='*'
# @ECLASS-VARIABLE: BINTRON_HOME # @ECLASS-VARIABLE: BINTRON_HOME
# @DESCRIPTION: # @DESCRIPTION:
# Path where the package contents will we installed. # Path where the package contents will we installed.
: ${BINTRON_HOME:="/usr/share/${PN}/"} : ${BINTRON_HOME:="/usr/share/${PN}/"}
# Adapted from chromium-2.eclass # Adapted from chromium-2.eclass
# @FUNCTION: bintron_remove_language_paks # @FUNCTION: bintron_remove_language_paks
@ -139,7 +117,7 @@ QA_PRESTRIPPED='*'
# Removes pak files from the current directory for languages that the user has # Removes pak files from the current directory for languages that the user has
# not selected via the L10N variable. # not selected via the L10N variable.
# Also performs QA checks to ensure BINTRON_LANGS has been set correctly. # Also performs QA checks to ensure BINTRON_LANGS has been set correctly.
function bintron_remove_language_paks() { bintron_remove_language_paks() {
pushd "${1:=.}" >/dev/null || die pushd "${1:=.}" >/dev/null || die
# Look for missing pak files. # Look for missing pak files.
@ -170,11 +148,10 @@ function bintron_remove_language_paks() {
popd >/dev/null || die popd >/dev/null || die
} }
# @FUNCTION: bintron_system_replace # @FUNCTION: bintron_system_replace
# @DESCRIPTION: # @DESCRIPTION:
# Replace bundled libraries with system libraries. # Replace bundled libraries with system libraries.
function bintron_system_replace() { bintron_system_replace() {
pushd "${1:=.}" >/dev/null || die pushd "${1:=.}" >/dev/null || die
if use system-ffmpeg; then if use system-ffmpeg; then
@ -204,53 +181,50 @@ function bintron_system_replace() {
popd >/dev/null || die popd >/dev/null || die
} }
# @FUNCTION: bintron_src_prepare # @FUNCTION: bintron_src_prepare
# @DESCRIPTION: # @DESCRIPTION:
# Default src_prepare. # Default src_prepare.
function bintron_src_prepare() { bintron_src_prepare() {
xdg_src_prepare xdg_environment_reset
default
bintron_remove_language_paks . bintron_remove_language_paks .
bintron_system_replace . bintron_system_replace .
} }
# @FUNCTION: bintron_src_compile # @FUNCTION: bintron_src_compile
# @DESCRIPTION: # @DESCRIPTION:
# Default src_compile. # Default src_compile.
function bintron_src_compile() { bintron_src_compile() {
true true
} }
# @FUNCTION: bintron_install_copy # @FUNCTION: bintron_install_copy
# @DESCRIPTION: # @DESCRIPTION:
# Install all the files in a given directory, or current directory. # Install all the files in a given directory, or current directory.
function bintron_install_copy() { bintron_install_copy() {
local dir="${1:=.}" local dir="${1:=.}"
mkdir -p "${ED}/${BINTRON_HOME}" || die "Failed: mkdir" mkdir -p "${ED}/${BINTRON_HOME}" || die "Failed: mkdir"
cp -r "${dir}"/* "${ED}/${BINTRON_HOME}" || die "Failed: copy $(pwd)" cp -r "${dir}"/* "${ED}/${BINTRON_HOME}" || die "Failed: copy $(pwd)"
} }
# @FUNCTION: bintron_prepare_bin # @FUNCTION: bintron_prepare_bin
# @DESCRIPTION: # @DESCRIPTION:
# Preparation for bintron_link_bin. # Preparation for bintron_link_bin.
# If there is no "bin" directory and a file named "${PN}" exists, # If there is no "bin" directory and a file named "${PN}" exists,
# then create a link from from "bin/${PN}" to "${PN}". # then create a link from from "bin/${PN}" to "${PN}".
function bintron_prepare_bin() { bintron_prepare_bin() {
local dir="${1:=.}" local dir="${1:=.}"
mkdir -p "${dir}"/bin || die mkdir -p "${dir}"/bin || die
ln -s "${dir}"/../${PN} "${dir}"/bin/${PN} || die ln -s "${dir}"/../${PN} "${dir}"/bin/${PN} || die
} }
# @FUNCTION: bintron_link_bin # @FUNCTION: bintron_link_bin
# @DESCRIPTION: # @DESCRIPTION:
# Link launchers in "bin" directory. # Link launchers in "bin" directory.
function bintron_link_bin() { bintron_link_bin() {
local dir="${1:=.}" local dir="${1:=.}"
if [[ -d "${dir}"/bin ]]; then if [[ -d "${dir}"/bin ]]; then
@ -267,11 +241,10 @@ function bintron_link_bin() {
fi fi
} }
# @FUNCTION: bintron_src_install # @FUNCTION: bintron_src_install
# @DESCRIPTION: # @DESCRIPTION:
# Default src_install. # Default src_install.
function bintron_src_install() { bintron_src_install() {
if [[ ! -d ./bin ]] && [[ -f ./${PN} ]]; then if [[ ! -d ./bin ]] && [[ -f ./${PN} ]]; then
bintron_prepare_bin . bintron_prepare_bin .
fi fi
@ -280,11 +253,10 @@ function bintron_src_install() {
bintron_install_copy . bintron_install_copy .
} }
# @FUNCTION: bintron_pkg_postinst # @FUNCTION: bintron_pkg_postinst
# @DESCRIPTION: # @DESCRIPTION:
# Default pkg_postinst. # Default pkg_postinst.
function bintron_pkg_postinst() { bintron_pkg_postinst() {
xdg_pkg_postinst xdg_pkg_postinst
optfeature "password storage" app-crypt/libsecret kde-frameworks/kwallet optfeature "password storage" app-crypt/libsecret kde-frameworks/kwallet
} }