Gentoo Archives: gentoo-dev

From: Andreas Sturmlechner <asturm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH 1/2] kde.org.eclass: New eclass, split from kde5.eclass
Date: Wed, 16 Oct 2019 12:01:35
Message-Id: 2908567.KZJ7x2Zu1G@tuxbrain
In Reply to: Re: [gentoo-dev] [PATCH] font.eclass: Port to EAPI-7 by "Michał Górny"
1 Right now we have kde5.eclass and kde5-functions.eclass, with their structure carried over from kde4*eclass times, but the lines were blurred somewhat when minimum version requirements for the main KDE products were moved into kde5-functions.eclass at some point. Direct usage of kde5-functions.eclass was always minimal and is zero at this point.
2
3 kde5.eclass already has KDE_AUTODEPS variable to enable use of it without inheriting build system and common dependencies (but still inheriting cmake-utils.eclass). The new eclass will start to break up that joint and contain only code to fetch releases or from git for projects hosted on kde.org infrastructure, without making assumptions about a build system, and carry over some general meta variables.
4
5 Going forward, the useful bits that remain from kde5{,-functions}.eclass will be absorbed into a new, more general purpose eclass that aims to be of service to non-KDE packages using ECM (and KDE Frameworks) as well.
6
7 tl;dr:
8 - pkg_nofetch and src_unpack move from kde5.eclass to kde.org.eclass
9 - kde5.eclass inherits kde.org.eclass
10 - ebuilds using kde5.eclass w/ KDE_AUTODEPS=false will only inherit kde.org
11 - more good things to come
12
13
14 --- /dev/null
15 +++ b/eclass/kde.org.eclass
16 @@ -0,0 +1,241 @@
17 +# Copyright 1999-2019 Gentoo Authors
18 +# Distributed under the terms of the GNU General Public License v2
19 +
20 +# @ECLASS: kde.org.eclass
21 +# @MAINTAINER:
22 +# kde@g.o
23 +# @SUPPORTED_EAPIS: 7
24 +# @BLURB: Support eclass for packages that are hosted on kde.org infrastructure.
25 +# @DESCRIPTION:
26 +# This eclass is mainly providing facilities for the upstream release groups
27 +# Frameworks, Plasma, Applications to assemble default SRC_URI for tarballs,
28 +# set up git-r3.eclass for stable/master branch versions or restrict access to
29 +# unreleased (packager access only) tarballs in Gentoo KDE overlay, but it may
30 +# be also used by any other package hosted on kde.org.
31 +# It also contains default meta variables for settings not specific to any
32 +# particular build system.
33 +
34 +if [[ -z ${_KDE_ORG_ECLASS} ]]; then
35 +_KDE_ORG_ECLASS=1
36 +
37 +# @ECLASS-VARIABLE: KDE_BUILD_TYPE
38 +# @DESCRIPTION:
39 +# If PV matches "*9999*", this is automatically set to "live".
40 +# Otherwise, this is automatically set to "release".
41 +KDE_BUILD_TYPE="release"
42 +if [[ ${PV} = *9999* ]]; then
43 + KDE_BUILD_TYPE="live"
44 +fi
45 +export KDE_BUILD_TYPE
46 +
47 +if [[ ${KDE_BUILD_TYPE} = live ]]; then
48 + inherit git-r3
49 +fi
50 +
51 +EXPORT_FUNCTIONS pkg_nofetch src_unpack
52 +
53 +# @ECLASS-VARIABLE: KDE_ORG_NAME
54 +# @DESCRIPTION:
55 +# If unset, default value is set to ${PN}.
56 +# Name of the package as hosted on kde.org mirrors.
57 +: ${KDE_ORG_NAME:=$PN}
58 +
59 +# @ECLASS-VARIABLE: KDE_SELINUX_MODULE
60 +# @DESCRIPTION:
61 +# If set to "none", do nothing.
62 +# For any other value, add selinux to IUSE, and depending on that useflag
63 +# add a dependency on sec-policy/selinux-${KDE_SELINUX_MODULE} to (R)DEPEND.
64 +: ${KDE_SELINUX_MODULE:=none}
65 +
66 +case ${KDE_SELINUX_MODULE} in
67 + none) ;;
68 + *)
69 + IUSE+=" selinux"
70 + RDEPEND+=" selinux? ( sec-policy/selinux-${KDE_SELINUX_MODULE} )"
71 + ;;
72 +esac
73 +
74 +if [[ ${CATEGORY} = kde-frameworks ]]; then
75 + SLOT=5/${PV}
76 + [[ ${KDE_BUILD_TYPE} = release ]] && SLOT=$(ver_cut 1)/$(ver_cut 1-2)
77 +fi
78 +
79 +# @ECLASS-VARIABLE: KDE_UNRELEASED
80 +# @INTERNAL
81 +# @DESCRIPTION
82 +# An array of $CATEGORY-$PV pairs of packages that are unreleased upstream.
83 +# Any package matching this will have fetch restriction enabled, and receive
84 +# a proper error message via pkg_nofetch.
85 +KDE_UNRELEASED=( )
86 +
87 +HOMEPAGE="https://kde.org/"
88 +
89 +_kde_is_unreleased() {
90 + local pair
91 + for pair in "${KDE_UNRELEASED[@]}" ; do
92 + if [[ "${pair}" = "${CATEGORY}-${PV}" ]]; then
93 + return 0
94 + fi
95 + done
96 +
97 + return 1
98 +}
99 +
100 +# Determine fetch location for released tarballs
101 +_calculate_src_uri() {
102 + debug-print-function ${FUNCNAME} "$@"
103 +
104 + local _src_uri="mirror://kde/"
105 +
106 + case ${CATEGORY} in
107 + kde-apps)
108 + case ${PV} in
109 + ??.??.[6-9]? )
110 + _src_uri+="unstable/applications/${PV}/src/"
111 + RESTRICT+=" mirror"
112 + ;;
113 + *) _src_uri+="stable/applications/${PV}/src/" ;;
114 + esac
115 + ;;
116 + kde-frameworks)
117 + _src_uri+="stable/frameworks/$(ver_cut 1-2)/"
118 + case ${PN} in
119 + kdelibs4support | \
120 + kdewebkit | \
121 + khtml | \
122 + kjs | \
123 + kjsembed | \
124 + kmediaplayer | \
125 + kross)
126 + _src_uri+="portingAids/"
127 + ;;
128 + kdesignerplugin)
129 + [[ ${PV} = 5.60.* ]] || _src_uri+="portingAids/"
130 + ;;
131 + esac
132 + ;;
133 + kde-plasma)
134 + case ${PV} in
135 + 5.??.[6-9]? )
136 + _src_uri+="unstable/plasma/$(ver_cut 1-3)/"
137 + RESTRICT+=" mirror"
138 + ;;
139 + *) _src_uri+="stable/plasma/$(ver_cut 1-3)/" ;;
140 + esac
141 + ;;
142 + esac
143 +
144 + if [[ ${PN} = kdevelop* ]]; then
145 + case ${PV} in
146 + *.*.[6-9]? )
147 + _src_uri+="unstable/kdevelop/${PV}/src/"
148 + RESTRICT+=" mirror"
149 + ;;
150 + *) _src_uri+="stable/kdevelop/${PV}/src/" ;;
151 + esac
152 + fi
153 +
154 + SRC_URI="${_src_uri}${KDE_ORG_NAME}-${PV}.tar.xz"
155 +
156 + if _kde_is_unreleased ; then
157 + RESTRICT+=" fetch"
158 + fi
159 +}
160 +
161 +# Determine fetch location for live sources
162 +_calculate_live_repo() {
163 + debug-print-function ${FUNCNAME} "$@"
164 +
165 + SRC_URI=""
166 +
167 + # @ECLASS-VARIABLE: EGIT_MIRROR
168 + # @DESCRIPTION:
169 + # This variable allows easy overriding of default kde mirror service
170 + # (anongit) with anything else you might want to use.
171 + EGIT_MIRROR=${EGIT_MIRROR:=https://anongit.kde.org}
172 +
173 + if [[ ${PV} == ??.??.49.9999 && ${CATEGORY} = kde-apps ]]; then
174 + EGIT_BRANCH="Applications/$(ver_cut 1-2)"
175 + fi
176 +
177 + if [[ ${PV} != 9999 && ${CATEGORY} = kde-plasma ]]; then
178 + EGIT_BRANCH="Plasma/$(ver_cut 1-2)"
179 + fi
180 +
181 + if [[ ${PV} != 9999 && ${PN} = kdevelop* ]]; then
182 + EGIT_BRANCH="$(ver_cut 1-2)"
183 + fi
184 +
185 + # @ECLASS-VARIABLE: EGIT_REPONAME
186 + # @DESCRIPTION:
187 + # This variable allows overriding of default repository
188 + # name. Specify only if this differs from PN and KDE_ORG_NAME.
189 + EGIT_REPO_URI="${EGIT_MIRROR}/${EGIT_REPONAME:=$KDE_ORG_NAME}"
190 +}
191 +
192 +case ${KDE_BUILD_TYPE} in
193 + live) _calculate_live_repo ;;
194 + *)
195 + _calculate_src_uri
196 + debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
197 + ;;
198 +esac
199 +
200 +
201 +if [[ ${KDE_BUILD_TYPE} = release ]]; then
202 + S=${WORKDIR}/${KDE_ORG_NAME}-${PV}
203 +fi
204 +
205 +# @FUNCTION: kde.org_pkg_nofetch
206 +# @DESCRIPTION:
207 +# Intended for use in the KDE overlay. If this package matches something in
208 +# KDE_UNRELEASED, display a giant warning that the package has not yet been
209 +# released upstream and should not be used.
210 +kde.org_pkg_nofetch() {
211 + if ! _kde_is_unreleased ; then
212 + return
213 + fi
214 +
215 + local sched_uri="https://community.kde.org/Schedules"
216 + case ${CATEGORY} in
217 + kde-frameworks) sched_uri+="/Frameworks" ;;
218 + kde-plasma) sched_uri+="/Plasma_5" ;;
219 + kde-apps) sched_uri+="/Applications/$(ver_cut 1-2)_Release_Schedule" ;;
220 + esac
221 +
222 + eerror " _ _ _ _ ____ _____ _ _____ _ ____ _____ ____ "
223 + eerror "| | | | \ | | _ \| ____| | | ____| / \ / ___|| ____| _ \ "
224 + eerror "| | | | \| | |_) | _| | | | _| / _ \ \___ \| _| | | | |"
225 + eerror "| |_| | |\ | _ <| |___| |___| |___ / ___ \ ___) | |___| |_| |"
226 + eerror " \___/|_| \_|_| \_\_____|_____|_____/_/ \_\____/|_____|____/ "
227 + eerror " "
228 + eerror " ____ _ ____ _ __ _ ____ _____ "
229 + eerror "| _ \ / \ / ___| |/ / / \ / ___| ____|"
230 + eerror "| |_) / _ \| | | ' / / _ \| | _| _| "
231 + eerror "| __/ ___ \ |___| . \ / ___ \ |_| | |___ "
232 + eerror "|_| /_/ \_\____|_|\_\/_/ \_\____|_____|"
233 + eerror
234 + eerror "${CATEGORY}/${P} has not been released to the public yet"
235 + eerror "and is only available to packagers right now."
236 + eerror ""
237 + eerror "This is not a bug. Please do not file bugs or contact upstream about this."
238 + eerror ""
239 + eerror "Please consult the upstream release schedule to see when this "
240 + eerror "package is scheduled to be released:"
241 + eerror "${sched_uri}"
242 +}
243 +
244 +# @FUNCTION: kde.org_src_unpack
245 +# @DESCRIPTION:
246 +# Unpack the sources, automatically handling both release and live ebuilds.
247 +kde.org_src_unpack() {
248 + debug-print-function ${FUNCNAME} "$@"
249 +
250 + if [[ ${KDE_BUILD_TYPE} = live ]]; then
251 + git-r3_src_unpack
252 + else
253 + default
254 + fi
255 +}
256 +
257 +fi