Gentoo Archives: gentoo-dev

From: Marek Szuba <marecki@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] sword-module.eclass: update, extend, increment revision
Date: Mon, 27 Jul 2020 09:52:04
Message-Id: b994c6c6-c14f-c2f5-5d84-93980497c2c9@gentoo.org
In Reply to: Re: [gentoo-dev] [RFC] sword-module.eclass: update, extend, increment revision by "Michał Górny"
1 On 2020-07-26 21:19, Michał Górny wrote:
2
3 > Please use git-send-email, so that we can reply in context without
4 > jumping through hoops.
5
6 Funny, last time I used git-send-email to post a diff introducing a new
7 revision of a file (it was virtual/opencl, IIRC) I got told it was too
8 difficult to follow the changes that way and a plain diff would have
9 been more useful.
10
11 Anyway, here is the same diff but inline. I'll also repeat the summary
12 of proposed changes here so that it isn't necessary to switch to a
13 different message to see it:
14 - add eclassdoc blocks;
15 - add the optional variable SWORD_MINIMUM_VERSION to specify the lowest
16 version of app-text/sword supported by the module at hand;
17 - check if SWORD_MODULE is set and not null, and die otherwise;
18 - change the default SRC_URI from mirror://gentoo to my Web space on
19 dev.gentoo.org;
20 - remove redundant declarations of HOMEPAGE and IUSE;
21 - app-arch/unzip is now in BDEPEND rather than DEPEND;
22 - as a consequence of the above, enforce the use of EAPI-7 in ebuilds
23 inheriting this eclass;
24 - remove redundant references to ${S} from doins() calls.
25
26 * * *
27
28 --- eclass/sword-module.eclass
29 +++ eclass/sword-module-r1.eclass
30 @@ -1,33 +1,100 @@
31 # Copyright 1999-2020 Gentoo Authors
32 # Distributed under the terms of the GNU General Public License v2
33
34 +# @ECLASS: sword-module-r1.eclass
35 +# @MAINTAINER:
36 +# Marek Szuba <marecki@g.o>
37 +# @SUPPORTED_EAPIS: 7
38 +# @BLURB: Simplify installations of SWORD modules
39 +# @DESCRIPTION:
40 +# This eclass provides dependencies, ebuild environment and the src_install
41 +# function common to all app-text/sword modules published by the SWORD Project.
42 #
43 -# eclass to simplify installation of Sword modules
44 -# Bugs to marecki@g.o
45 +# Note that while all SWORD modules which do not require prior registration
46 +# to unlock can easily be downloaded from the upstream Web site, as of
47 +# 2020-07-26 all the files available at
48 +# https://crosswire.org/ftpmirror/pub/sword/packages/rawzip/
49 +# are unversioned and it is necessary to look at respective module pages
50 +# in order to see when they have last been updated. Therefore, maintainers
51 +# must rename module files to include the version number and host them
52 +# somewhere to avoid breaking digests when new versions are released.
53 #
54 +# @EXAMPLE:
55 +# Typical ebuild using sword-module-r1.eclass:
56 +#
57 +# @CODE
58 +# EAPI=7
59 +#
60 +# SWORD_MODULE="Personal"
61 +# SWORD_MINIMUM_VERSION="1.5.1a"
62 +#
63 +# inherit sword-module-r1
64 +#
65 +# DESCRIPTION="SWORD module for storing one's own commentary"
66 +# HOMEPAGE="https://crosswire.org/sword/modules/ModInfo.jsp?modName=Personal"
67 +# LICENSE="public-domain"
68 +# KEYWORDS="~amd64"
69 +#
70 +# @CODE
71
72 -HOMEPAGE="http://www.crosswire.org/sword/modules/"
73 +case ${EAPI:-0} in
74 + 0|1|2|3|4|5|6)
75 + die "Unsupported EAPI=${EAPI} (too old) for ${ECLASS}"
76 + ;;
77 + 7)
78 + ;;
79 + *)
80 + die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
81 + ;;
82 +esac
83 +
84 +# @ECLASS-VARIABLE: SWORD_MODULE
85 +# @DEFAULT_UNSET
86 +# @PRE_INHERIT
87 +# @REQUIRED
88 +# @DESCRIPTION:
89 +# Name of the module as used by the SWORD Project. Case-sensitive.
90 +# Needs to be set before the inherit line.
91 +
92 +if [[ ! ${SWORD_MODULE} ]]; then
93 + die 'SWORD_MODULE not declared or null'
94 +fi
95 +
96 +# @ECLASS-VARIABLE: SWORD_MINIMUM_VERSION
97 +# @DEFAULT_UNSET
98 +# @PRE_INHERIT
99 +# @DESCRIPTION:
100 +# If set to a non-null value, specifies the minimum version of app-text/sword
101 +# the module requires. This will be included in RDEPEND. If null or unset,
102 +# the dependency will be unversioned.
103 +# Needs to be set before the inherit line.
104
105 -# Sword packages are generally released as FooBar.zip in their 'rawzip' form
106 -# The files are also unversioned, so the packager will need to rename the
107 -# original file to something else and host it somewhere to avoid breaking
108 -# the digest when new versions are released.
109 +EXPORT_FUNCTIONS src_install
110
111 -SRC_URI="mirror://gentoo/${SWORD_MODULE}-${PV}.zip"
112 +# Default location of versioned files. In general this is obviously
113 +# maintainer-specific, then again all the 133 modules present in the tree
114 +# as of mid-July 2020 are maintained by the same person.
115 +SRC_URI="https://dev.gentoo.org/~marecki/dists/sword-modules/${SWORD_MODULE}-${PV}.zip"
116
117 SLOT="0"
118 -IUSE=""
119
120 +# Module archives contain no top-level directory.
121 S="${WORKDIR}"
122
123 -RDEPEND="app-text/sword"
124 -DEPEND="app-arch/unzip"
125 -
126 -sword-module_src_install() {
127 +if [[ ${SWORD_MINIMUM_VERSION} ]]; then
128 + RDEPEND=">=app-text/sword-${SWORD_MINIMUM_VERSION}"
129 +else
130 + RDEPEND="app-text/sword"
131 +fi
132 +
133 +BDEPEND="app-arch/unzip"
134 +
135 +# @FUNCTION: sword-module-r1_src_install
136 +# @DESCRIPTION:
137 +# Install all the module files into directories expected by app-text/sword.
138 +sword-module-r1_src_install() {
139 insinto /usr/share/sword/modules
140 - doins -r "${S}"/modules/*
141 + doins -r modules/*
142 insinto /usr/share/sword/mods.d
143 - doins "${S}"/mods.d/*
144 + doins mods.d/*
145 }
146 -
147 -EXPORT_FUNCTIONS src_install
148
149
150
151
152 --
153 MS

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies