Bug 280468

Summary: multimedia/py-pymediainfo: Update to 6.1.0
Product: Ports & Packages Reporter: Nuno Teixeira <eduardo>
Component: Individual Port(s)Assignee: Nuno Teixeira <eduardo>
Status: Closed FIXED    
Severity: Affects Only Me CC: m.ne
Priority: --- Flags: m.ne: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
URL: https://github.com/sbraz/pymediainfo/releases
Attachments:
Description Flags
Update to 6.1.0, +pep517, +pytest
none
Update to 6.1.0, +pep517, +pytest, +fix UTF extract none

Description Nuno Teixeira freebsd_committer freebsd_triage 2024-07-27 15:35:29 UTC
Created attachment 252321 [details]
Update to 6.1.0, +pep517, +pytest

I'm working on importing new python ports that required latest version of pymediainfo.

There is my sugestion:

- Switch to pep517 build
- Add pytest

NOTES:

tests run ok after fixing "accentué.txt" file that it is installed as "accentu?.txt"

from src:
tests/test_pymediainfo.py: self.media_info = MediaInfo.parse(os.path.join(data_dir, "accentué.txt"))

fixed in port:
post-install:
        ${MV} ${WRKSRC}/tests/data/accentu\?.txt ${WRKSRC}/tests/data/accentué.txt

Maybe this issue must be discussed at upstream as it appears to be a packaging problem (?).
Comment 1 Martin Neubauer 2024-07-28 12:32:56 UTC
(In reply to Nuno Teixeira from comment #0)
I haven't had time to look too deeply into the issue, but I noticed your proposed fix operates in WRKSRC only, so post-extract might be more appropriate. But either way, could you share the failure messages you get without the fix present as well as the locale you're using? Especially the latter aspect might provide some insight:

% tar tf pymediainfo-6.1.0.tar.gz | grep acc
pymediainfo-6.1.0/tests/data/accentué.txt
% LANG=C tar tf pymediainfo-6.1.0.tar.gz | grep acc
pymediainfo-6.1.0/tests/data/accentu\303\251.txt
Comment 2 Nuno Teixeira freebsd_committer freebsd_triage 2024-07-28 13:16:49 UTC
(In reply to Martin Neubauer from comment #1)

Hello Martin,

poudriere interactive jail:

(LANG=C.UTF-8 is shown in enviroment)

nobody@15amd64-main:/usr/ports/multimedia/py-pymediainfo $ LANG=C.UTF-8 tar tf /distfiles/pymediainfo-6.1.0.tar.gz | grep acc
pymediainfo-6.1.0/tests/data/accentué.txt
nobody@15amd64-main:/usr/ports/multimedia/py-pymediainfo $ LANG=C tar tf /distfiles/pymediainfo-6.1.0.tar.gz | grep acc
pymediainfo-6.1.0/tests/data/accentu?.txt


Without the post-install hack, tests fail with:

>                   raise FileNotFoundError(filename)
E                   FileNotFoundError: /wrkdirs/usr/ports/multimedia/py-pymediainfo/work-py311/pymediainfo-6.1.0/tests/data/accentué.txt

It seems that while default poudriere LANG is C.UTF-8, somehow it istalls using C.

I will try to force LANG in port to check if it helps.
Comment 3 Nuno Teixeira freebsd_committer freebsd_triage 2024-07-28 13:22:39 UTC
(In reply to Nuno Teixeira from comment #2)
(...)

+ USE_LOCALE= C.UTF-8 doesn't help
Comment 4 Nuno Teixeira freebsd_committer freebsd_triage 2024-07-28 13:31:37 UTC
Created attachment 252334 [details]
Update to 6.1.0, +pep517, +pytest, +fix UTF extract

Apply fix as in lang/go-devel:

# Upstream archive contains files with UTF-8 names
EXTRACT_CMD=    ${SETENV} LC_ALL=en_US.UTF-8 ${TAR}

Using C.UTF-8 instead of en_US.UTF-8
Comment 5 Martin Neubauer 2024-07-28 20:52:32 UTC
(In reply to Nuno Teixeira from comment #4)
Thanks, that looks like properly handling the issue. LGTM
Comment 6 commit-hook freebsd_committer freebsd_triage 2024-07-28 23:00:09 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=6cffdc259b6d5e0d52d61398d170e6541c0ba790

commit 6cffdc259b6d5e0d52d61398d170e6541c0ba790
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2024-07-28 22:56:27 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2024-07-28 22:56:27 +0000

    multimedia/py-pymediainfo: Update to 6.1.0

    - Switch to DISTVERSION
    - Switch to pep517 build
    - Add tests

    ChangeLog:      https://github.com/sbraz/pymediainfo/releases
    PR:             280468

 multimedia/py-pymediainfo/Makefile | 14 +++++++++-----
 multimedia/py-pymediainfo/distinfo |  6 +++---
 2 files changed, 12 insertions(+), 8 deletions(-)
Comment 7 Nuno Teixeira freebsd_committer freebsd_triage 2024-07-28 23:03:49 UTC
I will continue to search if this is the best way to deal with UTF file names.
If I found a better way then I reopen PR.

Committed, thanks!