[3.4.3] Charmcraft fetch-lib fails with `Library None not found in Charmhub.`
Metadata
Current evaluation
No evaluation has been recorded for this issue yet.
Issue body
### Bug Description
I am using charmcraft: `installed: 3.4.3.post51+g6153055c (6228) 60MB classic`
Installed from channel `latest/edge`
We have done some few changes in the OpenSearch libs and now the `check_libs` started failing with an error instead of simply a list of outdated libs.
Running it locally and I can also reproduce the same error.
This error message is not really helpful and the logs print the entire lib content, making it hard to read.
### To Reproduce
$ git clone https://github.com/canonical/opensearch-operator -b 2/edge
$ cd opensearch-operator
$ charmcraft fetch-lib
Library None not found in Charmhub.
### Environment
OS: 24.04
charmcraft: latest/edge, currently on 3.4.3
### charmcraft.yaml
```yaml
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
type: charm
platforms:
ubuntu@22.04:amd64:
ubuntu@24.04:amd64:
# Files implicitly created by charmcraft without a part:
# - dispatch (https://github.com/canonical/charmcraft/pull/1898)
# - manifest.yaml
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L259)
# Files implicitly copied/"staged" by charmcraft without a part:
# - actions.yaml, config.yaml, metadata.yaml
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L290-L293
# https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L156-L157)
parts:
# "poetry-deps" part name is a magic constant
# https://github.com/canonical/craft-parts/pull/901
poetry-deps:
plugin: nil
build-packages:
- curl
override-build: |
# Use environment variable instead of `--break-system-packages` to avoid failing on older
# versions of pip that do not recognize `--break-system-packages`
# `--user` needed (in addition to `--break-system-packages`) for Ubuntu >=24.04
PIP_BREAK_SYSTEM_PACKAGES=true python3 -m pip install --user --upgrade pip==24.3.1 # renovate: charmcraft-pip-latest
# Use uv to install poetry so that a newer version of Python can be installed if needed by poetry
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh # renovate: charmcraft-uv-latest
# poetry 2.0.0 requires Python >=3.9
if ! "$HOME/.local/bin/uv" python find '>=3.9'
then
# Use first Python version that is >=3.9 and available in an Ubuntu LTS
# (to reduce the number of Python versions we use)
"$HOME/.local/bin/uv" python install 3.10.12 # renovate: charmcraft-python-ubuntu-22.04
fi
"$HOME/.local/bin/uv" tool install --no-python-downloads --python '>=3.9' poetry==2.0.0 --with poetry-plugin-export==1.8.0 # renovate: charmcraft-poetry-latest
ln -sf "$HOME/.local/bin/poetry" /usr/local/bin/poetry
# "charm-poetry" part name is arbitrary; use for consistency
# Avoid using "charm" part name since that has special meaning to charmcraft
charm-poetry:
# By default, the `poetry` plugin creates/stages these directories:
# - lib, src
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/parts/plugins/_poetry.py#L76-L78)
# - venv
# (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/parts/plugins/_poetry.py#L95
# https://github.com/canonical/craft-parts/blob/afb0d652eb330b6aaad4f40fbd6e5357d358de47/craft_parts/plugins/base.py#L270)
plugin: poetry
source: .
after:
- poetry-deps
poetry-export-extra-args: ['--only', 'main,charm-libs']
build-packages:
- libffi-dev # Needed to build Python dependencies with Rust from source
- libssl-dev # Needed to build Python dependencies with Rust from source
- pkg-config # Needed to build Python dependencies with Rust from source
override-build: |
# Workaround for https://github.com/canonical/charmcraft/issues/2068
# rustup used to install rustc and cargo, which are needed to build Python dependencies with Rust from source
if [[ "$CRAFT_PLATFORM" == ubuntu@20.04:* || "$CRAFT_PLATFORM" == ubuntu@22.04:* ]]
then
snap install rustup --classic
else
apt-get install rustup -y
fi
# If Ubuntu version < 24.04, rustup was installed from snap instead of from the Ubuntu
# archive—which means the rustup version could be updated at any time. Print rustup version
# to build log to make changes to the snap's rustup version easier to track
rustup --version
# rpds-py (Python package) >=0.19.0 requires rustc >=1.76, which is not available in the
# Ubuntu 22.04 archive. Install rustc and cargo using rustup instead of the Ubuntu archive
rustup set profile minimal
rustup default 1.83.0 # renovate: charmcraft-rust-latest
craftctl default
# Include requirements.txt in *.charm artifact for easier debugging
cp requirements.txt "$CRAFT_PART_INSTALL/requirements.txt"
# "files" part name is arbitrary; use for consistency
files:
plugin: dump
source: .
build-packages:
- git
override-build: |
# Workaround to add unique identifier (git hash) to charm version while specification
# DA053 - Charm versioning
# (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1)
# is pending review.
python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")'
craftctl default
stage:
- LICENSE
- charm_version
- workload_version
```
### Relevant log output
```shell
$ cat .../charmcraft-20250305-165748.716373.log
2025-03-05 16:57:48.717 Starting charmcraft, version 3.4.3.post51+g6153055c
2025-03-05 16:57:48.717 Log verbosity level set to BRIEF
2025-03-05 16:57:48.717 Preparing application...
2025-03-05 16:57:48.717 Configuring application...
2025-03-05 16:57:48.718 Setting up ConfigService
2025-03-05 16:57:48.730 Build plan: platform=None, build_for=None
2025-03-05 16:57:48.731 Loading project file '/home/pguimaraes/Documents/Canonical/Engineering/DPE-6765-restart-node-not-up/opensearch-operator/charmcraft.yaml'
2025-03-05 16:57:48.751 Using parallel build count of 8 from CPU count
2025-03-05 16:57:48.751 Processing grammar (on amd64 for amd64)
2025-03-05 16:57:48.751 Processing grammar for plugin: nil
2025-03-05 16:57:48.751 Processing grammar for build-packages: ['curl']
2025-03-05 16:57:48.751 Processing grammar for override-build: # Use environment variable instead of `--break-system-packages` to avoid failing on older
# versions of pip that do not recognize `--break-system-packages`
# `--user` needed (in addition to `--break-system-packages`) for Ubuntu >=24.04
PIP_BREAK_SYSTEM_PACKAGES=true python3 -m pip install --user --upgrade pip==24.3.1 # renovate: charmcraft-pip-latest
# Use uv to install poetry so that a newer version of Python can be installed if needed by poetry
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh # renovate: charmcraft-uv-latest
# poetry 2.0.0 requires Python >=3.9
if ! "$HOME/.local/bin/uv" python find '>=3.9'
then
# Use first Python version that is >=3.9 and available in an Ubuntu LTS
# (to reduce the number of Python versions we use)
"$HOME/.local/bin/uv" python install 3.10.12 # renovate: charmcraft-python-ubuntu-22.04
fi
"$HOME/.local/bin/uv" tool install --no-python-downloads --python '>=3.9' poetry==2.0.0 --with poetry-plugin-export==1.8.0 # renovate: charmcraft-poetry-latest
ln -sf "$HOME/.local/bin/poetry" /usr/local/bin/poetry
2025-03-05 16:57:48.751 Processing grammar for plugin: poetry
2025-03-05 16:57:48.751 Processing grammar for source: .
2025-03-05 16:57:48.751 Processing grammar for after: ['poetry-deps']
2025-03-05 16:57:48.751 Not processing grammar for non-grammar enabled keyword poetry-export-extra-args
2025-03-05 16:57:48.751 Processing grammar for build-packages: ['libffi-dev', 'libssl-dev', 'pkg-config']
2025-03-05 16:57:48.751 Processing grammar for override-build: # Workaround for https://github.com/canonical/charmcraft/issues/2068
# rustup used to install rustc and cargo, which are needed to build Python dependencies with Rust from source
if [[ "$CRAFT_PLATFORM" == ubuntu@20.04:* || "$CRAFT_PLATFORM" == ubuntu@22.04:* ]]
then
snap install rustup --classic
else
apt-get install rustup -y
fi
# If Ubuntu version < 24.04, rustup was installed from snap instead of from the Ubuntu
# archive—which means the rustup version could be updated at any time. Print rustup version
# to build log to make changes to the snap's rustup version easier to track
rustup --version
# rpds-py (Python package) >=0.19.0 requires rustc >=1.76, which is not available in the
# Ubuntu 22.04 archive. Install rustc and cargo using rustup instead of the Ubuntu archive
rustup set profile minimal
rustup default 1.83.0 # renovate: charmcraft-rust-latest
craftctl default
# Include requirements.txt in *.charm artifact for easier debugging
cp requirements.txt "$CRAFT_PART_INSTALL/requirements.txt"
2025-03-05 16:57:48.751 Processing grammar for plugin: dump
2025-03-05 16:57:48.751 Processing grammar for source: .
2025-03-05 16:57:48.751 Processing grammar for build-packages: ['git']
2025-03-05 16:57:48.751 Processing grammar for override-build: # Workaround to add unique identifier (git hash) to charm version while specification
# DA053 - Charm versioning
# (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1)
# is pending review.
python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")'
craftctl default
2025-03-05 16:57:48.751 Processing grammar for stage: ['LICENSE', 'charm_version', 'workload_version']
2025-03-05 16:57:48.755 Running charmcraft fetch-lib on host
2025-03-05 16:57:48.879 Libraries found under 'lib/charms': ['charms.data_platform_libs.v0.data_interfaces', 'charms.data_platform_libs.v0.object_storage', 'charms.data_platform_libs.v0.s3', 'charms.grafana_agent.v0.cos_agent', 'charms.opensearch.v0.constants_charm', 'charms.opensearch.v0.constants_secrets', 'charms.opensearch.v0.constants_tls', 'charms.opensearch.v0.helper_charm', 'charms.opensearch.v0.helper_cluster', 'charms.opensearch.v0.helper_conf_setter', 'charms.opensearch.v0.helper_cos', 'charms.opensearch.v0.helper_enums', 'charms.opensearch.v0.helper_http', 'charms.opensearch.v0.helper_networking', 'charms.opensearch.v0.helper_security', 'charms.opensearch.v0.models', 'charms.opensearch.v0.opensearch_backups', 'charms.opensearch.v0.opensearch_base_charm', 'charms.opensearch.v0.opensearch_config', 'charms.opensearch.v0.opensearch_distro', 'charms.opensearch.v0.opensearch_exceptions', 'charms.opensearch.v0.opensearch_fixes', 'charms.opensearch.v0.opensearch_health', 'charms.opensearch.v0.opensearch_internal_data', 'charms.opensearch.v0.opensearch_keystore', 'charms.opensearch.v0.opensearch_locking', 'charms.opensearch.v0.opensearch_nodes_exclusions', 'charms.opensearch.v0.opensearch_peer_clusters', 'charms.opensearch.v0.opensearch_performance_profile', 'charms.opensearch.v0.opensearch_plugin_manager', 'charms.opensearch.v0.opensearch_plugins', 'charms.opensearch.v0.opensearch_relation_peer_cluster', 'charms.opensearch.v0.opensearch_relation_provider', 'charms.opensearch.v0.opensearch_secrets', 'charms.opensearch.v0.opensearch_tls', 'charms.opensearch.v0.opensearch_users', 'charms.operator_libs_linux.v0.passwd', 'charms.operator_libs_linux.v1.systemd', 'charms.operator_libs_linux.v2.snap', 'charms.tls_certificates_interface.v3.tls_certificates']
2025-03-05 16:57:48.879 Setting up StoreService
2025-03-05 16:57:49.019 HTTP 'POST' for 'https://api.charmhub.io/v1/charm/libraries/bulk' with params None and headers {'User-Agent': 'charmcraft/3.4.3.post51+g6153055c ubuntu/24.04 (x86_64) python/3.10.12'}
2025-03-05 16:57:49.728 Verifying local lib LibData(lib_id='6c3e6b6680d64e9c89e611d1a15f65be', api=0, patch=40, content='<lib file content>')
2025-03-05 16:57:49.728 Library None not found in Charmhub.
```
Evaluation history
No evaluation history available.