Comments (8)
As far as I can see, this seems to be a bug. Hopefully this is not due to the fact that the version 2.0.0-alpha.0.5 uses dots after the dash, which is compliant to the Semantic Version format.
from cpackget.
Maybe linked to Open-CMSIS-Pack/devtools#329 ?
from cpackget.
This does seem like a bug parsing the file name, I'm still investigating
from cpackget.
I see. I guess we must not read the version backwards from the last "." prior to the file extension (*.pack *.zip).
Instead we rely on the "." as separator between <vendor>.<name>.<version>.[pack|zip]
This means <vendor>
and <name>
must not contain any "." so version starts after second "." and we strip .[pack|zip]
to get to extract that complete semantic version.
from cpackget.
OK, I think I have found the reason. Cpackget uses the regex for semantic versioning from packIndexFile spec and I have figured that it is matching more than it should:
From the regex in PackIndexFile spec, this is the pattern snippet for the "quality" part of the version (note that there is 3 capturing groups, but the last matches many due to "*", causing it to generate a variable number of matches):
- alpha .0 (.5 is a separate match due to *)
(-(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*)?
Running it against "-alpha.0.5" will generate 4 matches: "-", "alpha", ".0" and ".5" (https://regex101.com/r/BO76pa).
Now take a look at the same regex snippet from Semver.org:
- alpha .0 (.5 matches due to *, except that now it belongs to the broader match "alpha.0.5")
(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?
The extra ?:
transforms the inner regex into a non-capturing group telling the engine not to include that in the matches, leaving the entire snippet with only a single fixed capturing group. If we run the same regex on "-alpha.0.5", we will get a single match "alpha.0.5" (https://regex101.com/r/f4QiL3/1).
Cpackget uses this regex to both match a given pack version and also to separate it from the pack name. The latter was buggy because of the uncertain number of matches that the regex could generate. After swapping the regex to Semver.org one, the bug was fixed! I'll be sending a PR soon.
@jeromecoutant I don't think this is related to Open-CMSIS-Pack/devtools#329 because from what I read briefly the piece of code in packchk, it does not use regex for parsing semantic version.
from cpackget.
@chaws thanks a lot for the investigation. Could you please also raise a PR against the PACK.xsd to get the expression there to match the one from semver.org. Please include a link in the comment which reference you have been using.
Thanks a lot.
from cpackget.
@jkrech Open-CMSIS-Pack/Open-CMSIS-Pack-Spec#123, I could not find a way to test if things break with the change though.
Oops, scratch that. I saw CI at work :) I'll fix the PR
from cpackget.
I have merged the bugfix for this issue. I will rollout a new release of cpackget next week.
from cpackget.
Related Issues (20)
- cpackget fails to install specific version of a pack HOT 1
- [cpackget] Installed pack is not purgeable HOT 1
- [cpackget] Test fails in verbose(-v) mode
- [blocker] cpackget `crashes` when a local pack uses `<url>file:///</url>` to reference to a pack/pdsc HOT 2
- [critical] `cpackget update-index` shall check for updates for local packs `$CMSIS_PACK_ROOT/.Local`
- [cpackget] extract license file fails if the location is in a subdirectory of the pack
- [cpackget] missing command to `list` and `update` installed packs after updating the index.pidx (updated) HOT 10
- Proper handling of "file:///" for Windows/Linux/Mac
- [cpackget] exclude pdsc files from deprecated packs to be downloaded and present in the `.Web` folder HOT 1
- Add option `--deprecated` to omit deprecated packs by default HOT 1
- [cpackget] Confusing unaligned output `cpackget update-index -a` due to concurrent downloads
- Pack name length limit? HOT 2
- [cpackget] must strip meta data from version HOT 4
- cpackget rm does not work for local packs HOT 2
- No support for relative pack versions (supported by cprojects) and no error output when attempting to use relative pack versions HOT 2
- [cpackget] cpackcpackget deletes pack file content when installing from `$CMSIS_PACK_ROOT/.Download/` HOT 1
- Error when trying to install NXP::[email protected] with cpackget 2.1.1 HOT 1
- [cpackget] fails to install the packs specified in the `requirements` section (regression from 2.0.1) HOT 2
- cpackget: path problem when installing local packs HOT 1
- [cpackget] add a command that installs a minimum version of a pack HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpackget.