public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Andreas Sturmlechner <asturm@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Subject: [gentoo-dev] [PATCH 1/2] kde.org.eclass: New eclass, split from kde5.eclass
Date: Wed, 16 Oct 2019 14:01:17 +0200	[thread overview]
Message-ID: <2908567.KZJ7x2Zu1G@tuxbrain> (raw)
In-Reply-To: <f1402d79825b7caa8b8139dc953fec17046fb573.camel@gentoo.org>

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.

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.

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.

tl;dr:
- pkg_nofetch and src_unpack move from kde5.eclass to kde.org.eclass
- kde5.eclass inherits kde.org.eclass
- ebuilds using kde5.eclass w/ KDE_AUTODEPS=false will only inherit kde.org
- more good things to come


--- /dev/null
+++ b/eclass/kde.org.eclass
@@ -0,0 +1,241 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# @ECLASS: kde.org.eclass
+# @MAINTAINER:
+# kde@gentoo.org
+# @SUPPORTED_EAPIS: 7
+# @BLURB: Support eclass for packages that are hosted on kde.org infrastructure.
+# @DESCRIPTION:
+# This eclass is mainly providing facilities for the upstream release groups
+# Frameworks, Plasma, Applications to assemble default SRC_URI for tarballs,
+# set up git-r3.eclass for stable/master branch versions or restrict access to
+# unreleased (packager access only) tarballs in Gentoo KDE overlay, but it may
+# be also used by any other package hosted on kde.org.
+# It also contains default meta variables for settings not specific to any
+# particular build system.
+
+if [[ -z ${_KDE_ORG_ECLASS} ]]; then
+_KDE_ORG_ECLASS=1
+
+# @ECLASS-VARIABLE: KDE_BUILD_TYPE
+# @DESCRIPTION:
+# If PV matches "*9999*", this is automatically set to "live".
+# Otherwise, this is automatically set to "release".
+KDE_BUILD_TYPE="release"
+if [[ ${PV} = *9999* ]]; then
+	KDE_BUILD_TYPE="live"
+fi
+export KDE_BUILD_TYPE
+
+if [[ ${KDE_BUILD_TYPE} = live ]]; then
+	inherit git-r3
+fi
+
+EXPORT_FUNCTIONS pkg_nofetch src_unpack
+
+# @ECLASS-VARIABLE: KDE_ORG_NAME
+# @DESCRIPTION:
+# If unset, default value is set to ${PN}.
+# Name of the package as hosted on kde.org mirrors.
+: ${KDE_ORG_NAME:=$PN}
+
+# @ECLASS-VARIABLE: KDE_SELINUX_MODULE
+# @DESCRIPTION:
+# If set to "none", do nothing.
+# For any other value, add selinux to IUSE, and depending on that useflag
+# add a dependency on sec-policy/selinux-${KDE_SELINUX_MODULE} to (R)DEPEND.
+: ${KDE_SELINUX_MODULE:=none}
+
+case ${KDE_SELINUX_MODULE} in
+	none)   ;;
+	*)
+		IUSE+=" selinux"
+		RDEPEND+=" selinux? ( sec-policy/selinux-${KDE_SELINUX_MODULE} )"
+		;;
+esac
+
+if [[ ${CATEGORY} = kde-frameworks ]]; then
+	SLOT=5/${PV}
+	[[ ${KDE_BUILD_TYPE} = release ]] && SLOT=$(ver_cut 1)/$(ver_cut 1-2)
+fi
+
+# @ECLASS-VARIABLE: KDE_UNRELEASED
+# @INTERNAL
+# @DESCRIPTION
+# An array of $CATEGORY-$PV pairs of packages that are unreleased upstream.
+# Any package matching this will have fetch restriction enabled, and receive
+# a proper error message via pkg_nofetch.
+KDE_UNRELEASED=( )
+
+HOMEPAGE="https://kde.org/"
+
+_kde_is_unreleased() {
+	local pair
+	for pair in "${KDE_UNRELEASED[@]}" ; do
+		if [[ "${pair}" = "${CATEGORY}-${PV}" ]]; then
+			return 0
+		fi
+	done
+
+	return 1
+}
+
+# Determine fetch location for released tarballs
+_calculate_src_uri() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	local _src_uri="mirror://kde/"
+
+	case ${CATEGORY} in
+		kde-apps)
+			case ${PV} in
+				??.??.[6-9]? )
+					_src_uri+="unstable/applications/${PV}/src/"
+					RESTRICT+=" mirror"
+					;;
+				*) _src_uri+="stable/applications/${PV}/src/" ;;
+			esac
+			;;
+		kde-frameworks)
+			_src_uri+="stable/frameworks/$(ver_cut 1-2)/"
+			case ${PN} in
+				kdelibs4support | \
+				kdewebkit | \
+				khtml | \
+				kjs | \
+				kjsembed | \
+				kmediaplayer | \
+				kross)
+					_src_uri+="portingAids/"
+					;;
+				kdesignerplugin)
+					[[ ${PV} = 5.60.* ]] || _src_uri+="portingAids/"
+					;;
+			esac
+			;;
+		kde-plasma)
+			case ${PV} in
+				5.??.[6-9]? )
+					_src_uri+="unstable/plasma/$(ver_cut 1-3)/"
+					RESTRICT+=" mirror"
+					;;
+				*) _src_uri+="stable/plasma/$(ver_cut 1-3)/" ;;
+			esac
+			;;
+	esac
+
+	if [[ ${PN} = kdevelop* ]]; then
+		case ${PV} in
+			*.*.[6-9]? )
+				_src_uri+="unstable/kdevelop/${PV}/src/"
+				RESTRICT+=" mirror"
+				;;
+			*) _src_uri+="stable/kdevelop/${PV}/src/" ;;
+		esac
+	fi
+
+	SRC_URI="${_src_uri}${KDE_ORG_NAME}-${PV}.tar.xz"
+
+	if _kde_is_unreleased ; then
+		RESTRICT+=" fetch"
+	fi
+}
+
+# Determine fetch location for live sources
+_calculate_live_repo() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	SRC_URI=""
+
+	# @ECLASS-VARIABLE: EGIT_MIRROR
+	# @DESCRIPTION:
+	# This variable allows easy overriding of default kde mirror service
+	# (anongit) with anything else you might want to use.
+	EGIT_MIRROR=${EGIT_MIRROR:=https://anongit.kde.org}
+
+	if [[ ${PV} == ??.??.49.9999 && ${CATEGORY} = kde-apps ]]; then
+		EGIT_BRANCH="Applications/$(ver_cut 1-2)"
+	fi
+
+	if [[ ${PV} != 9999 && ${CATEGORY} = kde-plasma ]]; then
+		EGIT_BRANCH="Plasma/$(ver_cut 1-2)"
+	fi
+
+	if [[ ${PV} != 9999 && ${PN} = kdevelop* ]]; then
+		EGIT_BRANCH="$(ver_cut 1-2)"
+	fi
+
+	# @ECLASS-VARIABLE: EGIT_REPONAME
+	# @DESCRIPTION:
+	# This variable allows overriding of default repository
+	# name. Specify only if this differs from PN and KDE_ORG_NAME.
+	EGIT_REPO_URI="${EGIT_MIRROR}/${EGIT_REPONAME:=$KDE_ORG_NAME}"
+}
+
+case ${KDE_BUILD_TYPE} in
+	live) _calculate_live_repo ;;
+	*)
+		_calculate_src_uri
+		debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}"
+		;;
+esac
+
+
+if [[ ${KDE_BUILD_TYPE} = release ]]; then
+	S=${WORKDIR}/${KDE_ORG_NAME}-${PV}
+fi
+
+# @FUNCTION: kde.org_pkg_nofetch
+# @DESCRIPTION:
+# Intended for use in the KDE overlay. If this package matches something in
+# KDE_UNRELEASED, display a giant warning that the package has not yet been
+# released upstream and should not be used.
+kde.org_pkg_nofetch() {
+	if ! _kde_is_unreleased ; then
+		return
+	fi
+
+	local sched_uri="https://community.kde.org/Schedules"
+	case ${CATEGORY} in
+		kde-frameworks) sched_uri+="/Frameworks" ;;
+		kde-plasma) sched_uri+="/Plasma_5" ;;
+		kde-apps) sched_uri+="/Applications/$(ver_cut 1-2)_Release_Schedule" ;;
+	esac
+
+	eerror " _   _ _   _ ____  _____ _     _____    _    ____  _____ ____  "
+	eerror "| | | | \ | |  _ \| ____| |   | ____|  / \  / ___|| ____|  _ \ "
+	eerror "| | | |  \| | |_) |  _| | |   |  _|   / _ \ \___ \|  _| | | | |"
+	eerror "| |_| | |\  |  _ <| |___| |___| |___ / ___ \ ___) | |___| |_| |"
+	eerror " \___/|_| \_|_| \_\_____|_____|_____/_/   \_\____/|_____|____/ "
+	eerror "                                                               "
+	eerror " ____   _    ____ _  __    _    ____ _____ "
+	eerror "|  _ \ / \  / ___| |/ /   / \  / ___| ____|"
+	eerror "| |_) / _ \| |   | ' /   / _ \| |  _|  _|  "
+	eerror "|  __/ ___ \ |___| . \  / ___ \ |_| | |___ "
+	eerror "|_| /_/   \_\____|_|\_\/_/   \_\____|_____|"
+	eerror
+	eerror "${CATEGORY}/${P} has not been released to the public yet"
+	eerror "and is only available to packagers right now."
+	eerror ""
+	eerror "This is not a bug. Please do not file bugs or contact upstream about this."
+	eerror ""
+	eerror "Please consult the upstream release schedule to see when this "
+	eerror "package is scheduled to be released:"
+	eerror "${sched_uri}"
+}
+
+# @FUNCTION: kde.org_src_unpack
+# @DESCRIPTION:
+# Unpack the sources, automatically handling both release and live ebuilds.
+kde.org_src_unpack() {
+	debug-print-function ${FUNCNAME} "$@"
+
+	if [[ ${KDE_BUILD_TYPE} = live ]]; then
+		git-r3_src_unpack
+	else
+		default
+	fi
+}
+
+fi





  parent reply	other threads:[~2019-10-16 12:01 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-24 17:17 [gentoo-dev] [PATCH] font.eclass: Port to EAPI-7 Andreas Sturmlechner
2019-03-24 18:41 ` Michał Górny
2019-04-09 19:41   ` Andreas Sturmlechner
2019-04-10 13:21     ` Michał Górny
2019-10-15 21:58       ` [gentoo-dev] [PATCH v2] " Andreas Sturmlechner
2019-10-15 22:05       ` Andreas Sturmlechner
2019-10-16  6:52         ` Michał Górny
2019-10-16 12:01       ` Andreas Sturmlechner [this message]
2019-10-16 12:01       ` [gentoo-dev] [PATCH 2/2] kde5.eclass: Inherit kde.org.eclass and drop moved functions/vars Andreas Sturmlechner
2019-11-04 23:30       ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Andreas Sturmlechner
2019-11-04 23:37         ` [gentoo-dev] [PATCH 2/3] kde5.eclass: Inherit ecm-utils.eclass and drop moved functions/vars Andreas Sturmlechner
2019-11-04 23:42           ` [gentoo-dev] [PATCH 3/3] kde5-functions.eclass: Drop functions/vars moved to ecm-utils Andreas Sturmlechner
2019-11-05 21:20         ` [gentoo-dev] [PATCH 1/3] ecm-utils.eclass: New eclass Michał Górny
2019-11-06  1:19           ` Andreas Sturmlechner
2019-11-06  7:15             ` Michał Górny
2019-11-10 13:27               ` [gentoo-dev] [PATCH v2 1/3] ecm.eclass: " Andreas Sturmlechner
2019-11-10 16:26                 ` Gokturk Yuksek
2019-07-08 20:14   ` [gentoo-dev] [PATCH] profiles: desktop: Add USE icu to make.defaults Andreas Sturmlechner
2019-07-08 20:14   ` Andreas Sturmlechner
2019-07-08 20:14   ` Andreas Sturmlechner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2908567.KZJ7x2Zu1G@tuxbrain \
    --to=asturm@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox