Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] eclass/sword-module.eclass: update SRC_URI, expand a bit, clean up
Date: Wed, 29 Jul 2020 10:10:45
Message-Id: 7ae4547b0ebe705d43078919543744865fd475e4.camel@gentoo.org
In Reply to: [gentoo-dev] [PATCH] eclass/sword-module.eclass: update SRC_URI, expand a bit, clean up by Marek Szuba
1 On Mon, 2020-07-27 at 17:44 +0200, Marek Szuba wrote:
2 > 1. The old version expected versioned source archives to have been
3 > manually uploaded to the Gentoo mirror network by package
4 > maintainers. This is no longer allowed, or indeed possible for most
5 > Gentoo developers. Instead, use the SRC_URI arrow mechanism to
6 > version archives fetched directly from upstream. SWORD Project
7 > updates their modules quite infrequently so it isn't really necessary
8 > to worry the file having changed between looking the version number
9 > up on the module page and fetching the archive for digest generation,
10 > and while users who do not use Gentoo mirrors will see digest
11 > conflicts when an update does occur, this would effectively encourage
12 > them to notify maintainers whenever a new version is released;
13 > 2. If SWORD_MODULE is not set, attempt to generate it from PN by
14 > stripping the prefix 'sword-'. This will allow explicit declarations
15 > of SWORD_MODULE from all app-dicts/sword-* ebuilds currently in the
16 > tree;
17 > 3. Add the optional variable SWORD_MINIMUM_VERSION to specify the lowest
18 > version of app-text/sword supported by the module at hand;
19 > 4. Remove redundant declarations of HOMEPAGE and IUSE;
20 > 5. app-arch/unzip is now in BDEPEND rather than DEPEND;
21 > 6. As a consequence of the above, enforce the use of EAPI-7 in ebuilds
22 > inheriting this eclass. Those in the tree have all already been
23 > updated to that EAPI version;
24 > 7. Remove redundant references to ${S} from doins() calls;
25 > 8. Add eclassdoc blocks.
26 >
27 > No revision change in the end because all the changes should be
28 > backwards-compatible.
29 >
30 > Closes: https://bugs.gentoo.org/637882
31 > Signed-off-by: Marek Szuba <marecki@g.o>
32 > ---
33 > eclass/sword-module.eclass | 92 +++++++++++++++++++++++++++++++-------
34 > 1 file changed, 77 insertions(+), 15 deletions(-)
35 >
36 > diff --git a/eclass/sword-module.eclass b/eclass/sword-module.eclass
37 > index c66c9987e9f..2ae58d1e51b 100644
38 > --- a/eclass/sword-module.eclass
39 > +++ b/eclass/sword-module.eclass
40 > @@ -1,33 +1,95 @@
41 > # Copyright 1999-2020 Gentoo Authors
42 > # Distributed under the terms of the GNU General Public License v2
43 >
44 > +# @ECLASS: sword-module.eclass
45 > +# @MAINTAINER:
46 > +# Marek Szuba <marecki@g.o>
47 > +# @SUPPORTED_EAPIS: 7
48 > +# @BLURB: Simplify installation of SWORD modules
49 > +# @DESCRIPTION:
50 > +# This eclass provides dependencies, ebuild environment and the src_install
51 > +# function common to all app-text/sword modules published by the SWORD Project.
52 > #
53 > -# eclass to simplify installation of Sword modules
54 > -# Bugs to marecki@g.o
55 > +# Note that as of 2020-07-26 module archives published by SWORD are still
56 > +# not versioned and it is necessary to look at respective module pages in
57 > +# order to see what versions the currently available files are. Once
58 > +# a module file has been replicated to the Gentoo mirror network it will be
59 > +# versioned and remain available even after upstream has changed their
60 > +# version, however users not using mirrors will encounter hash conflicts
61 > +# on updated modules. Should that happen, please notify the relevant
62 > +# package maintainers that a new version is available.
63 > #
64 > +# @EXAMPLE:
65 > +# sword-Personal-1.0.ebuild, a typical ebuild using sword-module.eclass:
66 > +#
67 > +# @CODE
68 > +# EAPI=7
69 > +#
70 > +# SWORD_MINIMUM_VERSION="1.5.1a"
71 > +#
72 > +# inherit sword-module
73 > +#
74 > +# DESCRIPTION="SWORD module for storing one's own commentary"
75 > +# HOMEPAGE="https://crosswire.org/sword/modules/ModInfo.jsp?modName=Personal"
76 > +# LICENSE="public-domain"
77 > +# KEYWORDS="~amd64 ~ppc ~x86"
78 > +#
79 > +# @CODE
80 >
81 > -HOMEPAGE="http://www.crosswire.org/sword/modules/"
82 > +case ${EAPI:-0} in
83 > + 0|1|2|3|4|5|6)
84 > + die "Unsupported EAPI=${EAPI} (too old) for ${ECLASS}"
85 > + ;;
86 > + 7)
87 > + ;;
88 > + *)
89 > + die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
90 > + ;;
91 > +esac
92 >
93 > -# Sword packages are generally released as FooBar.zip in their 'rawzip' form
94 > -# The files are also unversioned, so the packager will need to rename the
95 > -# original file to something else and host it somewhere to avoid breaking
96 > -# the digest when new versions are released.
97 > +# @ECLASS-VARIABLE: SWORD_MINIMUM_VERSION
98 > +# @DEFAULT_UNSET
99 > +# @PRE_INHERIT
100 > +# @DESCRIPTION:
101 > +# If set to a non-null value, specifies the minimum version of app-text/sword
102 > +# the module requires. This will be included in RDEPEND. If null or unset,
103 > +# the dependency will be unversioned.
104 > +# Needs to be set before the inherit line.
105 >
106 > -SRC_URI="mirror://gentoo/${SWORD_MODULE}-${PV}.zip"
107 > +# @ECLASS-VARIABLE: SWORD_MODULE
108 > +# @PRE_INHERIT
109 > +# @DESCRIPTION:
110 > +# Case-sensitive name of the SWORD-Project module to install. If unset
111 > +# or null, use the name produced by removing the prefix 'sword-' from PN.
112 > +# Needs to be set before the inherit line.
113 > +: ${SWORD_MODULE:=${PN#sword-}}
114 > +
115 > +EXPORT_FUNCTIONS src_install
116 > +
117 > +# Unless overridden at ebuild level, append version to the name of the file
118 > +# fetched from upstream and let the Gentoo mirror network take care of
119 > +# persisting the versioned archive.
120 > +SRC_URI="https://crosswire.org/ftpmirror/pub/sword/packages/rawzip/${SWORD_MODULE}.zip -> ${SWORD_MODULE}-${PV}.zip"
121 >
122 > SLOT="0"
123 > -IUSE=""
124 >
125 > +# Module archives contain no top-level directory.
126 > S="${WORKDIR}"
127 >
128 > -RDEPEND="app-text/sword"
129 > -DEPEND="app-arch/unzip"
130 > +if [[ ${SWORD_MINIMUM_VERSION} ]]; then
131 > + RDEPEND=">=app-text/sword-${SWORD_MINIMUM_VERSION}"
132 > +else
133 > + RDEPEND="app-text/sword"
134 > +fi
135 > +
136 > +BDEPEND="app-arch/unzip"
137 >
138 > +# @FUNCTION: sword-module_src_install
139 > +# @DESCRIPTION:
140 > +# Install all the module files into directories used by app-text/sword.
141 > sword-module_src_install() {
142 > insinto /usr/share/sword/modules
143 > - doins -r "${S}"/modules/*
144 > + doins -r modules/*
145 > insinto /usr/share/sword/mods.d
146 > - doins "${S}"/mods.d/*
147 > + doins mods.d/*
148 > }
149 > -
150 > -EXPORT_FUNCTIONS src_install
151
152 LGTM. Thanks!
153
154 --
155 Best regards,
156 Michał Górny

Attachments

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

Replies