autopkg / smithjw-recipes

Smithjw's AutoPkg recipes
Apache License 2.0
14 stars 16 forks source link

DisplayLink_Manager.download.recipe.yaml doesn't exclude new Alpha release #25

Closed ggeerraalldd closed 2 years ago

ggeerraalldd commented 2 years ago

Synaptics has just released a Display Link Manager 1.8 Alpha release that the download recipe doesn't account for, so it gets processed by AutoPkg. The current recipe has an exception for " BETA" that will fail to match:

re_pattern: DisplayLink Manager Graphics Connectivity(?! BETA).*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*a href=\"(?P<match>\/node\/\d{4}\?filetype=exe)\" class=\"download-link\">Download<\/a>

Here are some options to account for Alpha, or other non-standard release descriptions:

Option 1: Add Alpha to the negative lookahead the same way as BETA. Also can match (Beta) if they're changing their naming conventions. (.* will match space or space+parenthesis)

DisplayLink Manager Graphics Connectivity(?!.*Alpha|.*Beta| BETA).*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*a href=\"(?P<match>\/node\/\d{4}\?filetype=exe)\" class=\"download-link\">Download<\/a>

Option 2: Only match results that don't have any text following "DisplayLink Manager Graphics Connectivity" before the closing </h4> tag. This matches all non-Alpha and non-Beta releases

re_pattern: DisplayLink Manager Graphics Connectivity<\/h4>.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*a href=\"(?P<match>\/node\/\d{4}\?filetype=exe)\" class=\"download-link\">Download<\/a>

Option 3: Same as Option 2, but generalizes the closing tag in case it changes in the future (</h3>, </p>, etc)

re_pattern: DisplayLink Manager Graphics Connectivity<\/.*>.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*\s.*a href=\"(?P<match>\/node\/\d{4}\?filetype=exe)\" class=\"download-link\">Download<\/a>

smithjw commented 2 years ago

Thanks for calling this out @ggeerraalldd! I ended up taking option 3 + simplifying the whole regex even further. Let me know how that goes for you.

(<.*>DisplayLink Manager Graphics Connectivity<\/.*>)((.|\n)*?)a href=\"(\/node\/\d*\?filetype=exe)

ggeerraalldd commented 2 years ago

I updated your repo, deleted the cached pkg and reran the recipe and it downloaded 1.7.1 as expected. (I didn't try to write a pull request for this issue since there are so many ways to regex...)

Thanks for the quick turnaround!