vectorscan uses 'vectorscan/' as a tag prefix which confuses our
version parsing (even more so with v being the tag prefix). Add
support for matching any '*/version' tag names as the top priority.
Signed-off-by: William Douglas <william.douglas@intel.com>
These patterns are being removed as they are not used or are going to
be reworked.
This change also removes support for multi-versioned packages which
were considered for go and cargo purposes.
Signed-off-by: William Douglas <william.douglas@intel.com>
Two gitlab URLs had mis-parsed versions that are derived from upstream
tags with a `VERSION_` prefix...
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
Strip the optional leading character matching "[vVrR]" from a version extracted
from a Gitlab URL.
Update a packageurl test case to accommodate.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
The Github API endpoint for generating tarballs from tags recently changed, so
teach autospec about the new URL format.
Also add a new packageurl for testing to confirm correct operation of the
regexp that matches the new format.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
The `v` prefix failed to be stripped off of the current URL for
`libarchive` because `archive` is a substring of `libarchive`. The
intended match should be for `/archive/` instead.
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
This patch consolidates the code that manages the sources
(.zip, .tar, etc) in Source class. This class is written in a way
that allows the reuse of code for all current supported types of
sources and at the same time, it allows the easy addition of new
ones.
Signed-off-by: Athenas Jimenez <athenas.jimenez.gonzalez@intel.com>
In this case, the project uses one GitHub repo to distribute different
packages. The existing extraction rules are not enough
Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Test almost 2000 URLs for proper version and name detection. This list
is sorted by the second column (expected name).
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
Adobe font packages have -nndpi as part of the name. Add tests and a
regular expression to capture these.
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
This shortcoming was identified when a github package URL was changed to
http from https. The 's' character is made optional when parsing the
github URL and two test cases are added to the packageurl list for
testing.
Version detection could be considerably simplified using builtin python
functions such as strip, replace, and list comprehension. The logic was
also modified a bit to provide more consistent version strings
containing only numbers and periods '.'. More unit tested urls were
added to tests.
9.11.0-P1 -> 9.11.0.1
1.0.0-rc1 -> 1.0.0.1
7_4_2 -> 7.4.2
2.1-3 -> 2.1.3
Some non-digit strings are conserved for upstream version update detection:
2.1-beta1 -> 2.1.beta1
2.1-pre8 -> 2.1.pre8
3.5.0b2 -> 3.5.0b2
Previously, it was assumed if a dash appeared in the version string the
actual version information was after the dash. This is not always the
case, so check if the second part of the string is formatted like a
version before using it. If not, try the first part. If neither look
like the version just remove the dash so it is at least a valid version
string.
Add a test case to packageurls to test this.
Make several small improvements to package name and version detection.
Unit test now passes for a sampling of >100 package URLs. This patch
also adds several package URLs for testing.
Some of the improvements to name/version detection include:
- Reordering of patterns so specific patterns come first - these are our
edge cases but they will not be checked if they are at the end of the
list.
- Add conversion from 7_4_2 formatted versions to the more-common 7.4.2
format.
- Remove release candidate tag (-rc#) from the end of version tags.
- Remove leading 'r' or 'v' even if it is capitalized.
- Remove package name from beginning of version if present.
This unit test reads test cases from tests/packageurls and attempts to
determine the version and name from the url specified. tests/packageurls
defines these cases and their expected results in the format:
<package url>,<expected name>,<expected version>
There are currently some test cases that fail. This unit test will make
it easier to make changes to the tarball.name_and_version() function.