Skip to content

Please make the output of the board listall --format json deterministic #1909

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

Closed
3 tasks done
kittaakos opened this issue Oct 6, 2022 · 0 comments · Fixed by #2025
Closed
3 tasks done

Please make the output of the board listall --format json deterministic #1909

kittaakos opened this issue Oct 6, 2022 · 0 comments · Fixed by #2025
Assignees
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement

Comments

@kittaakos
Copy link
Contributor

kittaakos commented Oct 6, 2022

Describe the request

During the review of arduino/arduino-ide#1520, I noticed that the output of board listall --format json is not always the same. It's not a big deal, but it works fine with the non json output. It would be great to have the same result when I execute the same command twice. This also affects the gRPC API.

Update:
For completeness, the order of the boards inside a platform matches the boards.txt order, but the platforms' order seems "random".

Describe the current behavior

I am using a CLI from c8ff042:

% ./arduino-cli version                
arduino-cli  Version: git-snapshot Commit: c8ff0425 Date: 2022-10-06T06:38:53Z

I have the following platforms installed:

% ./arduino-cli core list              
ID                Installed Latest Name                          
arduino:mbed_nano 3.2.0     3.3.0  Arduino Mbed OS Nano Boards   
arduino:nrf52     1.0.2     1.0.2  Arduino nRF52 Boards          
littleBits:avr    1.0.0     1.0.0  littleBits Arduino AVR Modules

When I run board listall without the --format json flags, I always get the same result:

% ./arduino-cli board listall
Board Name                              FQBN                                
Arduino Nano 33 BLE                     arduino:mbed_nano:nano33ble         
Arduino Nano RP2040 Connect             arduino:mbed_nano:nanorp2040connect 
Arduino Primo                           arduino:nrf52:primo                 
Arduino Primo Core                      arduino:nrf52:primo_core            
littleBits w6 Arduino Module (Leonardo) littleBits:avr:w6_arduino           

% ./arduino-cli board listall
Board Name                              FQBN                                
Arduino Nano 33 BLE                     arduino:mbed_nano:nano33ble         
Arduino Nano RP2040 Connect             arduino:mbed_nano:nanorp2040connect 
Arduino Primo                           arduino:nrf52:primo                 
Arduino Primo Core                      arduino:nrf52:primo_core            
littleBits w6 Arduino Module (Leonardo) littleBits:avr:w6_arduino           

% ./arduino-cli board listall
Board Name                              FQBN                                
Arduino Nano 33 BLE                     arduino:mbed_nano:nano33ble         
Arduino Nano RP2040 Connect             arduino:mbed_nano:nanorp2040connect 
Arduino Primo                           arduino:nrf52:primo                 
Arduino Primo Core                      arduino:nrf52:primo_core            
littleBits w6 Arduino Module (Leonardo) littleBits:avr:w6_arduino           

% ./arduino-cli board listall
Board Name                              FQBN                                
Arduino Nano 33 BLE                     arduino:mbed_nano:nano33ble         
Arduino Nano RP2040 Connect             arduino:mbed_nano:nanorp2040connect 
Arduino Primo                           arduino:nrf52:primo                 
Arduino Primo Core                      arduino:nrf52:primo_core            
littleBits w6 Arduino Module (Leonardo) littleBits:avr:w6_arduino           

% ./arduino-cli board listall
Board Name                              FQBN                                
Arduino Nano 33 BLE                     arduino:mbed_nano:nano33ble         
Arduino Nano RP2040 Connect             arduino:mbed_nano:nanorp2040connect 
Arduino Primo                           arduino:nrf52:primo                 
Arduino Primo Core                      arduino:nrf52:primo_core            
littleBits w6 Arduino Module (Leonardo) littleBits:avr:w6_arduino           

Run the same command with the --format json flag at least twice (or multiple times), and you most likely get a different output than the previous one:

