diff --git a/src/rosdep2/platforms/arch.py b/src/rosdep2/platforms/arch.py index 8fad48bc86..5f1094375c 100644 --- a/src/rosdep2/platforms/arch.py +++ b/src/rosdep2/platforms/arch.py @@ -38,14 +38,14 @@ def register_installers(context): context.set_installer(PACMAN_INSTALLER, PacmanInstaller()) - + def register_platforms(context): context.add_os_installer_key(ARCH_OS_NAME, SOURCE_INSTALLER) context.add_os_installer_key(ARCH_OS_NAME, PACMAN_INSTALLER) context.set_default_os_installer_key(ARCH_OS_NAME, lambda self: PACMAN_INSTALLER) def pacman_detect_single(p): - return not subprocess.call(['pacman', '-Q', p], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + return not subprocess.call(['pacman', '-Q', p], stdout=subprocess.PIPE, stderr=subprocess.PIPE) def pacman_detect(packages): return [p for p in packages if pacman_detect_single(p)] @@ -57,8 +57,14 @@ def __init__(self): def get_install_command(self, resolved, interactive=True, reinstall=False, quiet=False): #TODO: interactive switch - packages = self.get_packages_to_install(resolved, reinstall=reinstall) + packages = self.get_packages_to_install(resolved, reinstall=reinstall) if not packages: return [] - else: - return [self.elevate_priv(['pacman', '-Sy', '--needed', p]) for p in packages] + + command = ['pacman', '-S'] + + if not interactive: command.append('--noconfirm') + if not reinstall: command.append('--needed') + if quiet: command.append('-q') + + return [self.elevate_priv(command + packages)] diff --git a/test/test_rosdep_arch.py b/test/test_rosdep_arch.py index a4bebe2c5e..ae0e667700 100644 --- a/test/test_rosdep_arch.py +++ b/test/test_rosdep_arch.py @@ -46,12 +46,10 @@ def test(mock_method): # no interactive option implemented yet mock_method.return_value = ['a', 'b'] - expected = [['sudo', '-H', 'pacman', '-Sy', '--needed', 'a'], - ['sudo', '-H', 'pacman', '-Sy', '--needed', 'b']] + expected = [['sudo', '-H', 'pacman', '-S', '--noconfirm', '--needed', 'a', 'b']] val = installer.get_install_command(['whatever'], interactive=False) assert val == expected, val - expected = [['sudo', '-H', 'pacman', '-Sy', '--needed', 'a'], - ['sudo', '-H', 'pacman', '-Sy', '--needed', 'b']] + expected = [['sudo', '-H', 'pacman', '-S', '--needed', 'a', 'b']], val = installer.get_install_command(['whatever'], interactive=True) assert val == expected, val try: