Skip to content

Commit

Permalink
chore: rename ROCKs to rocks
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdcordeiro committed Dec 7, 2023
1 parent 6338d4d commit 83ed53f
Show file tree
Hide file tree
Showing 35 changed files with 72 additions and 72 deletions.
2 changes: 1 addition & 1 deletion rockcraft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""The craft tool to create ROCKs."""
"""The craft tool to create rocks."""

try:
from ._version import __version__
Expand Down
8 changes: 4 additions & 4 deletions rockcraft/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ class InitCommand(AppCommand):

_INIT_TEMPLATE_YAML = textwrap.dedent(
"""\
name: my-rock-name # the name of your ROCK
base: [email protected] # the base environment for this ROCK
name: my-rock-name # the name of your rock
base: [email protected] # the base environment for this rock
version: '0.1' # just for humans. Semantic versioning is recommended
summary: Single-line elevator pitch for your amazing ROCK # 79 char long summary
summary: Single-line elevator pitch for your amazing rock # 79 char long summary
description: |
This is my my-rock-name's description. You have a paragraph or two to tell the
most important story about it. Keep it under 100 words though,
we live in tweetspace and your description wants to look good in the
container registries out there.
license: GPL-3.0 # your application's SPDX license
platforms: # The platforms this ROCK should be built on and run on
platforms: # The platforms this rock should be built on and run on
amd64:
parts:
Expand Down
2 changes: 1 addition & 1 deletion rockcraft/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

