community/reuse: upgrade to 6.2.0

Ref: https://gitlab.alpinelinux.org/alpine/aports/-/issues/18025
This commit is contained in:
Hugo Osvaldo Barrera 2026-03-28 03:48:36 +00:00 committed by Hugo Barrera
parent e06727d7e0
commit cd73804eda
2 changed files with 107 additions and 5 deletions

View File

@ -0,0 +1,92 @@
From 90bece80a99421e4afc5ba76493b16f865401155 Mon Sep 17 00:00:00 2001
From: Hugo Osvaldo Barrera <hugo@whynothugo.nl>
Date: Mon, 30 Mar 2026 16:14:42 +0200
Subject: [PATCH] Fix wrong endianness for encodings
Several encoding declarations assume that the CPU is little endian, and
fail on processors which are not. Encoding line endings then failed by
producing invalid codepoints.
Properly encode line endings for each encoding using the correct
endianness.
Fixes: https://codeberg.org/fsfe/reuse-tool/issues/1349
---
src/reuse/extract.py | 36 ++++++++++++++++++++++++++++++------
1 file changed, 30 insertions(+), 6 deletions(-)
diff --git a/src/reuse/extract.py b/src/reuse/extract.py
index f15072c..6f5dc69 100644
--- a/src/reuse/extract.py
+++ b/src/reuse/extract.py
@@ -10,6 +10,7 @@
# SPDX-FileCopyrightText: 2024 Skyler Grey <sky@a.starrysky.fyi>
# SPDX-FileCopyrightText: © 2020 Liferay, Inc. <https://liferay.com>
# SPDX-FileCopyrightText: 2025 Simon Barth <simon.barth@gmx.de>
+# SPDX-FileCopyrightText: 2026 Hugo Osvaldo Barrera <hugo@whynothugo.nl>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@@ -206,21 +207,40 @@ for _name in set(chain.from_iterable(aliases.aliases.items())):
if codecs.encode("\r\n", _name) == b"\r\n":
_LINE_ENDING_ENCODINGS_ASCII.add(_name)
_LINE_ENDING_ENCODINGS_ASCII.add("utf_8_sig")
+_LINE_ENDINGS_UTF_16_BE = tuple(
+ ending.encode("utf_16_be") for ending in _LINE_ENDINGS
+)
+_LINE_ENDINGS_UTF_32_BE = tuple(
+ ending.encode("utf_32_be") for ending in _LINE_ENDINGS
+)
_LINE_ENDING_ENCODINGS_UTF_16_LE = {
- "u16",
- "utf16",
- "utf_16",
"unicodelittleunmarked",
"utf_16le",
"utf_16_le",
}
+_LINE_ENDING_ENCODINGS_UTF_16_BE = {
+ "unicodebigunmarked",
+ "utf_16be",
+ "utf_16_be",
+}
_LINE_ENDING_ENCODINGS_UTF_32_LE = {
- "u32",
- "utf32",
- "utf_32",
"utf_32le",
"utf_32_le",
}
+_LINE_ENDING_ENCODINGS_UTF_32_BE = {
+ "utf_32be",
+ "utf_32_be",
+}
+# BOM-dependent encodings (utf_16, utf_32) use native byte order.
+# Map them to the correct LE/BE set based on sys.byteorder.
+_BOM_DEPENDENT_UTF_16 = {"u16", "utf16", "utf_16"}
+_BOM_DEPENDENT_UTF_32 = {"u32", "utf32", "utf_32"}
+if sys.byteorder == "little":
+ _LINE_ENDING_ENCODINGS_UTF_16_LE |= _BOM_DEPENDENT_UTF_16
+ _LINE_ENDING_ENCODINGS_UTF_32_LE |= _BOM_DEPENDENT_UTF_32
+else:
+ _LINE_ENDING_ENCODINGS_UTF_16_BE |= _BOM_DEPENDENT_UTF_16
+ _LINE_ENDING_ENCODINGS_UTF_32_BE |= _BOM_DEPENDENT_UTF_32
#: Default chunk size for reading files.
@@ -452,8 +472,12 @@ def detect_newline(chunk: bytes, encoding: str = "ascii") -> str:
line_endings = _LINE_ENDINGS_ASCII
elif encoding in _LINE_ENDING_ENCODINGS_UTF_16_LE:
line_endings = _LINE_ENDINGS_UTF_16_LE
+ elif encoding in _LINE_ENDING_ENCODINGS_UTF_16_BE:
+ line_endings = _LINE_ENDINGS_UTF_16_BE
elif encoding in _LINE_ENDING_ENCODINGS_UTF_32_LE:
line_endings = _LINE_ENDINGS_UTF_32_LE
+ elif encoding in _LINE_ENDING_ENCODINGS_UTF_32_BE:
+ line_endings = _LINE_ENDINGS_UTF_32_BE
if line_endings is not None:
for line_ending_bytes in line_endings:
--
2.53.0

View File

@ -1,7 +1,7 @@
# Contributor: Dhruvin Gandhi <contact@dhru.vin>
maintainer="Achill Gilgenast <achill@achill.org>"
pkgname=reuse
pkgver=5.1.1
pkgver=6.2.0
pkgrel=0
pkgdesc="Tool for compliance with the REUSE recommendations"
url="https://reuse.software"
@ -37,7 +37,10 @@ subpackages="
$pkgname-zsh-completion
"
source="https://files.pythonhosted.org/packages/source/r/reuse/reuse-$pkgver.tar.gz
skip-failing-tests.patch"
skip-failing-tests.patch
0001-Fix-wrong-endianness-for-encodings.patch
"
options="net" # docs require intersphinx
build() {
gpep517 build-wheel \
@ -48,11 +51,17 @@ build() {
_REUSE_COMPLETE=bash_source ./venv/bin/reuse >reuse.bash
_REUSE_COMPLETE=fish_source ./venv/bin/reuse >reuse.fish
_REUSE_COMPLETE=zsh_source ./venv/bin/reuse >reuse.zsh
make -C docs man
PYTHONPATH="$builddir/src" make -C docs man
}
check() {
pytest -n auto
python3 -m venv --clear --without-pip --system-site-packages .testenv
.testenv/bin/python3 -m installer .dist/*.whl
# When running in $builddir, pytest detects modules inside of src/,
# which leads to errors due to duplicate module definitions.
cd tests
"$builddir"/.testenv/bin/python3 -m pytest
}
package() {
@ -65,6 +74,7 @@ package() {
}
sha512sums="
3c4896cc524bc8301319ade07c83bbdf9455faadf1158ad0fcaec17f59e20f0e3e7912bc26d630b4851231461f12ca634c1f7f54f58d3470699fb7a925ca981f reuse-5.1.1.tar.gz
b6409ae761749ff25ba096ec8fc07491fbf0ae14ccbdcd1ebfb5c42157f0fd2a8d9aaed166fbf05f14cf4f61e16e6b9a6dfefa904f81ada1b8c5375258a2b143 reuse-6.2.0.tar.gz
ac8038203ce522b027b2435d1beea05ea2b813eb2e598fc237e5b8fce826e40cf0266f408cbafcdd9c3f6af6fad56e59cae796b42c0e85a578d83e2d11abc2f8 skip-failing-tests.patch
6caef8ec9862c6320f08e8d1575ac0a31a82f284f79f464d915be32603a12d724867f119d4b4dd434b6dc778e149d5b1bbff37170cb12ac64af1b0e38c0c8c9b 0001-Fix-wrong-endianness-for-encodings.patch
"