Skip to content

lib install --no-overwrite fails when dependency version constraints would allow installation to be done without an "overwrite" #1799

Closed
@per1234

Description

@per1234

Describe the problem

The --no-overwrite flag (#1793) prevents arduino-cli lib install from installing a library if this would result in a change to any existing library installation.

In addition to the target library, this applies to any dependencies of the library which would be installed along with it.

Library dependencies are defined by the depends field of the library.properties metadata file. This field supports the use of version constraints, which can be used to specify a dependency on a specific version or version range rather than the default behavior of installing the latest version of the dependency.

🐛 The arduino-cli lib install --no-overwrite command fails when no change to existing installations would have resulted from installation of the library due to its dependency version constraints.

To reproduce

$ arduino-cli version
arduino-cli.exe  Version: 0.25.0-rc1 Commit: 63b53c0f Date: 2022-07-12T01:46:05Z

$ arduino-cli lib install [email protected]
Downloading [email protected]...
[email protected] downloaded
Installing [email protected]...
Installed [email protected]

$ arduino-cli lib uninstall EncoderTool
Library EncoderTool is not installed

$ arduino-cli lib install --no-overwrite [email protected]
Error installing EncoderTool: Library [email protected] is already installed, but with a different version: [email protected]

The library [email protected] has the following depends field:

depends=Bounce2 (>=2.53)

🐛 In the demo above, installation of [email protected] need not have resulted in any changes to the existing library installations because the installed version of the "Bounce2" library dependency matched the version constraint specified for the dependency. Yet the installation failed anyway.

Expected behavior

In the demo above:

  • Install the "EncoderTool" library (because the installation can be done without changing any existing library installations)
  • Do not update the "Bounce2" library (because the --no-overwrite flag was used in the command)

Arduino CLI version

0.25.0-rc1 Commit: 63b53c0

Operating system

Windows

Operating system version

Windows 10

Additional context

Previously discussed at #1793 (review)

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions