1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 # @ECLASS: kde.org.eclass
8 # @BLURB: Support eclass for packages that are hosted on kde.org infrastructure.
10 # This eclass is mainly providing facilities for the upstream release groups
11 # Frameworks, Plasma, Applications to assemble default SRC_URI for tarballs,
12 # set up git-r3.eclass for stable/master branch versions or restrict access to
13 # unreleased (packager access only) tarballs in Gentoo KDE overlay, but it may
14 # be also used by any other package hosted on kde.org.
15 # It also contains default meta variables for settings not specific to any
16 # particular build system.
18 if [[ -z ${_KDE_ORG_ECLASS} ]]; then
21 # @ECLASS-VARIABLE: KDE_BUILD_TYPE
23 # If PV matches "*9999*", this is automatically set to "live".
24 # Otherwise, this is automatically set to "release".
25 KDE_BUILD_TYPE="release"
26 if [[ ${PV} = *9999* ]]; then
31 if [[ ${KDE_BUILD_TYPE} = live ]]; then
35 EXPORT_FUNCTIONS pkg_nofetch src_unpack
37 # @ECLASS-VARIABLE: KDE_ORG_NAME
39 # If unset, default value is set to ${PN}.
40 # Name of the package as hosted on kde.org mirrors.
41 : ${KDE_ORG_NAME:=$PN}
43 # @ECLASS-VARIABLE: KDE_RELEASE_SERVICE
45 # If set to "false", do nothing.
46 # If set to "true", set SRC_URI accordingly and apply KDE_UNRELEASED.
47 : ${KDE_RELEASE_SERVICE:=false}
49 # @ECLASS-VARIABLE: KDE_SELINUX_MODULE
51 # If set to "none", do nothing.
52 # For any other value, add selinux to IUSE, and depending on that useflag
53 # add a dependency on sec-policy/selinux-${KDE_SELINUX_MODULE} to (R)DEPEND.
54 : ${KDE_SELINUX_MODULE:=none}
56 case ${KDE_SELINUX_MODULE} in
60 RDEPEND+=" selinux? ( sec-policy/selinux-${KDE_SELINUX_MODULE} )"
64 # @ECLASS-VARIABLE: KDE_UNRELEASED
67 # An array of $CATEGORY-$PV pairs of packages that are unreleased upstream.
68 # Any package matching this will have fetch restriction enabled, and receive
69 # a proper error message via pkg_nofetch.
72 HOMEPAGE="https://kde.org/"
76 KDE_RELEASE_SERVICE=true
79 HOMEPAGE="https://kde.org/plasma-desktop"
82 HOMEPAGE="https://kde.org/products/frameworks/"
84 [[ ${KDE_BUILD_TYPE} = release ]] && SLOT=$(ver_cut 1)/$(ver_cut 1-2)
89 _kde.org_is_unreleased() {
91 for pair in "${KDE_UNRELEASED[@]}" ; do
92 if [[ "${pair}" = "${CATEGORY}-${PV}" ]]; then
94 elif [[ ${KDE_RELEASE_SERVICE} = true ]]; then
95 if [[ "${pair/kde-apps/${CATEGORY}}" = "${CATEGORY}-${PV}" ]]; then
104 # Determine fetch location for released tarballs
105 _kde.org_calculate_src_uri() {
106 debug-print-function ${FUNCNAME} "$@"
108 local _src_uri="mirror://kde/"
110 if [[ ${KDE_RELEASE_SERVICE} = true ]]; then
113 _src_uri+="unstable/release-service/${PV}/src/"
116 *) _src_uri+="stable/release-service/${PV}/src/" ;;
122 _src_uri+="stable/frameworks/$(ver_cut 1-2)/"
132 _src_uri+="portingAids/"
139 _src_uri+="unstable/plasma/$(ver_cut 1-3)/"
142 *) _src_uri+="stable/plasma/$(ver_cut 1-3)/" ;;
147 if [[ ${PN} = kdevelop* ]]; then
150 _src_uri+="unstable/kdevelop/${PV}/src/"
153 *) _src_uri+="stable/kdevelop/${PV}/src/" ;;
157 SRC_URI="${_src_uri}${KDE_ORG_NAME}-${PV}.tar.xz"
159 if _kde.org_is_unreleased ; then
164 # Determine fetch location for live sources
165 _kde.org_calculate_live_repo() {
166 debug-print-function ${FUNCNAME} "$@"
170 # @ECLASS-VARIABLE: EGIT_MIRROR
172 # This variable allows easy overriding of default kde mirror service
173 # (anongit) with anything else you might want to use.
174 EGIT_MIRROR=${EGIT_MIRROR:=https://anongit.kde.org}
176 if [[ ${PV} == ??.??.49.9999 && ${KDE_RELEASE_SERVICE} = true ]]; then
177 EGIT_BRANCH="release/$(ver_cut 1-2)"
180 if [[ ${PV} != 9999 && ${CATEGORY} = kde-plasma ]]; then
181 EGIT_BRANCH="Plasma/$(ver_cut 1-2)"
184 if [[ ${PV} != 9999 && ${PN} = kdevelop* ]]; then
185 EGIT_BRANCH="$(ver_cut 1-2)"
188 # @ECLASS-VARIABLE: EGIT_REPONAME
190 # This variable allows overriding of default repository
191 # name. Specify only if this differs from PN and KDE_ORG_NAME.
192 EGIT_REPO_URI="${EGIT_MIRROR}/${EGIT_REPONAME:=$KDE_ORG_NAME}"
195 case ${KDE_BUILD_TYPE} in
196 live) _kde.org_calculate_live_repo ;;
198 _kde.org_calculate_src_uri
199 debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
204 if [[ ${KDE_BUILD_TYPE} = release ]]; then
205 S=${WORKDIR}/${KDE_ORG_NAME}-${PV}
208 # @FUNCTION: kde.org_pkg_nofetch
210 # Intended for use in the KDE overlay. If this package matches something in
211 # KDE_UNRELEASED, display a giant warning that the package has not yet been
212 # released upstream and should not be used.
213 kde.org_pkg_nofetch() {
214 if ! _kde.org_is_unreleased ; then
218 local sched_uri="https://community.kde.org/Schedules"
220 kde-frameworks) sched_uri+="/Frameworks" ;;
221 kde-plasma) sched_uri+="/Plasma_5" ;;
222 kde-apps) sched_uri+="/Applications/$(ver_cut 1-2)_Release_Schedule" ;;
225 eerror " _ _ _ _ ____ _____ _ _____ _ ____ _____ ____ "
226 eerror "| | | | \ | | _ \| ____| | | ____| / \ / ___|| ____| _ \ "
227 eerror "| | | | \| | |_) | _| | | | _| / _ \ \___ \| _| | | | |"
228 eerror "| |_| | |\ | _ <| |___| |___| |___ / ___ \ ___) | |___| |_| |"
229 eerror " \___/|_| \_|_| \_\_____|_____|_____/_/ \_\____/|_____|____/ "
231 eerror " ____ _ ____ _ __ _ ____ _____ "
232 eerror "| _ \ / \ / ___| |/ / / \ / ___| ____|"
233 eerror "| |_) / _ \| | | ' / / _ \| | _| _| "
234 eerror "| __/ ___ \ |___| . \ / ___ \ |_| | |___ "
235 eerror "|_| /_/ \_\____|_|\_\/_/ \_\____|_____|"
237 eerror "${CATEGORY}/${P} has not been released to the public yet"
238 eerror "and is only available to packagers right now."
240 eerror "This is not a bug. Please do not file bugs or contact upstream about this."
242 eerror "Please consult the upstream release schedule to see when this "
243 eerror "package is scheduled to be released:"
244 eerror "${sched_uri}"
247 # @FUNCTION: kde.org_src_unpack
249 # Unpack the sources, automatically handling both release and live ebuilds.
250 kde.org_src_unpack() {
251 debug-print-function ${FUNCNAME} "$@"
253 case ${KDE_BUILD_TYPE} in
254 live) git-r3_src_unpack ;&