question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Actual git version is not displayed for `platform_packages`

See original GitHub issue

What kind of issue is this?

  • PlatformIO Core. If you’ve found a bug, please provide an information below.

Configuration

Operating system: Fedora Linux 35 (Container Image)

PlatformIO Version (platformio --version): PlatformIO Core, version 5.2.5a1

Description of problem

Given the following platformio.ini

[env]
platform = espressif8266@3.2.0
framework = arduino
platform_packages =
    platformio/framework-arduinoespressif8266 @ git+https://github.com/esp8266/Arduino.git
; notice that there's no version pin, it fetches the master branch

[env:d1_mini]
board = d1_mini

Extra package override is successfully fetched into ~/.platformio/packages/framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910/ and reported as version 3.1.0-dev+sha.42aa0e6d However, manually changing the commit by using git checkout 55ef3e73978ad010d44ad7e4c9bd4b4f32455989 does not seem to affect the version displayed in the PACKAGES list when doing pio run, and instead the .git/.piopm metadata file “version” field is used (from the installation time).

$ pio run
Processing d1_mini (platform: espressif8266@3.2.0; board: d1_mini; framework: arduino)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif8266/esp12e.html
PLATFORM: Espressif 8266 (3.2.0) > Espressif ESP8266 ESP-12E
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES:
 - framework-arduinoespressif8266 3.1.0-dev+sha.42aa0e6d
 - tool-esptool 1.413.0 (4.13)
 - tool-esptoolpy 1.30000.201119 (3.0.0)
 - toolchain-xtensa 2.100300.210717 (10.3.0)
^CBuild interrupted.
$ git -C ~/.platformio/packages/framework-arduinoespressif8266@src-31d658a59f41540201fc3726a1394910/ rev-parse HEAD
55ef3e73978ad010d44ad7e4c9bd4b4f32455989

Shouldn’t the package manager run git rev-parse HEAD (or track .git/HEAD changes) and use that value instead of version saved in the .piopm? Or, at least attempt to refresh it. I have noticed inconsistent version reports at the esp8266/Arduino repo when user has master-branch package configured, it would be nice to know the actual revision of the repo without asking the user to go to the ~/.platformio/packages dir and run git command manually 😃

(and I assume the same behaviour for lib_deps, but I have not tried it)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
mcsprcommented, Apr 7, 2022

I will, as soon as I’ll get to the PC

1reaction
mcsprcommented, Mar 31, 2022

I forgot to add, calling git rev-parse HEAD or another command via subprocess is a very expensive operation.

Not necessarily true? If you mean using subprocess, perhaps. git rev-parse HEAD is not rev-list and is extremely cheap operation, since our only goal is to just retrieve the hash.

Notice that we could also read the .git/HEAD file instead of calling anything. It contains either the hash or the ref path. But, we’d need to implement part of git logic ourselves

> git clone https://github.com/git/git
> cd git
> cat .git/HEAD
ref: refs/heads/master
> cat .git/refs/heads/master
805e0a68082a217f0112db9ee86a022227a9c81b
> git checkout 805e0a68082a217f0112db9ee86a022227a9c81b
Note: switching to '805e0a68082a217f0112db9ee86a022227a9c81b'.
...
> cat .git/HEAD
805e0a68082a217f0112db9ee86a022227a9c81b
Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Update platform/platform-packages in stm32h7.ini for ...
Updating to use more current platform and platform-packages resolve those issues. This was a day one issue for me regardless of the version...
Read more >
platform/packages/apps/Settings - Git at Google
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file. * except in compliance with the License.
Read more >
Platform packages - Confluent Documentation
You can use the platform packages to install the entire Confluent Platform, and use the component packages to install individual components.
Read more >
Platform options — PlatformIO latest documentation
Type: Package Specification | Multiple: No. Specify a development platform that provides integration of vendor-specific boards (development kits, MCUs), ...
Read more >
git-pull Documentation - Git
Incorporates changes from a remote repository into the current branch. ... With -n or --no-stat do not show a diffstat at the end...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found