Gentoo Archives: gentoo-dev

From: David Seifert <soap@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Review: aspell-dict-r1.eclass
Date: Sun, 19 Mar 2017 21:22:58
Message-Id: 1489958564.1346.2.camel@gentoo.org
1 This is a revbump of aspell-dict.eclass, in order to bring it up to EAPI 6 standards.
2 Comment here or on https://github.com/gentoo/gentoo/pull/4237
3
4 --- eclass/aspell-dict.eclass
5 +++ eclass/aspell-dict-r1.eclass
6 @@ -1,77 +1,89 @@
7 -# Copyright 1999-2014 Gentoo Foundation
8 +# Copyright 1999-2017 Gentoo Foundation
9  # Distributed under the terms of the GNU General Public License v2
10  
11 -# @ECLASS: aspell-dict.eclass
12 +# @ECLASS: aspell-dict-r1.eclass
13  # @MAINTAINER:
14  # maintainer-needed@g.o
15  # @AUTHOR:
16  # Original author: Seemant Kulleen
17 +#      -r1 author: David Seifert
18  # @BLURB: An eclass to streamline the construction of ebuilds for new aspell dicts
19  # @DESCRIPTION:
20 -# The aspell-dict eclass is designed to streamline the construction of
21 +# The aspell-dict-r1 eclass is designed to streamline the construction of
22  # ebuilds for the new aspell dictionaries (from gnu.org) which support
23  # aspell-0.50. Support for aspell-0.60 has been added by Sergey Ulanov.
24  
25  # @ECLASS-VARIABLE: ASPELL_LANG
26  # @REQUIRED
27  # @DESCRIPTION:
28 -# Which language is the dictionary for? It's used for the DESCRIPTION of the
29 -# package.
30 +# Pure cleartext string that is included into DESCRIPTION. This is the name
31 +# of the language, for instance "Hungarian". Needs to be defined before
32 +# inheriting the eclass.
33 +
34 +# @ECLASS-VARIABLE: ASPELL_VERSION
35 +# @DESCRIPTION:
36 +# What major version of aspell is this dictionary for? Valid values are 5, 6 or undefined.
37 +# This value is used to construct SRC_URI and *DEPEND strings. If defined to 6,
38 +# >=app-text/aspell-0.60 will be added to DEPEND and RDEPEND, otherwise,
39 +# >=app-text/aspell-0.50 is added to DEPEND and RDEPEND. If the value is to be overridden,
40 +# it needs to be overridden before inheriting the eclass.
41 +
42 +case ${EAPI:-0} in
43 + [0-5])
44 + die "aspell-dict-r1.eclass is banned in EAPI ${EAPI:-0}"
45 + ;;
46 + 6)
47 + ;;
48 + *)
49 + die "Unknown EAPI ${EAPI:-0}"
50 + ;;
51 +esac
52  
53 -# @ECLASS-VARIABLE: ASPOSTFIX
54 -# @REQUIRED
55 -# @DESCRIPTION:
56 -# What major version of aspell is this dictionary for?
57 +EXPORT_FUNCTIONS src_configure src_install
58  
59 -case ${EAPI} in
60 - 0|1) EXPORT_FUNCTIONS src_compile src_install ;;
61 - *) EXPORT_FUNCTIONS src_configure src_compile src_install ;;
62 -esac
63 +if [[ ! ${_ASPELL_DICT_R1} ]]; then
64 +
65 +# aspell packages have an idiosyncratic versioning scheme, that is
66 +# the last separating version separator is replaced by a '-'.
67 +_ASPELL_P=aspell${ASPELL_VERSION}-${PN/aspell-/}-${PV%.*}-${PV##*.}
68 +
69 +# @ECLASS-VARIABLE: ASPELL_SPELLANG
70 +# @DESCRIPTION:
71 +# Short (readonly) form of the language code, generated from ${PN}
72 +# For instance, 'aspell-hu' yields the value 'hu'.
73 +readonly ASPELL_SPELLANG=${PN/aspell-/}
74 +S="${WORKDIR}/${_ASPELL_P}"
75  
76 -#MY_P=${PN}-${PV%.*}-${PV#*.*.}
77 -MY_P=${P%.*}-${PV##*.}
78 -MY_P=aspell${ASPOSTFIX}-${MY_P/aspell-/}
79 -SPELLANG=${PN/aspell-/}
80 -S="${WORKDIR}/${MY_P}"
81  DESCRIPTION="${ASPELL_LANG} language dictionary for aspell"
82  HOMEPAGE="http://aspell.net"
83 -SRC_URI="mirror://gnu/aspell/dict/${SPELLANG}/${MY_P}.tar.bz2"
84 +SRC_URI="mirror://gnu/aspell/dict/${ASPELL_SPELLANG}/${_ASPELL_P}.tar.bz2"
85 +unset _ASPELL_P
86  
87  IUSE=""
88  SLOT="0"
89  
90 -if [ x${ASPOSTFIX} = x6 ] ; then
91 - RDEPEND=">=app-text/aspell-0.60"
92 - DEPEND="${RDEPEND}"
93 -else
94 - RDEPEND=">=app-text/aspell-0.50"
95 - DEPEND="${RDEPEND}"
96 -fi
97 +_ASPELL_MAJOR_VERSION=${ASPELL_VERSION:-5}
98 +[[ ${_ASPELL_MAJOR_VERSION} != [56] ]] && die "{ASPELL_VERSION} is not a valid version"
99  
100 -# @FUNCTION: aspell-dict_src_configure
101 -# @DESCRIPTION:
102 -# The aspell-dict src_configure function which is exported.
103 -aspell-dict_src_configure() {
104 +RDEPEND=">=app-text/aspell-0.${_ASPELL_MAJOR_VERSION}0"
105 +DEPEND="${RDEPEND}"
106 +unset _ASPELL_MAJOR_VERSION
107 +
108 +# @FUNCTION: aspell-dict-r1_src_configure
109 +# @DESCRIPTION:
110 +# The aspell-dict-r1 src_configure function which is exported.
111 +aspell-dict-r1_src_configure() {
112 + # non-autoconf based script, cannot be used with econf
113   ./configure || die
114  }
115  
116 -# @FUNCTION: aspell-dict_src_compile
117 +# @FUNCTION: aspell-dict-r1_src_install
118  # @DESCRIPTION:
119 -# The aspell-dict src_compile function which is exported.
120 -aspell-dict_src_compile() {
121 - case ${EAPI} in
122 - 0|1) aspell-dict_src_configure ;;
123 - esac
124 - emake || die
125 +# The aspell-dict-r1 src_install function which is exported.
126 +aspell-dict-r1_src_install() {
127 + default
128 + [[ -s info ]] && dodoc info
129  }
130  
131 -# @FUNCTION: aspell-dict_src_install
132 -# @DESCRIPTION:
133 -# The aspell-dict src_install function which is exported.
134 -aspell-dict_src_install() {
135 - make DESTDIR="${D}" install || die
136 -
137 - for doc in README info ; do
138 - [ -s "$doc" ] && dodoc $doc
139 - done
140 -}
141 +_ASPELL_DICT_R1=1
142 +fi

Replies

Subject Author
Re: [gentoo-dev] Review: aspell-dict-r1.eclass William Hubbs <williamh@g.o>
Re: [gentoo-dev] Review: aspell-dict-r1.eclass David Seifert <soap@g.o>