public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Review: xemacs-packages-r1.eclass
@ 2017-04-02  9:05 David Seifert
  2017-04-03 23:05 ` Michael Orlitzky
  0 siblings, 1 reply; 2+ messages in thread
From: David Seifert @ 2017-04-02  9:05 UTC (permalink / raw
  To: gentoo-dev

Hi,
so one big swath of EAPI 0 ebuilds sits in app-xemacs/. The current
eclass, xemacs-packages.eclass is from days gone by and does little in
terms of modern eclass/ebuild best-practices. I have rewritten it, and
with it will port all ebuilds to it and EAPI 6 (which can be automated,
due to the regular structure of app-xemacs/). The following
improvements have been made:

* Eclass is EAPI 6 (and above) only.
* The eclass now uses the phase functions properly, that is, it doesn't
just unpack the tarball into ${D} in src_install(). This also leads to
a situation where only src_install is EXPORT_FUNCTIONSd, instead of
src_unpack and src_compile too.
* As a result of using doins/insinto and separating the phases cleanly,
all packages automatically become Prefix-compatible.
* All variables are now namespaced, which is how modern eclasses should
be written.
* The package category is checked for consistency between definition in
global scope and its use in src_install().

---------------

# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: xemacs-packages-r1.eclass
# @MAINTAINER:
# xemacs@gentoo.org
# @BLURB: Eclass to support elisp packages distributed by XEmacs.
# @DESCRIPTION:
# This eclass supports ebuilds for packages distributed by XEmacs.
# Ebuilds have to support EAPI 6 at a minimum.

case ${EAPI:-0} in
	[0-5])
		die "xemacs-packages-r1.eclass is banned in EAPI ${EAPI:-0}"
		;;
	6)
		;;
	*)
		die "Unknown EAPI ${EAPI}"
		;;
esac

EXPORT_FUNCTIONS src_install

if [[ ! ${_XEMACS_PACKAGES_R1} ]]; then

RDEPEND="app-editors/xemacs"
DEPEND="${DEPEND}"

HOMEPAGE="http://xemacs.org/"
LICENSE="GPL-2"

S="${WORKDIR}"

# @ECLASS-VARIABLE: XEMACS_PKG_CAT
# @REQUIRED
# @DESCRIPTION:
# The package category that the package is in. Can be either standard,
# mule, or contrib. Has to be defined before inheriting the eclass.
# Take care not to modify this variable later on.

[[ ${XEMACS_PKG_CAT} ]] || die "XEMACS_PKG_CAT was not defined before inheriting xemacs-packages-r1.eclass"
case ${XEMACS_PKG_CAT} in
	standard|mule|contrib)
		;;
	*)
		die "Unsupported package category in XEMACS_PKG_CAT"
		;;
esac
readonly _XEMACS_INITIAL_PKG_CAT=${XEMACS_PKG_CAT}

# @ECLASS-VARIABLE: XEMACS_EXPERIMENTAL
# @DEFAULT_UNSET
# @DESCRIPTION:
# If set then the package is downloaded from the experimental packages
# repository, which is the staging area for packages upstream. Packages
# in the experimental repository are auto-generated from XEmacs VCS, so
# they may not be well-tested. Has to be defined before inheriting the
# eclass.

if [[ -n ${XEMACS_EXPERIMENTAL} ]]; then
	SRC_URI="http://ftp.xemacs.org/pub/xemacs/beta/experimental/packages/${P}-pkg.tar.gz"
else
	SRC_URI="http://ftp.xemacs.org/pub/xemacs/packages/${P}-pkg.tar.gz"
fi

# @FUNCTION: xemacs-packages-r1_src_install
# @DESCRIPTION:
# xemacs-packages-r1_src_install install the package in a Prefix-aware
# manner.
xemacs-packages-r1_src_install() {
	debug-print-function ${FUNCNAME} "${@}"

	[[ ${_XEMACS_INITIAL_PKG_CAT} != ${XEMACS_PKG_CAT} ]] && \
		die "XEMACS_PKG_CAT has been changed between the initial definition and src_install"

	local xemacs_subdir
	case ${XEMACS_PKG_CAT} in
		standard)
			xemacs_subdir=xemacs-packages
			;;
		mule)
			xemacs_subdir=mule-packages
			;;
		contrib)
			xemacs_subdir=site-packages
			;;
	esac
	debug-print "XEmacs package install dir = /usr/lib/xemacs/${xemacs_subdir}"

	insinto /usr/lib/xemacs/${xemacs_subdir}
	doins -r .
}

_XEMACS_PACKAGES_R1=1
fi


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] Review: xemacs-packages-r1.eclass
  2017-04-02  9:05 [gentoo-dev] Review: xemacs-packages-r1.eclass David Seifert
@ 2017-04-03 23:05 ` Michael Orlitzky
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Orlitzky @ 2017-04-03 23:05 UTC (permalink / raw
  To: gentoo-dev

On 04/02/2017 05:05 AM, David Seifert wrote:
>
> [[ ${XEMACS_PKG_CAT} ]] || die "XEMACS_PKG_CAT was not defined before inheriting xemacs-packages-r1.eclass"
> case ${XEMACS_PKG_CAT} in
> 	standard|mule|contrib)
> 		;;
> 	*)
> 		die "Unsupported package category in XEMACS_PKG_CAT"
> 		;;
> esac


I think that the first check is redundant, but it isn't important if you 
don't feel like changing it.

Elsewhere: quoting the variables when they're used would produce better 
error messages if somebody puts something stupid in the variables.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-04-03 23:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-02  9:05 [gentoo-dev] Review: xemacs-packages-r1.eclass David Seifert
2017-04-03 23:05 ` Michael Orlitzky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox