Bug 270670 - devel/llvm*: LLVM_SUFFIX with '-' breaks llvm Python modules
Summary: devel/llvm*: LLVM_SUFFIX with '-' breaks llvm Python modules
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-06 16:02 UTC by Pawel Biernacki
Modified: 2023-04-18 16:49 UTC (History)
1 user (show)

See Also:


Attachments
proposed patch (6.30 KB, patch)
2023-04-06 16:02 UTC, Pawel Biernacki
no flags Details | Diff
updated patch (6.13 KB, patch)
2023-04-07 10:04 UTC, Pawel Biernacki
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Pawel Biernacki freebsd_committer freebsd_triage 2023-04-06 16:02:18 UTC
Created attachment 241325 [details]
proposed patch

I found an issue with the lit tool that comes bundled with llvm (if the LIT options is selected).

% lit-devel
  File "/usr/local/bin/lit-devel", line 3
    from lit-devel.main import main
            ^
SyntaxError: invalid syntax

Lit is written in Python.  The issue is that the LLVM_SUFFIX contains a '-' and sed that is being run during the build to add the LLVM_SUFFIX to filenames inadvertently converts also a Python module name.  Python doesn't support importing modules with dashes in names.

I'm attaching a patch that resolved that issue for me.  It uses an underscore variant of the LLVM_SUFFIX ('_' in a module name is accepted) to change the relevant parts of python lib so lit-devel becomes lit_devel, the script name keeps the expected name of lit-LLVM_SUFFIX.

I only tested it on llvm-devel.
Comment 1 Brooks Davis freebsd_committer freebsd_triage 2023-04-06 20:03:03 UTC
Comment on attachment 241325 [details]
proposed patch

I'd suggest replacing lit${LLVM_SUFFIX} with something like ${LIT_MOD_NAME} where

LIT_MOD_NAME= lit${LLVM_SUFFIX:S/-/_/g}
Comment 2 Pawel Biernacki freebsd_committer freebsd_triage 2023-04-07 10:04:45 UTC
Created attachment 241337 [details]
updated patch

Update patch with suggested change.  Tested again, still resolves the issue.
Comment 3 Brooks Davis freebsd_committer freebsd_triage 2023-04-07 17:39:06 UTC
(In reply to Pawel Biernacki from comment #2)
Thanks! I've applied this and will include it in my next update.
Comment 4 commit-hook freebsd_committer freebsd_triage 2023-04-12 18:01:57 UTC
A commit in branch main references this bug:

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

commit bcc6ffd087d07cdee35c8633863fb0a92f00d346
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-04-12 18:01:19 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-04-12 18:01:19 +0000

    devel/llvm-devel: new snapshot, lit fixes

    Fix the the python module name to use an '_' in place of '-' in the
    port-specific module name.

    Remove a workaround that is now upstream.

    PR:             270670, 269931
    Co-Authored-by: Pawel Biernacki <kaktus@freebsd.org>

 devel/llvm-devel/Makefile                          | 23 +++---
 devel/llvm-devel/Makefile.snapshot                 |  4 +-
 devel/llvm-devel/distinfo                          |  6 +-
 ...ugins_Process_Utility_FreeBSDSignals.cpp (gone) | 13 ----
 devel/llvm-devel/pkg-plist                         | 86 +++++++++++++++-------
 5 files changed, 78 insertions(+), 54 deletions(-)
Comment 5 commit-hook freebsd_committer freebsd_triage 2023-04-18 16:49:36 UTC
A commit in branch main references this bug:

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

commit cd4074145d743032b5237a7caf34de04f73601bf
Author:     Brooks Davis <brooks@FreeBSD.org>
AuthorDate: 2023-04-18 16:48:33 +0000
Commit:     Brooks Davis <brooks@FreeBSD.org>
CommitDate: 2023-04-18 16:48:33 +0000

    devel/llvm-{cheri,morello}: new snapshots, lit fixes

    Fix the the python module name to use an '_' in place of '-' in the
    port-specific module name.

    PR:             270670, 269931
    Sponsored by:   DARPA
    Co-Authored-by: Pawel Biernacki <kaktus@freebsd.org>

 devel/llvm-cheri/Makefile            | 19 ++++++++++--------
 devel/llvm-cheri/Makefile.snapshot   |  4 ++--
 devel/llvm-cheri/distinfo            |  6 +++---
 devel/llvm-cheri/pkg-plist           | 38 ++++++++++++++++++------------------
 devel/llvm-morello/Makefile.snapshot |  4 ++--
 devel/llvm-morello/distinfo          |  6 +++---
 devel/llvm-morello/pkg-plist         | 38 ++++++++++++++++++------------------
 7 files changed, 59 insertions(+), 56 deletions(-)