Gentoo Archives: gentoo-dev

From: David Seifert <soap@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Review: xemacs-packages-r1.eclass
Date: Sun, 02 Apr 2017 09:06:05
Message-Id: 1491123951.2020.8.camel@gentoo.org
1 Hi,
2 so one big swath of EAPI 0 ebuilds sits in app-xemacs/. The current
3 eclass, xemacs-packages.eclass is from days gone by and does little in
4 terms of modern eclass/ebuild best-practices. I have rewritten it, and
5 with it will port all ebuilds to it and EAPI 6 (which can be automated,
6 due to the regular structure of app-xemacs/). The following
7 improvements have been made:
8
9 * Eclass is EAPI 6 (and above) only.
10 * The eclass now uses the phase functions properly, that is, it doesn't
11 just unpack the tarball into ${D} in src_install(). This also leads to
12 a situation where only src_install is EXPORT_FUNCTIONSd, instead of
13 src_unpack and src_compile too.
14 * As a result of using doins/insinto and separating the phases cleanly,
15 all packages automatically become Prefix-compatible.
16 * All variables are now namespaced, which is how modern eclasses should
17 be written.
18 * The package category is checked for consistency between definition in
19 global scope and its use in src_install().
20
21 ---------------
22
23 # Copyright 1999-2017 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25
26 # @ECLASS: xemacs-packages-r1.eclass
27 # @MAINTAINER:
28 # xemacs@g.o
29 # @BLURB: Eclass to support elisp packages distributed by XEmacs.
30 # @DESCRIPTION:
31 # This eclass supports ebuilds for packages distributed by XEmacs.
32 # Ebuilds have to support EAPI 6 at a minimum.
33
34 case ${EAPI:-0} in
35 [0-5])
36 die "xemacs-packages-r1.eclass is banned in EAPI ${EAPI:-0}"
37 ;;
38 6)
39 ;;
40 *)
41 die "Unknown EAPI ${EAPI}"
42 ;;
43 esac
44
45 EXPORT_FUNCTIONS src_install
46
47 if [[ ! ${_XEMACS_PACKAGES_R1} ]]; then
48
49 RDEPEND="app-editors/xemacs"
50 DEPEND="${DEPEND}"
51
52 HOMEPAGE="http://xemacs.org/"
53 LICENSE="GPL-2"
54
55 S="${WORKDIR}"
56
57 # @ECLASS-VARIABLE: XEMACS_PKG_CAT
58 # @REQUIRED
59 # @DESCRIPTION:
60 # The package category that the package is in. Can be either standard,
61 # mule, or contrib. Has to be defined before inheriting the eclass.
62 # Take care not to modify this variable later on.
63
64 [[ ${XEMACS_PKG_CAT} ]] || die "XEMACS_PKG_CAT was not defined before inheriting xemacs-packages-r1.eclass"
65 case ${XEMACS_PKG_CAT} in
66 standard|mule|contrib)
67 ;;
68 *)
69 die "Unsupported package category in XEMACS_PKG_CAT"
70 ;;
71 esac
72 readonly _XEMACS_INITIAL_PKG_CAT=${XEMACS_PKG_CAT}
73
74 # @ECLASS-VARIABLE: XEMACS_EXPERIMENTAL
75 # @DEFAULT_UNSET
76 # @DESCRIPTION:
77 # If set then the package is downloaded from the experimental packages
78 # repository, which is the staging area for packages upstream. Packages
79 # in the experimental repository are auto-generated from XEmacs VCS, so
80 # they may not be well-tested. Has to be defined before inheriting the
81 # eclass.
82
83 if [[ -n ${XEMACS_EXPERIMENTAL} ]]; then
84 SRC_URI="http://ftp.xemacs.org/pub/xemacs/beta/experimental/packages/${P}-pkg.tar.gz"
85 else
86 SRC_URI="http://ftp.xemacs.org/pub/xemacs/packages/${P}-pkg.tar.gz"
87 fi
88
89 # @FUNCTION: xemacs-packages-r1_src_install
90 # @DESCRIPTION:
91 # xemacs-packages-r1_src_install install the package in a Prefix-aware
92 # manner.
93 xemacs-packages-r1_src_install() {
94 debug-print-function ${FUNCNAME} "${@}"
95
96 [[ ${_XEMACS_INITIAL_PKG_CAT} != ${XEMACS_PKG_CAT} ]] && \
97 die "XEMACS_PKG_CAT has been changed between the initial definition and src_install"
98
99 local xemacs_subdir
100 case ${XEMACS_PKG_CAT} in
101 standard)
102 xemacs_subdir=xemacs-packages
103 ;;
104 mule)
105 xemacs_subdir=mule-packages
106 ;;
107 contrib)
108 xemacs_subdir=site-packages
109 ;;
110 esac
111 debug-print "XEmacs package install dir = /usr/lib/xemacs/${xemacs_subdir}"
112
113 insinto /usr/lib/xemacs/${xemacs_subdir}
114 doins -r .
115 }
116
117 _XEMACS_PACKAGES_R1=1
118 fi

Replies

Subject Author
Re: [gentoo-dev] Review: xemacs-packages-r1.eclass Michael Orlitzky <mjo@g.o>