% ./arduino-cli board listall --format json
{
  "boards": [
    {
      "name": "Arduino Primo",
      "fqbn": "arduino:nrf52:primo",
      "platform": {
        "id": "arduino:nrf52",
        "installed": "1.0.2",
        "latest": "1.0.2",
        "name": "Arduino nRF52 Boards",
        "maintainer": "Arduino",
        "website": "http://www.arduino.cc/",
        "email": "[email protected]"
      }
    },
    {
      "name": "Arduino Primo Core",
      "fqbn": "arduino:nrf52:primo_core",
      "platform": {
        "id": "arduino:nrf52",
        "installed": "1.0.2",
        "latest": "1.0.2",
        "name": "Arduino nRF52 Boards",
        "maintainer": "Arduino",
        "website": "http://www.arduino.cc/",
        "email": "[email protected]"
      }
    },
    {
      "name": "Arduino Nano RP2040 Connect",
      "fqbn": "arduino:mbed_nano:nanorp2040connect",
      "platform": {
        "id": "arduino:mbed_nano",
        "installed": "3.2.0",
        "latest": "3.3.0",
        "name": "Arduino Mbed OS Nano Boards",
        "maintainer": "Arduino",
        "website": "http://www.arduino.cc/",
        "email": "[email protected]"
      }
    },
    {
      "name": "Arduino Nano 33 BLE",
      "fqbn": "arduino:mbed_nano:nano33ble",
      "platform": {
        "id": "arduino:mbed_nano",
        "installed": "3.2.0",
        "latest": "3.3.0",
        "name": "Arduino Mbed OS Nano Boards",
        "maintainer": "Arduino",
        "website": "http://www.arduino.cc/",
        "email": "[email protected]"
      }
    },
    {
      "name": "littleBits w6 Arduino Module (Leonardo)",
      "fqbn": "littleBits:avr:w6_arduino",
      "platform": {
        "id": "littleBits:avr",
        "installed": "1.0.0",
        "latest": "1.0.0",
        "name": "littleBits Arduino AVR Modules",
        "maintainer": "littleBits Electronics",
        "website": "http://www.littlebits.cc/bits/w6-arduino",
        "email": "[email protected]"
      }
    }
  ]
}
% ./arduino-cli board listall --format json
{
  "boards": [
    {
      "name": "Arduino Nano RP2040 Connect",
      "fqbn": "arduino:mbed_nano:nanorp2040connect",
      "platform": {
        "id": "arduino:mbed_nano",
        "installed": "3.2.0",
        "latest": "3.3.0",
        "name": "Arduino Mbed OS Nano Boards",
        "maintainer": "Arduino",
        "website": "http://www.arduino.cc/",
        "email": "[email protected]"
      }
    },
    {
      "name": "Arduino Nano 33 BLE",
      "fqbn": "arduino:mbed_nano:nano33ble",
      "platform": {
        "id": "arduino:mbed_nano",
        "installed": "3.2.0",
        "latest": "3.3.0",
        "name": "Arduino Mbed OS Nano Boards",
        "maintainer": "Arduino",
        "website": "http://www.arduino.cc/",
        "email": "[email protected]"
      }
    },
    {
      "name": "Arduino Primo",
      "fqbn": "arduino:nrf52:primo",
      "platform": {
        "id": "arduino:nrf52",
        "installed": "1.0.2",
        "latest": "1.0.2",
        "name": "Arduino nRF52 Boards",
        "maintainer": "Arduino",
        "website": "http://www.arduino.cc/",
        "email": "[email protected]"
      }
    },
    {
      "name": "Arduino Primo Core",
      "fqbn": "arduino:nrf52:primo_core",
      "platform": {
        "id": "arduino:nrf52",
        "installed": "1.0.2",
        "latest": "1.0.2",
        "name": "Arduino nRF52 Boards",
        "maintainer": "Arduino",
        "website": "http://www.arduino.cc/",
        "email": "[email protected]"
      }
    },
    {
      "name": "littleBits w6 Arduino Module (Leonardo)",
      "fqbn": "littleBits:avr:w6_arduino",
      "platform": {
        "id": "littleBits:avr",
        "installed": "1.0.0",
        "latest": "1.0.0",
        "name": "littleBits Arduino AVR Modules",
        "maintainer": "littleBits Electronics",
        "website": "http://www.littlebits.cc/bits/w6-arduino",
        "email": "[email protected]"
      }
    }
  ]
}
% 

Arduino CLI version

c8ff042

Operating system

macOS

Operating system version

12.5.1

Additional context

No response

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the nightly build
  • My request contains all necessary details
@kittaakos kittaakos added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Oct 6, 2022
@Bikappa Bikappa self-assigned this Jan 3, 2023
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: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants