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

lib list/core list might list the library/platform versions in a non-semver compliant way #1727

Closed
kittaakos opened this issue May 9, 2022 · 2 comments · Fixed by #2110
Closed
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@kittaakos
Copy link
Contributor

kittaakos commented May 9, 2022

Bug Report

Library authors can use a relaxed-semver. For example, 1.0 is OK. If such a library is installed, lib list will return with the 1.0 version, which is not a valid semver. Hence the library install will fail with this version.

Current behavior

Steps to reproduce:

% rm -rf ~/Documents/Arduino && rm -rf ~/Library/Arduino15
% ./arduino-cli version --format json
{
  "Application": "arduino-cli",
  "VersionString": "0.22.0",
  "Commit": "65f662a7",
  "Status": "",
  "Date": "2022-05-06T11:09:35Z"
}
% ./arduino-cli lib list --format json                    
[]
% ./arduino-cli lib install "ILI9341_t3"@1.0.0 --format json
% ./arduino-cli lib list --format json                      
[
  {
    "library": {
      "name": "ILI9341_t3",
      "author": "Limor Fried, Adafruit, Paul Stoffregen",
      "maintainer": "Paul Stoffregen",
      "sentence": "Optimized ILI9341 (320x240 Color TFT) Display",
      "website": "https://github.com/PaulStoffregen/ILI9341_t3",
      "category": "Display",
      "architectures": [
        "*"
      ],
      "install_dir": "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3",
      "source_dir": "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3",
      "real_name": "ILI9341_t3",
      "version": "1.0",
      "license": "Unspecified",
      "location": 1,
      "examples": [
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/breakouttouchpaint",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/graphicstest",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/onoffbutton",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/onoffbutton_breakout",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/spitftbitmap",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/touchpaint"
      ],
      "provides_includes": [
        "ILI9341_t3.h"
      ]
    }
  }
]
% rm -rf ~/Documents/Arduino && rm -rf ~/Library/Arduino15 
% ./arduino-cli lib list --format json                    
[]
% ./arduino-cli lib install "ILI9341_t3"@1.0 --format json 
Error installing ILI9341_t3: Library 'ILI9341_t3@1.0' not found
% 

Expected behavior

In this particular case, the lib list should return with such a JSON:

[
  {
    "library": {
      "name": "ILI9341_t3",
      "author": "Limor Fried, Adafruit, Paul Stoffregen",
      "maintainer": "Paul Stoffregen",
      "sentence": "Optimized ILI9341 (320x240 Color TFT) Display",
      "website": "https://github.com/PaulStoffregen/ILI9341_t3",
      "category": "Display",
      "architectures": [
        "*"
      ],
      "install_dir": "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3",
      "source_dir": "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3",
      "real_name": "ILI9341_t3",
      "version": "1.0.0", // <---- return with `1.0.0` instead of `1.0`
      "license": "Unspecified",
      "location": 1,
      "examples": [
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/breakouttouchpaint",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/graphicstest",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/onoffbutton",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/onoffbutton_breakout",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/spitftbitmap",
        "/Users/a.kitta/Documents/Arduino/libraries/ILI9341_t3/examples/touchpaint"
      ],
      "provides_includes": [
        "ILI9341_t3.h"
      ]
    }
  }
]

The lib list should result in a valid semver version.

Pipe-dream:
lib install should handle relaxed-semvers gracefully, and lib install "ILI9341_t3"@1.0 should succeed.

Environment

  • CLI version (output of arduino-cli version): arduino-cli Version: 0.22.0 Commit: 65f662a7 Date: 2022-05-06T11:09:35Z
  • OS and platform: macOS 12.3.1 (21E258)

Additional context

@per1234 per1234 added the topic: code Related to content of the project itself label May 9, 2022
@per1234
Copy link
Contributor

per1234 commented May 9, 2022

For reference, here is the way the "relaxed semver" to compliant semver conversion is done when parsing the library metadata for adding releases to the Library Manager index that is the source data for arduino-cli lib search and arduino-cli lib install:

https://github.com/arduino/libraries-repository-engine/blob/1c2d8e8cafd3320d956eeb28995b01f6cf453cd1/internal/libraries/metadata/metadata.go#L108

@per1234 per1234 added the type: imperfection Perceived defect in any part of project label Jun 27, 2022
@kittaakos kittaakos changed the title lib list might list the library versions in a non-semver compliant way lib list/core list might list the library/platform versions in a non-semver compliant way Jul 7, 2022
@kittaakos
Copy link
Contributor Author

kittaakos commented Jul 7, 2022

Same problem with the platforms:

Platform 'sduino:stm8@0.5.0' not found: required version 0.5.0 not found for platform sduino:stm8

Update: It's actually, the other way around. core list converts it a real semver:

{
    "id": "sduino:stm8",
    "installed": "0.5.0",
    "latest": "0.5.0",
    "name": "STM8S Boards",
    "boards": [
      {
        "name": "sduino UNO (STM8S105K6)",
        "fqbn": "sduino:stm8:s8uno"
      },
      {
        "name": "sduino MB (STM8S208MBT6B)",
        "fqbn": "sduino:stm8:mb208"
      },
      {
        "name": "STM8S103F3 Breakout Board",
        "fqbn": "sduino:stm8:stm8sblue"
      },
      {
        "name": "STM8S105C6 Discovery Board",
        "fqbn": "sduino:stm8:stm8sdisco"
      },
      {
        "name": "STM8S105K4T6 Breakout Board",
        "fqbn": "sduino:stm8:stm8sblack"
      }
    ]
  },

But the platform release entry uses 0.5 in the package index:

{
  "name": "Sduino STM8 plain C core (non-C++)",
  "architecture": "stm8",
  "version": "0.5",
  "category": "Contributed",
  "boards": [
    { "name": "STM8S103F3 Breakout Board" },
    { "name": "STM8S105C6 Discovery Board" },
    { "name": "STM8S105K4T6 Breakout Board" },
    { "name": "sduino UNO (STM8S105K6)" },
    { "name": "sduino MB (STM8S208MBT6B)" }
  ],
  "toolsDependencies": [
    {
      "name": "STM8Tools",
      "version": "2019.02.05",
      "packager": "sduino"
    },
    {
      "name": "sdcc",
      "version": "build.11242",
      "packager": "sduino"
    }
  ],
  "url": "https://github.com/tenbaht/sduino/releases/download/v0.5/sduino-core-0.5.tar.bz2",
  "archiveFileName": "sduino-core-0.5.tar.bz2",
  "checksum": "SHA-256:16a8083583c704b18921cf5f8ededde925d313b4af6d9d64fa95ae2255e2bbf5",
  "size": "2263740"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
4 participants