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

Apt install all at once #990

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
14519b3
support veresion specific install for pip (and other installeres)
k-okada Jul 18, 2019
66e92f4
installer.resolve takes two arguments
k-okada May 10, 2020
fc816c5
rosdep2/lookup.py: self.resolve requries Dependency
k-okada May 10, 2020
6d09a34
rosdep resovle retuns pkg<=0.0 not 'pkg<=0.0'
k-okada May 10, 2020
a02be27
feat: don't test installs
MrBlenny Apr 28, 2022
73b215e
Merge branch 'pip_version' of https://github.com/k-okada/rosdep into …
MrBlenny May 19, 2022
c8b6c74
feat: add version_eq resolver to the apt installer
MrBlenny May 20, 2022
1f560a7
feat: deb and pip version pinning in package xml [sc-4323]
MrBlenny May 20, 2022
955450f
Merge branch 'master' into greenroom
russkel Jun 2, 2022
b5b3da4
fix: change order of installers
russkel Jun 3, 2022
bda5709
Fix backwards compat (#3)
russkel Jun 16, 2022
df380c6
Merge remote-tracking branch 'upstream/master' into greenroom
russkel Jun 16, 2022
1ebd77a
feat: automatically authenticate with github PAT if relevant
russkel Jun 20, 2022
deddd40
fix: monkeypatch rosdistro to use new proper urlopen
russkel Jun 20, 2022
68bdc6a
feat: ability to overlay repositories to a distribution
russkel Jun 17, 2022
ba527fd
feat: print overlay index url if using
russkel Jun 20, 2022
33d1168
Require setuptools, src/rosdep2/platforms/pip.py imports pkg_resource…
hrnciar Jun 24, 2022
fc8a992
Bump minimum Python 3 version in stdeb to 3.6 (#879)
cottsay Jun 24, 2022
44f2306
Update developer documentation to reflect mock dependency (#880)
cottsay Jun 24, 2022
63b6764
Run tests against Python 3.10 (#883)
cottsay Jun 24, 2022
dff2701
Ignore rosdep's own deprecations when running rosdep tests (#882)
cottsay Jun 24, 2022
8492e51
Declare test dependencies in [test] extra (#881)
cottsay Jun 24, 2022
0452bc1
Mark linter tests and tests which require network (#884)
cottsay Jun 24, 2022
584cafd
0.22.0
cottsay Jun 24, 2022
b7e5d54
Drop ROS Python package dependencies in debs (#887)
cottsay Jun 24, 2022
c4e30c6
Drop some over-agressive asserts from test_rosdep_main (#888)
cottsay Jun 24, 2022
82729d8
0.22.1
cottsay Jun 24, 2022
04bfe5d
fix: versions need to be str
russkel Jun 27, 2022
0bfbfd6
feat: specify overlays in overlays.list file
russkel Nov 4, 2022
364d8d7
Merge remote-tracking branch 'upstream/master' into greenroom
russkel Nov 7, 2022
a99530f
chore: not really an error if already init'ed
russkel Jan 18, 2023
d7ce36c
feat: add API_TOKEN_GITHUB support
MrBlenny Apr 3, 2023
adb418c
fix: syntax error
MrBlenny Apr 3, 2023
a008976
fix: --allow-downgrades for apt packages (#5)
MrBlenny Jun 7, 2023
81f7b9a
Merge remote-tracking branch 'upstream/master' into greenroom
russkel Jul 24, 2023
3e2dd96
Apt install now installs all packages at once
Apr 15, 2024
2a08391
Merge remote-tracking branch 'upstream/master' into greenroom
russkel May 22, 2024
192b0b0
fix: pip break-system-packages flag if on the new ver
russkel May 22, 2024
5926da6
Merge branch 'feature/apt_install_at_once' of github.com:SubaruArai/r…
MrBlenny Oct 17, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Run tests

on: # yamllint disable-line rule:truthy
push:
branches: ['master']
branches: ['greenroom']
pull_request:

jobs:
Expand Down
15 changes: 10 additions & 5 deletions src/rosdep2/installers.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def get_depends(self, rosdep_args):
"""
return [] # Default return empty list

def resolve(self, rosdep_args_dict):
def resolve(self, rosdep_args_dict, rosdep=None):
"""
:param rosdep_args_dict: argument dictionary to the rosdep rule for this package manager
:returns: [resolutions]. resolved objects should be printable to a user, but are otherwise opaque.
Expand Down Expand Up @@ -336,7 +336,7 @@ def elevate_priv(self, cmd):
"""
return (self.sudo_command.split() if self.as_root else []) + cmd

def resolve(self, rosdep_args):
def resolve(self, rosdep_args, rosdep=None):
"""
See :meth:`Installer.resolve()`
"""
Expand Down Expand Up @@ -518,6 +518,11 @@ def install(self, uninstalled, interactive=True, simulate=False,
squashed_uninstalled[-1][1].extend(resolved)

failures = []

INSTALLER_PRIORITY = ['apt', 'nix', 'source', 'npm', 'pip']
# ensure pip is at the end of the list for our temporary way of compiling pip packages
squashed_uninstalled.sort(key=lambda i: INSTALLER_PRIORITY.index(i[0]))

for installer_key, resolved in squashed_uninstalled:
try:
self.install_resolved(installer_key, resolved, simulate=simulate,
Expand Down Expand Up @@ -600,9 +605,9 @@ def run_command(command, installer_key, failures, verbose):
raise InstallFailed(failures=failures)

# test installation of each
for r in resolved:
if not installer.is_installed(r):
failures.append((installer_key, 'Failed to detect successful installation of [%s]' % (r)))
# for r in resolved:
# if not installer.is_installed(r):
# failures.append((installer_key, 'Failed to detect successful installation of [%s]' % (r)))
# finalize result
if failures:
raise InstallFailed(failures=failures)
Expand Down
45 changes: 25 additions & 20 deletions src/rosdep2/lookup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

from collections import defaultdict

from catkin_pkg.package import Dependency

from rospkg import RosPack, RosStack, ResourceNotFound

from .core import RosdepInternalError, InvalidData, rd_debug
Expand Down Expand Up @@ -235,10 +237,11 @@ def merge(self, update_entry, override=False, verbose=False):
db[dep_name].reverse_merge(dep_data, update_entry.origin, verbose=verbose)


def prune_catkin_packages(rosdep_keys, verbose=False):
def prune_catkin_packages(rosdeps, verbose=False):
workspace_pkgs = catkin_packages.get_workspace_packages()
if not workspace_pkgs:
return rosdep_keys
return rosdeps
rosdep_keys = [d.name for d in rosdeps]
for i, rosdep_key in reversed(list(enumerate(rosdep_keys))):
if rosdep_key in workspace_pkgs:
# If workspace packages listed (--catkin-workspace)
Expand All @@ -248,22 +251,23 @@ def prune_catkin_packages(rosdep_keys, verbose=False):
print("rosdep key '{0}'".format(rosdep_key) +
' is in the catkin workspace, skipping.',
file=sys.stderr)
del rosdep_keys[i]
return rosdep_keys
del rosdeps[i]
return rosdeps


def prune_skipped_packages(rosdep_keys, skipped_keys, verbose=False):
def prune_skipped_packages(rosdeps, skipped_keys, verbose=False):
if not skipped_keys:
return rosdep_keys
return rosdeps
rosdep_keys = [d.name for d in rosdeps]
for i, rosdep_key in reversed(list(enumerate(rosdep_keys))):
if rosdep_key in skipped_keys:
# If the key is in the list of keys to explicitly skip, skip it
if verbose:
print("rosdep key '{0}'".format(rosdep_key) +
' was listed in the skipped packages, skipping.',
file=sys.stderr)
del rosdep_keys[i]
return rosdep_keys
del rosdeps[i]
return rosdeps


class RosdepLookup(object):
Expand Down Expand Up @@ -329,7 +333,7 @@ def get_resources_that_need(self, rosdep_name):

:returns: list of package names that require rosdep, ``[str]``
"""
return [k for k in self.loader.get_loadable_resources() if rosdep_name in self.get_rosdeps(k, implicit=False)]
return [k for k in self.loader.get_loadable_resources() if rosdep_name in [d.name for d in self.get_rosdeps(k, implicit=False)]]

@staticmethod
def create_from_rospkg(rospack=None, rosstack=None,
Expand Down Expand Up @@ -403,15 +407,16 @@ def resolve_all(self, resources, installer_context, implicit=False):
# TODO: resolutions dictionary should be replaced with resolution model instead of mapping (undefined) keys.
for resource_name in resources:
try:
rosdep_keys = self.get_rosdeps(resource_name, implicit=implicit)
rosdeps = self.get_rosdeps(resource_name, implicit=implicit)
if self.verbose:
print('resolve_all: resource [%s] requires rosdep keys [%s]' % (resource_name, ', '.join(rosdep_keys)), file=sys.stderr)
rosdep_keys = prune_catkin_packages(rosdep_keys, self.verbose)
rosdep_keys = prune_skipped_packages(rosdep_keys, self.skipped_keys, self.verbose)
for rosdep_key in rosdep_keys:
print('resolve_all: resource [%s] requires rosdep keys [%s]' % (resource_name, ', '.join([d.name for d in rosdeps])), file=sys.stderr)
rosdeps = prune_catkin_packages(rosdeps, self.verbose)
rosdeps = prune_skipped_packages(rosdeps, self.skipped_keys, self.verbose)
for rosdep in rosdeps:
try:
installer_key, resolution, dependencies = \
self.resolve(rosdep_key, resource_name, installer_context)
self.resolve(rosdep, resource_name, installer_context)
rosdep_key = rosdep.name
depend_graph[rosdep_key]['installer_key'] = installer_key
depend_graph[rosdep_key]['install_keys'] = list(resolution)
depend_graph[rosdep_key]['dependencies'] = list(dependencies)
Expand All @@ -421,7 +426,7 @@ def resolve_all(self, resources, installer_context, implicit=False):
if depend_rosdep_key in depend_graph:
continue
installer_key, resolution, more_dependencies = \
self.resolve(depend_rosdep_key, resource_name, installer_context)
self.resolve(Dependency(depend_rosdep_key), resource_name, installer_context)
dependencies.extend(more_dependencies)
depend_graph[depend_rosdep_key]['installer_key'] = installer_key
depend_graph[depend_rosdep_key]['install_keys'] = list(resolution)
Expand All @@ -443,13 +448,13 @@ def resolve_all(self, resources, installer_context, implicit=False):

return resolutions_flat, errors

def resolve(self, rosdep_key, resource_name, installer_context):
def resolve(self, rosdep, resource_name, installer_context):
"""
Resolve a :class:`RosdepDefinition` for a particular
os/version spec.

:param resource_name: resource (e.g. ROS package) to resolve key within
:param rosdep_key: rosdep key to resolve
:param rosdeps: rosdep key (catkin_pkg.package.Dependency object) to resolve
:param os_name: OS name to use for resolution
:param os_version: OS name to use for resolution

Expand All @@ -463,6 +468,7 @@ def resolve(self, rosdep_key, resource_name, installer_context):
:raises: :exc:`ResolutionError` If *rosdep_key* cannot be resolved for *resource_name* in *installer_context*
:raises: :exc:`rospkg.ResourceNotFound` if *resource_name* cannot be located
"""
rosdep_key = rosdep.name
os_name, os_version = installer_context.get_os_name_and_version()

view = self.get_rosdep_view_for_resource(resource_name)
Expand Down Expand Up @@ -496,13 +502,12 @@ def resolve(self, rosdep_key, resource_name, installer_context):
except KeyError:
raise ResolutionError(rosdep_key, definition.data, os_name, os_version, 'Unsupported OS [%s]' % (os_name))
installer_key, rosdep_args_dict = definition.get_rule_for_platform(os_name, os_version, installer_keys, default_key)

# resolve the rosdep data for the platform
try:
installer = installer_context.get_installer(installer_key)
except KeyError:
raise ResolutionError(rosdep_key, definition.data, os_name, os_version, 'Unsupported installer [%s]' % (installer_key))
resolution = installer.resolve(rosdep_args_dict)
resolution = installer.resolve(rosdep_args_dict, rosdep)
dependencies = installer.get_depends(rosdep_args_dict)

# cache value
Expand Down
6 changes: 3 additions & 3 deletions src/rosdep2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,8 +618,8 @@ def command_init(options):
# Here path goes from directory name to file for more specific error message
path = get_default_sources_list_file()
if os.path.exists(path):
print('ERROR: default sources list file already exists:\n\t%s\nPlease delete if you wish to re-initialize' % (path), file=sys.stderr)
return 1
print('Default sources list file already exists:\n\t%s\nPlease delete if you wish to re-initialize' % (path), file=sys.stderr)
return 0
with open(path, 'w') as f:
f.write(data)
print('Wrote %s' % (path))
Expand Down Expand Up @@ -699,7 +699,7 @@ def command_keys(lookup, packages, options):
rosdep_keys = get_keys(lookup, packages, options.recursive)
prune_catkin_packages(rosdep_keys, options.verbose)
_print_lookup_errors(lookup)
print('\n'.join(rosdep_keys))
print('\n'.join([d.name for d in rosdep_keys]))


def get_keys(lookup, packages, recursive):
Expand Down
Loading