[build] Stop installing python3-regex via apt to avoid pip uninstall-no-record-file failure#28144
Conversation
…d-file failure Signed-off-by: Yijing Yan <yijingyan@microsoft.com>
|
/azp run Azure.sonic-buildimage |
|
Azure Pipelines successfully started running 1 pipeline(s). |
TEMPORARY: pulls the build-infra fix from sonic-net#28144 (author: yijingyan2) to unblock this PR's CI. The shared 'Build sonic image' stage currently fails on ALL platforms with: Cannot uninstall regex 2024.11.6 ... no RECORD file was found for regex hint: The package was installed by debian because python3-regex is apt-installed without a pip RECORD, so pip cannot upgrade it when the sonic-utilities wheel (via docker-image-py) requires a newer regex. This is unrelated to this PR's docker-sonic-vs changes. DROP THIS COMMIT on the next rebase once sonic-net#28144 has merged into master. Original-change-by: yijingyan2 Ref: sonic-net#28144 Signed-off-by: securely1g <securely1g@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the SONiC build environment/templates to avoid installing python3-regex via Debian apt, preventing pip failures when a wheel later needs to upgrade regex (pip cannot uninstall the apt-installed package due to missing RECORD metadata).
Changes:
- Removes
python3-regexinstallation from the Debian extension template to let pip resolve/installregexvia Python dependencies. - Adds a cleanup step in the trixie build slave image to remove
python3-regexif present, avoiding apt vs pip ownership conflicts.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| sonic-slave-trixie/Dockerfile.j2 | Removes python3-regex from the build slave image to avoid pip uninstall/upgrade conflicts. |
| files/build_templates/sonic_debian_extension.j2 | Stops installing python3-regex via apt in the target filesystem, documenting the pip RECORD conflict rationale. |
| # Let pip own these (avoid apt vs pip no-RECORD uninstall conflicts) | ||
| RUN eatmydata apt-get remove -y python3-regex || true |
|
Cherry-pick PR to 202511: #28180 |
|
Cherry-pick PR to 202605: #28182 |
TEMPORARY: pulls the build-infra fix from sonic-net#28144 (author: yijingyan2) to unblock this PR's CI. The shared 'Build sonic image' stage currently fails on ALL platforms with: Cannot uninstall regex 2024.11.6 ... no RECORD file was found for regex hint: The package was installed by debian because python3-regex is apt-installed without a pip RECORD, so pip cannot upgrade it when the sonic-utilities wheel (via docker-image-py) requires a newer regex. This is unrelated to this PR's docker-sonic-vs changes. DROP THIS COMMIT on the next rebase once sonic-net#28144 has merged into master. Original-change-by: yijingyan2 Ref: sonic-net#28144 Signed-off-by: securely1g <securely1g@users.noreply.github.com>
|
Cherry-pick PR to msft-202608: Azure/sonic-buildimage-msft#2584 |
…no-record-file failure (sonic-net#28144) Signed-off-by: Yijing Yan <yijingyan@microsoft.com>
|
This PR is approved for branch msft-202607. No cherry pick PR has been created because of code conflict. @yijingyan2, please manually create the cherry pick PR. ---Powered by SONiC BuildBot
|
…re/sonic' in registry test (#4674) #### What I did `docker-image-py` was pulled in unpinned (`docker-image-py>=0.1.10`). When **0.2.0** was released (2026-06-29) it changed `Reference.split_docker_domain()` to treat an uppercase first path component as a registry domain (Docker Hub repository names must be lowercase). This broke `tests/sonic_package_manager/test_registry.py::test_get_registry_for`, which resolved the reference `Azure/sonic`. The key point is that `Azure/sonic` is **not a valid Docker Hub reference** in the first place — Docker Hub namespaces must be lowercase (`Azure/...` is rejected as an invalid namespace). So instead of pinning `docker-image-py` to `==0.1.13` (#4660) or reimplementing `split_docker_domain()`, this change simply fixes the test to use the valid lowercase reference `azure/sonic` and drops the pin (`>=0.1.10`), so registry resolution and the test are correct regardless of the installed `docker-image-py` version and the build can adopt 0.2.0. It pairs with sonic-net/sonic-buildimage#28144, which stops installing `python3-regex` via apt so 0.2.0's `regex>=2026.6.28` installs cleanly. #### How I did it - `setup.py`: `docker-image-py==0.1.13` → `docker-image-py>=0.1.10` (drop the pin added in #4660). - `tests/sonic_package_manager/test_registry.py`: `resolver.get_registry_for('Azure/sonic')` → `resolver.get_registry_for('azure/sonic')`. #### How to verify it Run the package-manager registry test with `docker-image-py` 0.2.0 installed: ``` pytest tests/sonic_package_manager/test_registry.py::test_get_registry_for ``` It passes (CI green) — `azure/sonic` resolves to the `DockerHubRegistry` singleton regardless of the `docker-image-py` version. #### Previous command output (if the output of a command-line utility has changed) N/A - no user-facing command output changes. #### New command output (if the output of a command-line utility has changed) N/A - no user-facing command output changes. Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
…no-record-file failure (sonic-net#28144) Signed-off-by: Yijing Yan <yijingyan@microsoft.com>
…re/sonic' in registry test (#394) #### What I did `docker-image-py` was pulled in unpinned (`docker-image-py>=0.1.10`). When **0.2.0** was released (2026-06-29) it changed `Reference.split_docker_domain()` to treat an uppercase first path component as a registry domain (Docker Hub repository names must be lowercase). This broke `tests/sonic_package_manager/test_registry.py::test_get_registry_for`, which resolved the reference `Azure/sonic`. The key point is that `Azure/sonic` is **not a valid Docker Hub reference** in the first place — Docker Hub namespaces must be lowercase (`Azure/...` is rejected as an invalid namespace). So instead of pinning `docker-image-py` to `==0.1.13` (#4660) or reimplementing `split_docker_domain()`, this change simply fixes the test to use the valid lowercase reference `azure/sonic` and drops the pin (`>=0.1.10`), so registry resolution and the test are correct regardless of the installed `docker-image-py` version and the build can adopt 0.2.0. It pairs with sonic-net/sonic-buildimage#28144, which stops installing `python3-regex` via apt so 0.2.0's `regex>=2026.6.28` installs cleanly. #### How I did it - `setup.py`: `docker-image-py==0.1.13` → `docker-image-py>=0.1.10` (drop the pin added in #4660). - `tests/sonic_package_manager/test_registry.py`: `resolver.get_registry_for('Azure/sonic')` → `resolver.get_registry_for('azure/sonic')`. #### How to verify it Run the package-manager registry test with `docker-image-py` 0.2.0 installed: ``` pytest tests/sonic_package_manager/test_registry.py::test_get_registry_for ``` It passes (CI green) — `azure/sonic` resolves to the `DockerHubRegistry` singleton regardless of the `docker-image-py` version. #### Previous command output (if the output of a command-line utility has changed) N/A - no user-facing command output changes. #### New command output (if the output of a command-line utility has changed) N/A - no user-facing command output changes. Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Why I did it
target/python-wheels/trixie/sonic_utilities-1.2-py3-none-any.whl-installandsonic-marvell-prestera-armhf.binstarted failing during thesonic-utilitieswheel install with:sonic-slave-trixieandsonic_debian_extensioninstalledpython3-regexfrom debian apt repo in dist-packages folder without a pip RECORD file, so pip cannot uninstall it later.When the sonic-utilities wheel pulls in a newer regex - currently triggered by sonic-utilities -> docker-image-py (the unbounded
docker-image-py>=0.1.10dependency now resolves to0.2.0, published 2026-06-29, which requiresregex>=2026.6.28) - pip failed onuninstall-no-record-file.Work item tracking
How I did it
python3-regexfromsonic-slave-trixie/Dockerfile.j2python3-regexfromsonic_debian_extension.j2How to verify it
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)