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

[rtwcli] update rocker extensions #245

Merged
merged 1 commit into from
Nov 7, 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
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
from rocker.core import RockerExtension


class Tmpfs(RockerExtension):
class RTWTmpfs(RockerExtension):
@staticmethod
def get_name() -> str:
return "tmpfs"
return "rtw_tmpfs"

def __init__(self):
self.name = Tmpfs.get_name()
self.name = RTWTmpfs.get_name()

def get_docker_args(self, cliargs: dict) -> str:
args = [" "] # To separate from the previous
Expand All @@ -36,8 +36,8 @@ def get_docker_args(self, cliargs: dict) -> str:
@staticmethod
def register_arguments(parser: argparse.ArgumentParser, defaults: dict = {}) -> None:
parser.add_argument(
name_to_argument(Tmpfs.get_name()),
name_to_argument(RTWTmpfs.get_name()),
action="store_true",
default=defaults.get(Tmpfs.get_name(), None),
default=defaults.get(RTWTmpfs.get_name(), None),
help="Enable tmpfs for /tmp in the container.",
)
40 changes: 40 additions & 0 deletions rtwcli/rtw_rocker_extensions/rtw_rocker_extensions/rtw_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright 2019 Open Source Robotics Foundation
# Copyright (c) 2024, Stogl Robotics Consulting UG (haftungsbeschränkt)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import argparse
from rocker.extensions import name_to_argument
from rocker.core import RockerExtension


class RTWUPdate(RockerExtension):
@staticmethod
def get_name() -> str:
return "rtw_update"

def __init__(self):
self.name = RTWUPdate.get_name()

def get_user_snippet(self, cliargs):
return "RUN sudo apt-get update && rosdep update"

@staticmethod
def register_arguments(parser: argparse.ArgumentParser, defaults: dict = {}) -> None:
parser.add_argument(
name_to_argument(RTWUPdate.get_name()),
action="store_true",
default=defaults.get(RTWUPdate.get_name(), None),
help="RTW: Update after finishing",
)
3 changes: 2 additions & 1 deletion rtwcli/rtw_rocker_extensions/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
tests_require=["pytest"],
entry_points={
"rocker.extensions": [
"rtw_tmpfs = rtw_rocker_extensions.tmpfs:Tmpfs",
"rtw_tmpfs = rtw_rocker_extensions.rtw_tmpfs:RTWTmpfs",
"rtw_update = rtw_rocker_extensions.rtw_update:RTWUPdate",
],
},
)
3 changes: 2 additions & 1 deletion rtwcli/rtwcli/rtwcli/rocker_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ def generate_rocker_flags(
if ws_volumes:
rocker_flags.extend(ws_volumes)

rocker_flags.append("--tmpfs")
rocker_flags.append("--rtw-tmpfs")
rocker_flags.append("--rtw-update")
rocker_flags.append("--x11")
rocker_flags.extend(["--mode", "interactive"])
rocker_flags.extend(["--image-name", f"{final_image_name}"])
Expand Down
Loading