"""Handling of files and directories for ROCKs image layers."""
"""Handling of files and directories for rocks image layers."""
import os
import tarfile
from collections import defaultdict
Expand Down
18 changes: 9 additions & 9 deletions rockcraft/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def _validate_platform_set(cls, values: Mapping[str, Any]) -> Mapping[str, Any]:
if len(build_for) > 1:
raise CraftValidationError(
str(
f"Trying to build a ROCK for {build_for} "
f"Trying to build a rock for {build_for} "
"but multiple target architectures are not "
"currently supported. Please specify only 1 value."
)
Expand All @@ -88,7 +88,7 @@ def _validate_platform_set(cls, values: Mapping[str, Any]) -> Mapping[str, Any]:

NAME_REGEX = r"^([a-z](?:-?[a-z0-9]){2,})$"
"""
The regex for valid names for ROCKs. It matches the accepted values for pebble
The regex for valid names for rocks. It matches the accepted values for pebble
layer files:
- must start with a lowercase letter [a-z]
Expand All @@ -99,14 +99,14 @@ def _validate_platform_set(cls, values: Mapping[str, Any]) -> Mapping[str, Any]:
"""

INVALID_NAME_MESSAGE = (
"Invalid name for ROCK (must contain only lowercase letters, numbers and hyphens)"
"Invalid name for rock (must contain only lowercase letters, numbers and hyphens)"
)

DEPRECATED_COLON_BASES = ["ubuntu:20.04", "ubuntu:22.04"]


class NameStr(pydantic.ConstrainedStr):
"""Constrained string type only accepting valid ROCK names."""
"""Constrained string type only accepting valid rock names."""

regex = re.compile(NAME_REGEX)

Expand Down Expand Up @@ -158,7 +158,7 @@ def _check_unsupported_options(cls, values: Mapping[str, Any]) -> Mapping[str, A
# pylint: disable=unused-argument
unsupported_msg = str(
"The fields 'entrypoint', 'cmd' and 'env' are not supported in "
"Rockcraft. All ROCKs have Pebble as their entrypoint, so you must "
"Rockcraft. All rocks have Pebble as their entrypoint, so you must "
"use 'services' to define your container application and "
"respective environment."
)
Expand Down Expand Up @@ -186,7 +186,7 @@ def _validate_license(cls, rock_license: str) -> str:
@pydantic.validator("title", always=True)
@classmethod
def _validate_title(cls, title: str | None, values: Mapping[str, Any]) -> str:
"""If title is not provided, it defaults to the provided ROCK name."""
"""If title is not provided, it defaults to the provided rock name."""
if not title:
title = values.get("name", "")
return cast(str, title)
Expand Down Expand Up @@ -271,7 +271,7 @@ def _validate_all_platforms(cls, platforms: dict[str, Any]) -> dict[str, Any]:
if not any(b_o in SUPPORTED_ARCHS for b_o in build_on_one_of):
raise CraftValidationError(
str(
f"{error_prefix}: trying to build ROCK in one of "
f"{error_prefix}: trying to build rock in one of "
f"{build_on_one_of}, but none of these build architectures is supported. "
f"Supported architectures: {list(SUPPORTED_ARCHS.keys())}"
)
Expand All @@ -280,7 +280,7 @@ def _validate_all_platforms(cls, platforms: dict[str, Any]) -> dict[str, Any]:
if build_target not in SUPPORTED_ARCHS:
raise CraftValidationError(
str(
f"{error_prefix}: trying to build ROCK for target "
f"{error_prefix}: trying to build rock for target "
f"architecture {build_target}, which is not supported. "
f"Supported architectures: {list(SUPPORTED_ARCHS.keys())}"
)
Expand Down Expand Up @@ -397,7 +397,7 @@ def _repr_str(dumper, data):
def generate_metadata(
self, generation_time: str, base_digest: bytes
) -> tuple[dict, dict]:
"""Generate the ROCK's metadata (both the OCI annotation and internal metadata.
"""Generate the rock's metadata (both the OCI annotation and internal metadata.
:param generation_time: the UTC time at the time of calling this method
:param base_digest: digest of the base image
Expand Down
14 changes: 7 additions & 7 deletions rockcraft/oci.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ def add_user(
username: str,
uid: int,
) -> None:
"""Create a new ROCK user.
"""Create a new rock user.
:param prime_dir: Path to the user-defined parts' primed content.
:param base_layer_dir: Path to the base layer's root filesystem.
:param tag: The ROCK's image tag.
:param tag: The rock's image tag.
:param username: Username to be created. Same as group name.
:param uid: UID of the username to be created. Same as GID.
"""
Expand Down Expand Up @@ -401,8 +401,8 @@ def set_pebble_layer(
:param services: The Pebble services
:param checks: The Pebble checks
:param name: The name of the ROCK
:param tag: The ROCK's image tag
:param name: The name of the rock
:param tag: The rock's image tag
:param summary: The summary for the Pebble layer
:param description: The description for the Pebble layer
:param base_layer_dir: Path to the base layer's root filesystem
Expand Down Expand Up @@ -452,15 +452,15 @@ def set_environment(self, env: dict[str, str]) -> None:
emit.progress(f"Environment set to {env_list}")

def set_control_data(self, metadata: dict[str, Any]) -> None:
"""Create and populate the ROCK's control data folder.
"""Create and populate the rock's control data folder.
:param metadata: content for the ROCK's metadata YAML file
:param metadata: content for the rock's metadata YAML file
"""

emit.progress("Setting the rock's control data")
local_control_data_path = Path(tempfile.mkdtemp())

# the ROCK control data structure starts with the folder ".rock"
# the rock control data structure starts with the folder ".rock"
control_data_rock_folder = local_control_data_path / ".rock"
control_data_rock_folder.mkdir()

Expand Down
2 changes: 1 addition & 1 deletion rockcraft/pebble.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def define_pebble_layer(
:param target_dir: Path where to write the new Pebble layer file
:param ref_fs: filesystem to use as a reference when inferring the layer name
:param layer_content: the actual Pebble layer, in JSON
:param rock_name: name of the ROCK where the layer will end up
:param rock_name: name of the rock where the layer will end up
"""
# NOTE: the layer's filename prefix will always be "001-" when using
# "bare" and "ubuntu" bases
Expand Down
4 changes: 2 additions & 2 deletions rockcraft/plugins/python_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PythonPlugin(python_plugin.PythonPlugin):
"""A Python plugin for Rockcraft.
This plugin extends Craft-parts' vanilla Python plugin to properly
set the Python interpreter according to the ROCK's base. Specifically:
set the Python interpreter according to the rock's base. Specifically:
- If the base is ubuntu, the venv-created symlinks in bin/ are removed
altogether. This is because of the usrmerge; when the layer is added on
Expand Down Expand Up @@ -108,7 +108,7 @@ def get_build_commands(self) -> list[str]:
commands.extend(super().get_build_commands())

# Add a "sitecustomize.py" module to handle the very common case of the
# ROCK's interpreter being called as "python3"; in this case, because of
# rock's interpreter being called as "python3"; in this case, because of
# the default $PATH, "/usr/bin/python3" ends up being called and that is
# *not* the venv-aware executable. This sitecustomize adds the location
# of the pip-installed packages.
Expand Down
2 changes: 1 addition & 1 deletion rockcraft/services/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def pack(self, prime_dir: pathlib.Path, dest: pathlib.Path) -> list[pathlib.Path

if platform is None:
# This should only happen in destructive mode, in which case we
# can only pack a single ROCK.
# can only pack a single rock.
build_on = util.get_host_architecture()
base_build_plan = self._project.get_build_plan()
build_plan = [
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[metadata]
name = rockcraft
version = attr: rockcraft.__version__
description="Create ROCKS"
description="Create rocks"
long_description = file: README.rst
url = https://github.com/canonical/rockcraft
project_urls =
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: rockcraft
base: core22
summary: A craft like experience to create ROCKS
summary: A craft like experience to create rockS
description: |
Rockcraft aims to take the same primitives used in Charmcraft and Snapcraft
to create OCI images.
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/bare-base/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: bare-base-test
version: latest
summary: A tiny ROCK
description: Building a tiny ROCK from a bare base, with just one package
summary: A tiny rock
description: Building a tiny rock from a bare base, with just one package
license: Apache-2.0
build-base: [email protected]
base: bare
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/big/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: big
version: latest
summary: A big ROCK to test many features
summary: A big rock to test many features
description: |
A big ROCK whose purpose is to test many features while only paying the "setup"
A big rock whose purpose is to test many features while only paying the "setup"
and "teardown" price once. Feel free to add to this file and to "task.yaml",
adding references to issues/PRs where appropriate.
license: Apache-2.0
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/big/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ execute: |
docker images
# Check the ROCK's output
# Check the rock's output
docker run --rm big:latest | MATCH "/tmp"
############################################################################################
Expand Down Expand Up @@ -57,7 +57,7 @@ execute: |
############################################################################################
# This check documents the fact that we currently don't preserve/observe symlinks between
# layers - we only take the base on which the ROCK was built into account. If the behavior
# layers - we only take the base on which the rock was built into account. If the behavior
# changes, this check will break and then can be removed/updated.
############################################################################################
docker run --rm big exec readlink /.rock | NOMATCH fake_rock_dir
4 changes: 2 additions & 2 deletions tests/spread/general/chisel/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: chiseled-dotnet
summary: A "bare" ROCK containing the .NET runtime
description: A "bare" ROCK containing the .NET runtime
summary: A "bare" rock containing the .NET runtime
description: A "bare" rock containing the .NET runtime
license: Apache-2.0

version: "0.0.1"
Expand Down
2 changes: 1 addition & 1 deletion tests/spread/general/chisel/task.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
summary: a test that checks ROCKs created with Chisel slices
summary: a test that checks rocks created with Chisel slices

execute: |
run_rockcraft pack
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/clean/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: clean
base: [email protected]
version: '0.1'
summary: A minimal hello world ROCK
description: A minimal hello world ROCK
summary: A minimal hello world rock
description: A minimal hello world rock
license: GPL-3.0
platforms:
amd64:
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/destructive/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: destructive-mode
version: latest
summary: A destructively-built ROCK
description: Building a ROCK in destructive mode
summary: A destructively-built rock
description: Building a rock in destructive mode
license: Apache-2.0
build-base: ubuntu:22.04 # Leaving ":"-notation on purpose here
base: bare
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/entrypoint-service/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: entrypoint-service-test
version: latest
base: [email protected]
summary: A ROCK with an entrypoint-service field
description: A ROCK with an entrypoint-service field
summary: A rock with an entrypoint-service field
description: A rock with an entrypoint-service field
license: Apache-2.0
entrypoint-service: test-service
services:
Expand Down
2 changes: 1 addition & 1 deletion tests/spread/general/environment/rockcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: environment-test
version: latest
base: [email protected]
summary: Environment
description: A ROCK with an environment but no real purpose
description: A rock with an environment but no real purpose
license: Apache-2.0
environment:
FOO: bar
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/health-checks/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: healthy-rock
summary: A ROCK with health checks
description: A test ROCK with a bunch of different Pebble checks
summary: A rock with health checks
description: A test rock with a bunch of different Pebble checks
license: Apache-2.0

version: latest
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/invalid-name/rockcraft.orig.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: placeholder-name
base: [email protected]
version: '0.1'
summary: A ROCK with an invalid name
description: A ROCK with an invalid name
summary: A rock with an invalid name
description: A rock with an invalid name
license: GPL-3.0
platforms:
amd64:
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/invalid-name/task.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
summary: check that invalid ROCK names are blocked
summary: check that invalid rock names are blocked

execute: |
for name in a_a a@a a--a aa-
do
sed "s/placeholder-name/$name/" rockcraft.orig.yaml > rockcraft.yaml
rockcraft pack 2>&1 >/dev/null | MATCH "Invalid name for ROCK"
rockcraft pack 2>&1 >/dev/null | MATCH "Invalid name for rock"
done
2 changes: 1 addition & 1 deletion tests/spread/general/plugin-go/rockcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: go-pebble
summary: A ROCK built with go
summary: A rock built with go
description: The go version used does not interfere with the one used for pebble
license: Apache-2.0

Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/plugin-python-3.6/task.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
summary: Build ROCKs with Python 3.6 with bases bare and [email protected]
summary: Build rocks with Python 3.6 with bases bare and [email protected]
environment:
BASE/base_2004: "[email protected]"
BASE/bare: "bare"
Expand All @@ -10,7 +10,7 @@ execute: |
grep placeholder-base rockcraft.orig.yaml
sed "s/placeholder-base/$BASE/" rockcraft.orig.yaml > rockcraft.yaml
# Build the ROCK & load it into docker
# Build the rock & load it into docker
run_rockcraft pack
ROCK=$(ls ./*.rock)
sudo /snap/rockcraft/current/bin/skopeo --insecure-policy copy oci-archive:"${ROCK}" docker-daemon:${IMAGE}
Expand Down
4 changes: 2 additions & 2 deletions tests/spread/general/plugin-python/parts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# main task.yaml).

version: '0.1'
summary: A ROCK that bundles a Python project.
description: A ROCK that bundles a Python project.
summary: A rock that bundles a Python project.
description: A rock that bundles a Python project.
license: GPL-3.0
platforms:
amd64:
Expand Down
2 changes: 1 addition & 1 deletion tests/spread/general/plugin-python/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ execute: |
# copy the Python source of the project we're building (also shared)
cp -r ../src .
# Build the ROCK & load it into docker
# Build the rock & load it into docker
run_rockcraft pack
test -f ${ROCK_FILE}
sudo /snap/rockcraft/current/bin/skopeo --insecure-policy copy oci-archive:${ROCK_FILE} docker-daemon:${IMAGE}
Expand Down
2 changes: 1 addition & 1 deletion tests/spread/general/prune/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ execute: |
test -f ./*.rock
# Unpack the ROCK and verify that the lifecycle-based layer has no files in
# Unpack the rock and verify that the lifecycle-based layer has no files in
# common with the base Ubuntu layer.
tar -xf ./*.rock
python3 check_layers.py ./*.rock
Expand Down
Loading

0 comments on commit 83ed53f

Please sign in to comment.