mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-20 04:23:16 -04:00
databases.eclass: add "required use" stuff
Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
#
|
#
|
||||||
# @SUBSECTION Helper usage
|
# @SUBSECTION Helper usage
|
||||||
#
|
#
|
||||||
# --die [msg...]
|
# --die [msg]
|
||||||
#
|
#
|
||||||
# Prints the path to the server's log file to the console and aborts the
|
# Prints the path to the server's log file to the console and aborts the
|
||||||
# current merge process with the given message.
|
# current merge process with the given message.
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#
|
#
|
||||||
# Returns the directory where the server stores database files.
|
# Returns the directory where the server stores database files.
|
||||||
#
|
#
|
||||||
# --get-depend
|
# --get-depend [use1,use2,...]
|
||||||
#
|
#
|
||||||
# Returns a dependency string (to be included in BDEPEND).
|
# Returns a dependency string (to be included in BDEPEND).
|
||||||
#
|
#
|
||||||
@@ -104,31 +104,41 @@ _DATABASES_ECLASS=1
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# @FUNCTION: _databases_gen_depend
|
# @FUNCTION: _databases_gen_depend
|
||||||
# @USAGE: <funcname>
|
# @USAGE: <funcname> <required use>
|
||||||
# @INTERNAL
|
# @INTERNAL
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# Get a dependency string for the given helper function.
|
# Get a dependency string for the given helper function.
|
||||||
_databases_gen_depend() {
|
_databases_gen_depend() {
|
||||||
local srvname=${1:1}
|
local srvname=${1:1}
|
||||||
|
local req_use=${2}
|
||||||
|
|
||||||
|
local pkg_dep
|
||||||
case ${srvname} in
|
case ${srvname} in
|
||||||
memcached)
|
memcached)
|
||||||
echo "net-misc/memcached"
|
pkg_dep="net-misc/memcached"
|
||||||
;;
|
;;
|
||||||
mongod)
|
mongod)
|
||||||
echo "dev-db/mongodb"
|
pkg_dep="dev-db/mongodb"
|
||||||
;;
|
;;
|
||||||
mysql)
|
mysql)
|
||||||
echo "virtual/mysql[server]"
|
pkg_dep="virtual/mysql"
|
||||||
|
req_use="server,${req_use}"
|
||||||
;;
|
;;
|
||||||
postgres)
|
postgres)
|
||||||
echo "dev-db/postgresql[server]"
|
pkg_dep="dev-db/postgresql"
|
||||||
|
req_use="server,${req_use}"
|
||||||
;;
|
;;
|
||||||
redis)
|
redis)
|
||||||
echo "dev-db/redis"
|
pkg_dep="dev-db/redis"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "${ECLASS}: unknown database: ${srvname}"
|
die "${ECLASS}: unknown database: ${srvname}"
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
req_use=${req_use%,} # strip trailing comma
|
||||||
|
printf "%s" "${pkg_dep}"
|
||||||
|
[[ ${req_use} ]] && \
|
||||||
|
printf "[%s]" "${req_use}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# @FUNCTION: _databases_die
|
# @FUNCTION: _databases_die
|
||||||
@@ -189,7 +199,7 @@ _databases_dispatch() {
|
|||||||
_databases_die ${funcname} "${@}"
|
_databases_die ${funcname} "${@}"
|
||||||
;;
|
;;
|
||||||
--get-depend)
|
--get-depend)
|
||||||
_databases_gen_depend ${funcname}
|
_databases_gen_depend ${funcname} "${@}"
|
||||||
;;
|
;;
|
||||||
--get-dbpath)
|
--get-dbpath)
|
||||||
echo "${T}"/${funcname}/db/
|
echo "${T}"/${funcname}/db/
|
||||||
|
|||||||
Reference in New Issue
Block a user