Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge 'hotfix/1.3' back into 'main' #558

Merged
merged 2 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions rockcraft/pebble.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
from craft_application.errors import CraftValidationError
from craft_cli import emit

from rockcraft.constants import ROCK_CONTROL_DIR


def _alias_generator(name: str) -> str:
"""Convert underscores to dashes in aliases."""
Expand Down Expand Up @@ -168,7 +166,7 @@ class Pebble:

PEBBLE_PATH = "var/lib/pebble/default"
PEBBLE_LAYERS_PATH = f"{PEBBLE_PATH}/layers"
PEBBLE_BINARY_DIR = f"{ROCK_CONTROL_DIR}/bin"
PEBBLE_BINARY_DIR = "usr/bin"
PEBBLE_BINARY_PATH = f"{PEBBLE_BINARY_DIR}/pebble"
PEBBLE_BINARY_PATH_PREVIOUS = "bin/pebble"
_BASE_PART_SPEC = {
Expand Down
15 changes: 15 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ apps:

build-packages:
- libapt-pkg-dev
- libffi-dev # for cffi (via pygit2)
- libyaml-dev
- python3.10-dev
- pkg-config
Expand Down Expand Up @@ -50,6 +51,19 @@ parts:
organize:
"usr/bin/fuse-overlayfs": "libexec/rockcraft/fuse-overlayfs"

libgit2: # part came from snapcraft@5fbaab144842f
source: https://github.com/libgit2/libgit2/archive/refs/tags/v1.7.1.tar.gz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shallow-cloning the repository at this specific tag could be better than downloading the tarball.

source-checksum: sha256/17d2b292f21be3892b704dddff29327b3564f96099a1c53b00edc23160c71327
plugin: cmake
cmake-parameters:
- -DCMAKE_INSTALL_PREFIX=/usr
build-packages:
- libssl-dev
build-attributes:
- enable-patchelf
prime:
- -usr/include

rockcraft:
source: .
plugin: python
Expand Down Expand Up @@ -77,6 +91,7 @@ parts:
sed -i -e '1 s|^#!/.*|#!/snap/rockcraft/current/bin/python -E|' $CRAFT_PART_INSTALL/bin/craftctl
after:
- rockcraft-libs
- libgit2

umoci:
plugin: make
Expand Down
5 changes: 3 additions & 2 deletions tests/spread/rockcraft/base-devel/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ execute: |
docker-daemon:base-devel:0.1
rm base-devel_0.1_amd64.rock
docker images base-devel:0.1
id=$(docker run --rm -d base-devel:0.1)
test "$(docker inspect "$id" -f '{{json .Config.Entrypoint}}')" = '["/.rock/bin/pebble","enter"]'
id=$(docker run -d base-devel:0.1)
test "$(docker inspect "$id" -f '{{json .Config.Entrypoint}}')" = '["/usr/bin/pebble","enter"]'
docker exec "$id" pebble services
docker rm -f "$id"

restore: |
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def test_application_expand_environment(new_dir, default_application):
@pytest.mark.parametrize(
("base", "build_base", "expected_spec"),
[
# 24.04 and beyond: pebble exists in .rock/bin/
# 24.04 and beyond: pebble exists in usr/bin/
("bare", "devel", Pebble.PEBBLE_PART_SPEC),
("[email protected]", "devel", Pebble.PEBBLE_PART_SPEC),
# 20.04 and 22.04: pebble exists in bin/
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_pebble.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class TestPebble:
def test_attributes(self):
assert Pebble.PEBBLE_PATH == "var/lib/pebble/default"
assert Pebble.PEBBLE_LAYERS_PATH == "var/lib/pebble/default/layers"
assert Pebble.PEBBLE_BINARY_PATH == ".rock/bin/pebble"
assert Pebble.PEBBLE_BINARY_PATH == "usr/bin/pebble"
assert Pebble.PEBBLE_BINARY_PATH_PREVIOUS == "bin/pebble"
assert all(
field in Pebble.PEBBLE_PART_SPEC
Expand Down
Loading