From 2298b74fed3cd87f99936a3b27b06b53e16984f8 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Wed, 4 Oct 2023 11:58:25 -0400 Subject: [PATCH] Version: Improve date version parsing The existing date version parsing regex only matches file names that have a prefix (e.g., `ltopers-v2017-04-14.tar.gz`), so it doesn't match files like `2023-09-28.tar.gz`. There are a handful of formulae that have to manually specify the version as a result (e.g., `marksman`, `sqtop`, etc.). `bootloadhid` is also affected but that's because the filename uses a dot as the prefix delimiter (e.g., `bootloadHID.2012-12-08.tar.gz`) and the regex only matches a hyphen. This addresses these shortcomings by using `[._-]` as the prefix delimiter and making it optional. Co-authored-by: Markus Reiter --- Library/Homebrew/version.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/version.rb b/Library/Homebrew/version.rb index 49c1629ffaf3a..560a88c16ee11 100644 --- a/Library/Homebrew/version.rb +++ b/Library/Homebrew/version.rb @@ -376,8 +376,9 @@ def self.parse(spec, detected_from_url: false) VERSION_PARSERS = [ # date-based versioning + # e.g. 2023-09-28.tar.gz # e.g. ltopers-v2017-04-14.tar.gz - StemParser.new(/-v?(\d{4}-\d{2}-\d{2})/), + StemParser.new(/(?:^|[._-]?)v?(\d{4}-\d{2}-\d{2})/), # GitHub tarballs # e.g. https://github.com/foo/bar/tarball/v1.2.3