Gentoo Archives: gentoo-dev

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

Attachments

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

Replies