Gentoo Archives: gentoo-dev

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

Replies