Gentoo Archives: gentoo-commits

From: Sam James <sam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-geosciences/grass/files/, sci-geosciences/grass/
Date: Sat, 29 Jan 2022 06:20:23
Message-Id: 1643437105.7c473887fbc1dfbc393930e612cfc811e0f7e077.sam@gentoo
1 commit: 7c473887fbc1dfbc393930e612cfc811e0f7e077
2 Author: Mario Haustein <mario.haustein <AT> hrz <DOT> tu-chemnitz <DOT> de>
3 AuthorDate: Fri Jan 28 22:59:57 2022 +0000
4 Commit: Sam James <sam <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 29 06:18:25 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c473887
7
8 sci-geosciences/grass: version bump 8.0.0
9
10 Package-Manager: Portage-3.0.30, Repoman-3.0.3
11 Signed-off-by: Mario Haustein <mario.haustein <AT> hrz.tu-chemnitz.de>
12 Closes: https://github.com/gentoo/gentoo/pull/24003
13 Signed-off-by: Sam James <sam <AT> gentoo.org>
14
15 sci-geosciences/grass/Manifest | 2 +-
16 .../grass/files/grass-8.0.0-mkhtml.patch | 316 +++++++++++++++++++++
17 .../{grass-8.0.0_rc2.ebuild => grass-8.0.0.ebuild} | 1 +
18 3 files changed, 318 insertions(+), 1 deletion(-)
19
20 diff --git a/sci-geosciences/grass/Manifest b/sci-geosciences/grass/Manifest
21 index ff32202d3394..85de9606c6e5 100644
22 --- a/sci-geosciences/grass/Manifest
23 +++ b/sci-geosciences/grass/Manifest
24 @@ -1,2 +1,2 @@
25 DIST grass-7.8.6.tar.gz 66331264 BLAKE2B bb5a3387f74bc30b7ce3230765cecdc7e61ded8693d888e6cefc2d491022496409d053e170293fcef392a9c9178a41b070767e1ce90b57b448b189c9e16a2761 SHA512 6db10a20e5b70f0ce9a8fc4d6966c6f078453a88fa8f0577c1c62303f9787fa3bf3369e281f7ca864280c865e3ef022c51d8805d1258ea04da45e63cd34c27df
26 -DIST grass-8.0.0RC2.tar.gz 64942585 BLAKE2B fc7499def2029acb9b547c688eaaad986daae5c80b085bbe876d7bca4d4c7547867375edee752705e30ab215d0b8e0c7f017e94802a549569a525196bbd7bcb4 SHA512 9e624c54974e253dce1b93a0ce1c51eaa421d8baacdf61b03893d34c5cd36af76915ab035fb9bb78af4c16e1efc12bb501a707e335e312a12cf2c17a2b0d6f61
27 +DIST grass-8.0.0.tar.gz 64944539 BLAKE2B 61ea667321599026f2514333e5fe47313d232236a818458939e968d80ed88a511ddc29e2b51edd082bd246b614a0b121b10c09e9059ae31fd5c211e9844d89b1 SHA512 29bd57fb017937b0f3ad105790449704c6f12b56ffe79091f0aceed328f4da5293dd42cc3071158aad5386a51309f35a4f0b9bbd57221431e705f51880c2ce42
28
29 diff --git a/sci-geosciences/grass/files/grass-8.0.0-mkhtml.patch b/sci-geosciences/grass/files/grass-8.0.0-mkhtml.patch
30 new file mode 100644
31 index 000000000000..1eb46012f6a4
32 --- /dev/null
33 +++ b/sci-geosciences/grass/files/grass-8.0.0-mkhtml.patch
34 @@ -0,0 +1,316 @@
35 +--- a/lib/init/variables.html
36 ++++ b/lib/init/variables.html
37 +@@ -234,12 +234,7 @@ PERMANENT
38 + <dt>GRASS_PERL</dt>
39 + <dd>[used during install process for generating man pages]<br>
40 + set Perl with path.</dd>
41 +-
42 +- <dt>GRASS_PROXY</dt>
43 +- <dd>[used during addon install/reinstall process for generating man
44 +- pages (download commit from GitHub API server and remote modules.xml file)]<br>
45 +- set the proxy with: <tt>GRASS_PROXY="http=&lt;value&gt;,ftp=&lt;value&gt;"</tt>.</dd>
46 +-
47 ++
48 + <dt>GRASS_SKIP_MAPSET_OWNER_CHECK</dt>
49 + <dd>By default it is not possible to work with MAPSETs that are
50 + not owned by current user. Setting this variable to any non-empty value
51 +--- a/scripts/g.extension/g.extension.py
52 ++++ b/scripts/g.extension/g.extension.py
53 +@@ -354,6 +354,7 @@ def download_addons_paths_file(url, response_format, *args, **kwargs):
54 + ),
55 + )
56 + return response
57 ++
58 + except HTTPError as err:
59 + if err.code == 403 and err.msg == "rate limit exceeded":
60 + gscript.warning(
61 +@@ -2588,8 +2589,6 @@ def main():
62 + proxy = urlrequest.ProxyHandler(PROXIES)
63 + opener = urlrequest.build_opener(proxy)
64 + urlrequest.install_opener(opener)
65 +- # Required for mkhtml.py script (get addon git commit from GitHub API server)
66 +- os.environ["GRASS_PROXY"] = options["proxy"]
67 +
68 + # define path
69 + options["prefix"] = resolve_install_prefix(
70 +--- a/utils/mkhtml.py
71 ++++ b/utils/mkhtml.py
72 +@@ -16,7 +16,6 @@
73 + #
74 + #############################################################################
75 +
76 +-import http
77 + import sys
78 + import os
79 + import string
80 +@@ -25,9 +24,6 @@ from datetime import datetime
81 + import locale
82 + import json
83 + import pathlib
84 +-import shutil
85 +-import subprocess
86 +-import time
87 +
88 + try:
89 + # Python 2 import
90 +@@ -35,26 +31,11 @@ try:
91 + except ImportError:
92 + # Python 3 import
93 + from html.parser import HTMLParser
94 +-
95 +-from six.moves.urllib import request as urlrequest
96 +-from six.moves.urllib.error import HTTPError, URLError
97 +-
98 + try:
99 + import urlparse
100 + except ImportError:
101 + import urllib.parse as urlparse
102 +
103 +-try:
104 +- import grass.script as gs
105 +-except ImportError:
106 +- # During compilation GRASS GIS
107 +- gs = None
108 +-
109 +-HEADERS = {
110 +- "User-Agent": "Mozilla/5.0",
111 +-}
112 +-HTTP_STATUS_CODES = list(http.HTTPStatus)
113 +-
114 + if sys.version_info[0] == 2:
115 + PY2 = True
116 + else:
117 +@@ -65,24 +46,6 @@ if not PY2:
118 + unicode = str
119 +
120 +
121 +-grass_version = os.getenv("VERSION_NUMBER", "unknown")
122 +-trunk_url = ""
123 +-addons_url = ""
124 +-if grass_version != "unknown":
125 +- major, minor, patch = grass_version.split(".")
126 +- grass_git_branch = "releasebranch_{major}_{minor}".format(
127 +- major=major,
128 +- minor=minor,
129 +- )
130 +- base_url = "https://github.com/OSGeo"
131 +- trunk_url = "{base_url}/grass/tree/{branch}/".format(
132 +- base_url=base_url, branch=grass_git_branch
133 +- )
134 +- addons_url = "{base_url}/grass-addons/tree/grass{major}/".format(
135 +- base_url=base_url, major=major
136 +- )
137 +-
138 +-
139 + def _get_encoding():
140 + encoding = locale.getdefaultlocale()[1]
141 + if not encoding:
142 +@@ -105,151 +68,6 @@ def decode(bytes_):
143 + return unicode(bytes_)
144 +
145 +
146 +-def urlopen(url, *args, **kwargs):
147 +- """Wrapper around urlopen. Same function as 'urlopen', but with the
148 +- ability to define headers.
149 +- """
150 +- request = urlrequest.Request(url, headers=HEADERS)
151 +- return urlrequest.urlopen(request, *args, **kwargs)
152 +-
153 +-
154 +-def set_proxy():
155 +- """Set proxy"""
156 +- proxy = os.getenv("GRASS_PROXY")
157 +- if proxy:
158 +- proxies = {}
159 +- for ptype, purl in (p.split("=") for p in proxy.split(",")):
160 +- proxies[ptype] = purl
161 +- urlrequest.install_opener(
162 +- urlrequest.build_opener(urlrequest.ProxyHandler(proxies))
163 +- )
164 +-
165 +-
166 +-set_proxy()
167 +-
168 +-
169 +-def download_git_commit(url, response_format, *args, **kwargs):
170 +- """Download module/addon last commit from GitHub API
171 +-
172 +- :param str url: url address
173 +- :param str response_format: content type
174 +-
175 +- :return urllib.request.urlopen or None response: response object or
176 +- None
177 +- """
178 +- try:
179 +- response = urlopen(url, *args, **kwargs)
180 +- if not response.code == 200:
181 +- index = HTTP_STATUS_CODES.index(response.code)
182 +- desc = HTTP_STATUS_CODES[index].description
183 +- gs.fatal(
184 +- _(
185 +- "Download commit from <{url}>, return status code "
186 +- "{code}, {desc}".format(
187 +- url=url,
188 +- code=response.code,
189 +- desc=desc,
190 +- ),
191 +- ),
192 +- )
193 +- if response_format not in response.getheader("Content-Type"):
194 +- gs.fatal(
195 +- _(
196 +- "Wrong downloaded commit file format. "
197 +- "Check url <{url}>. Allowed file format is "
198 +- "{response_format}.".format(
199 +- url=url,
200 +- response_format=response_format,
201 +- ),
202 +- ),
203 +- )
204 +- return response
205 +- except HTTPError as err:
206 +- gs.warning(
207 +- _(
208 +- "The download of the commit from the GitHub API "
209 +- "server wasn't successful, <{}>. Commit and commit "
210 +- "date will not be included in the <{}> addon html manual "
211 +- "page.".format(err.msg, pgm)
212 +- ),
213 +- )
214 +- except URLError:
215 +- gs.warning(
216 +- _(
217 +- "Download file from <{url}>, failed. Check internet "
218 +- "connection. Commit and commit date will not be included "
219 +- "in the <{pgm}> addon manual page.".format(url=url, pgm=pgm)
220 +- ),
221 +- )
222 +-
223 +-
224 +-def get_last_git_commit(src_dir, is_addon, addon_path):
225 +- """Get last module/addon git commit
226 +-
227 +- :param str src_dir: module/addon source dir
228 +- :param bool is_addon: True if it is addon
229 +- :param str addon_path: addon path
230 +-
231 +- :return dict git_log: dict with key commit and date, if not
232 +- possible download commit from GitHub API server
233 +- values of keys have "unknown" string
234 +- """
235 +- unknown = "unknown"
236 +- git_log = {"commit": unknown, "date": unknown}
237 +- datetime_format = "%A %b %d %H:%M:%S %Y" # e.g. Sun Jan 16 23:09:35 2022
238 +- if is_addon:
239 +- grass_addons_url = (
240 +- "https://api.github.com/repos/osgeo/grass-addons/commits?path={path}"
241 +- "&page=1&per_page=1&sha=grass{major}".format(
242 +- path=addon_path,
243 +- major=major,
244 +- )
245 +- ) # sha=git_branch_name
246 +- else:
247 +- core_module_path = os.path.join(
248 +- *(set(src_dir.split(os.path.sep)) ^ set(topdir.split(os.path.sep)))
249 +- )
250 +- grass_modules_url = (
251 +- "https://api.github.com/repos/osgeo/grass/commits?path={path}"
252 +- "&page=1&per_page=1&sha={branch}".format(
253 +- branch=grass_git_branch,
254 +- path=core_module_path,
255 +- )
256 +- ) # sha=git_branch_name
257 +-
258 +- if shutil.which("git"):
259 +- if os.path.exists(src_dir):
260 +- git_log["date"] = time.ctime(os.path.getmtime(src_dir))
261 +- stdout, stderr = subprocess.Popen(
262 +- args=["git", "log", "-1", src_dir],
263 +- stdout=subprocess.PIPE,
264 +- stderr=subprocess.PIPE,
265 +- ).communicate()
266 +- stdout = decode(stdout)
267 +- stderr = decode(stderr)
268 +-
269 +- if stderr and "fatal: not a git repository" in stderr:
270 +- response = download_git_commit(
271 +- url=grass_addons_url if is_addon else grass_modules_url,
272 +- response_format="application/json",
273 +- )
274 +- if response:
275 +- commit = json.loads(response.read())
276 +- if commit:
277 +- git_log["commit"] = commit[0]["sha"]
278 +- git_log["date"] = datetime.strptime(
279 +- commit[0]["commit"]["author"]["date"],
280 +- "%Y-%m-%dT%H:%M:%SZ",
281 +- ).strftime(datetime_format)
282 +- else:
283 +- if stdout:
284 +- commit = stdout.splitlines()
285 +- git_log["commit"] = commit[0].split(" ")[-1]
286 +- commit_date = commit[2].lstrip("Date:").strip()
287 +- git_log["date"] = commit_date.rsplit(" ", 1)[0]
288 +- return git_log
289 +-
290 +-
291 + html_page_footer_pages_path = (
292 + os.getenv("HTML_PAGE_FOOTER_PAGES_PATH")
293 + if os.getenv("HTML_PAGE_FOOTER_PAGES_PATH")
294 +@@ -261,6 +79,14 @@ pgm = sys.argv[1]
295 + src_file = "%s.html" % pgm
296 + tmp_file = "%s.tmp.html" % pgm
297 +
298 ++grass_version = os.getenv("VERSION_NUMBER", "unknown")
299 ++trunk_url = ""
300 ++addons_url = ""
301 ++if grass_version != "unknown":
302 ++ major, minor, patch = grass_version.split(".")
303 ++ trunk_url = f"https://github.com/OSGeo/grass/tree/releasebranch_{major}_{minor}/"
304 ++ addons_url = f"https://github.com/OSGeo/grass-addons/tree/grass{major}/"
305 ++
306 + header_base = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
307 + <html>
308 + <head>
309 +@@ -295,9 +121,6 @@ sourcecode = string.Template(
310 + <a href="${URL_SOURCE}">${PGM} source code</a>
311 + (<a href="${URL_LOG}">history</a>)
312 + </p>
313 +-<p>
314 +- ${DATE_TAG}
315 +-</p>
316 + """
317 + )
318 +
319 +@@ -624,7 +447,6 @@ else:
320 + source_url = addons_url
321 + pgmdir = os.path.sep.join(curdir.split(os.path.sep)[-3:])
322 + url_source = ""
323 +-addon_path = None
324 + if os.getenv("SOURCE_URL", ""):
325 + addon_path = get_addon_path()
326 + if addon_path:
327 +@@ -655,23 +477,11 @@ if index_name:
328 + else:
329 + url_log = url_source.replace(tree, commits)
330 +
331 +- git_commit = get_last_git_commit(
332 +- src_dir=curdir,
333 +- addon_path=addon_path if addon_path else None,
334 +- is_addon=True if addon_path else False,
335 +- )
336 +- if git_commit["commit"] == "unknown":
337 +- date_tag = "Accessed: {date}".format(date=git_commit["date"])
338 +- else:
339 +- date_tag = "Latest change: {date} in commit: {commit}".format(
340 +- date=git_commit["date"], commit=git_commit["commit"]
341 +- )
342 + sys.stdout.write(
343 + sourcecode.substitute(
344 + URL_SOURCE=url_source,
345 + PGM=pgm,
346 + URL_LOG=url_log,
347 +- DATE_TAG=date_tag,
348 + )
349 + )
350 + sys.stdout.write(
351
352 diff --git a/sci-geosciences/grass/grass-8.0.0_rc2.ebuild b/sci-geosciences/grass/grass-8.0.0.ebuild
353 similarity index 99%
354 rename from sci-geosciences/grass/grass-8.0.0_rc2.ebuild
355 rename to sci-geosciences/grass/grass-8.0.0.ebuild
356 index 1a9dc30646ec..598e8b0ea52d 100644
357 --- a/sci-geosciences/grass/grass-8.0.0_rc2.ebuild
358 +++ b/sci-geosciences/grass/grass-8.0.0.ebuild
359 @@ -85,6 +85,7 @@ S="${WORKDIR}/${MY_P}"
360 PATCHES=(
361 # bug 746590
362 "${FILESDIR}/${PN}-flock.patch"
363 + "${FILESDIR}/${PN}-${PV}-mkhtml.patch"
364 )
365
366 pkg_setup() {