Skip to content

BUG: UCC fails during package cleanup when using os-dependentLibraries #1972

@eliykat

Description

@eliykat

Description

When using os-dependentLibraries, UCC fails during cleanup.

Example configuration from globalConfig.json:

        "os-dependentLibraries": [
            {
                "name": "charset-normalizer",
                "version": "3.4.1",
                "dependencies": true,
                "platform": "none",
                "python_version": "3.9",
                "os": "linux",
                "target": "linux"
            }
        ]

Error when running poetry run ucc-gen build:

Traceback (most recent call last):
  File "/Users/eliykat/Library/Caches/pypoetry/virtualenvs/bitwarden-event-logs-tLbDvKTI-py3.9/lib/python3.9/site-packages/splunk_add_on_ucc_framework/commands/build.py", line 460, in inner_function
    func(*args, **kwargs)
  File "/Users/eliykat/Library/Caches/pypoetry/virtualenvs/bitwarden-event-logs-tLbDvKTI-py3.9/lib/python3.9/site-packages/splunk_add_on_ucc_framework/commands/build.py", line 583, in generate
    install_python_libraries(
  File "/Users/eliykat/Library/Caches/pypoetry/virtualenvs/bitwarden-event-logs-tLbDvKTI-py3.9/lib/python3.9/site-packages/splunk_add_on_ucc_framework/install_python_libraries.py", line 274, in install_python_libraries
    remove_packages(
  File "/Users/eliykat/Library/Caches/pypoetry/virtualenvs/bitwarden-event-logs-tLbDvKTI-py3.9/lib/python3.9/site-packages/splunk_add_on_ucc_framework/install_python_libraries.py", line 436, in remove_packages
    if _remove_package(installation_path, package_name):
  File "/Users/eliykat/Library/Caches/pypoetry/virtualenvs/bitwarden-event-logs-tLbDvKTI-py3.9/lib/python3.9/site-packages/splunk_add_on_ucc_framework/install_python_libraries.py", line 392, in _remove_package
    os.remove(os.path.join(installation_path, path))
FileNotFoundError: [Errno 2] No such file or directory: '/Users/eliykat/Projects/splunk/output/bitwarden_event_logs/lib/../../bin/normalizer'

This appears to have been introduced by #1915, which uses the dependency's RECORD file to clean up its files. In this case, the RECORD file looks like this:

$ cat output/bitwarden_event_logs/lib/linux/charset_normalizer-3.4.1.dist-info/RECORD
../../bin/normalizer,sha256=WnpJW2eHL0nLt7OAW3FEzQa-z76mVV9n13FIVwUop3E,287
[further lines omitted]

As the stack trace shows, UCC concatenates this to /Users/eliykat/Projects/splunk/output/bitwarden_event_logs/lib/../../bin/normalizer, however the actual file is located in /Users/eliykat/Projects/splunk/output/bitwarden_event_logs/lib/bin/normalizer.

This appears to be an upstream pip bug where the RECORD file is not updated properly when using pip install --target: pypa/pip#7658. That bug has been open since 2020, but perhaps there is some workaround that can be implemented in this repository in the meantime.

As this all occurs inside the UCC build code, I wasn't able to implement any workaround from the outside in my own build scripts. I have changed to using an arm-64 runner instead so that I could remove the os-dependentLibraries option.

What UCC version are you using?

6.1.0 but should be present in >= 6.0.0

Additional System Info

macOS Tahoe 26.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagePending triage from maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions