earlephilhower / esp-quick-toolchain

GCC toolchain for esp8266/arduino on MacOS, Linux, ARM64, Raspberry Pi, and Windows
87 stars 24 forks source link

GCC_PKGREL must follow semver rules #14

Closed mcspr closed 4 years ago

mcspr commented 4 years ago

Replace leading zeroes with minor.major.patch 0-padding, because PlatformIO uses semantic version module for package version sorting. Meaning, future 10.2 must be 100200

see https://github.com/platformio/platformio-core/issues/3612#issuecomment-667624349

Yeah, replacing the exact version match with the >=5 (as it is here https://github.com/Jason2866/platform-espressif8266/blob/b0167d26f3708396942ce6b663544e4984490ca5/platform.json#L39), I do see an error:

File "/home/builder/git/platformio-core/platformio/managers/package.py", line 118, in max_satisfying_repo_version
  specver = semantic_version.Version(v["version"])
File "/home/builder/.platformio/penv/lib64/python3.8/site-packages/semantic_version/base.py", line 105, in __init__
  major, minor, patch, prerelease, build = self.parse(version_string, partial)
File "/home/builder/.platformio/penv/lib64/python3.8/site-packages/semantic_version/base.py", line 318, in parse
  raise ValueError("Invalid leading zero in minor: %r" % version_string)
ValueError: Invalid leading zero in minor: '5.01010.200706'

But it is a typo... from the esp-quick-toolchain side? Meaning 01010 should be 100100, same as the version uploaded into the PIO registry and conforming with semver: https://semver.org/#spec-item-2 (quoting ...MUST NOT contain leading zeroes...) https://bintray.com/platformio/dl-packages/toolchain-xtensa/2.100100.200706

Effectively, this does nothing atm, because we don't have a list of available versions and install happens by directly setting the version. I'd wait until response from PIO guys though, whether this package deployment can be simplified (perhaps we will get a 'public' registry a-la npm or the option I proposed in the pio-core issue tracker)

Also, so I don't forget this fix is needed.

earlephilhower commented 4 years ago

On a related note, does that PKGREL value need to update on updates? How will the PIO stuff handle, say, fixing a bug in newlib and releasing another 100100 version?

mcspr commented 4 years ago

STAMP variable will be updated though:

import semantic_version a = semantic_version.Version("5.100100.200706") b = semantic_version.Version("5.100100.200804") b > a True