Homebrew bottle builder and tap manager for OCaml monorepos
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix bottle name parsing for date-hash version format

bottle_checksums split on the last "-" to extract the binary name,
but date-hash versions (20260401-d14d5fc) have a "-" in them. This
produced names like "cascade-20260401" instead of "cascade".

Now finds the first "-" followed by a digit (the version's YYYYMMDD
prefix), correctly splitting "cascade-20260401-d14d5fc..." into
name="cascade" and version="20260401-d14d5fc...".

+17 -3
+17 -3
lib/homebrew.ml
··· 752 752 result 753 753 754 754 let bottle_checksums bottles = 755 + (* Bottle filename: <name>-<version>.<platform>.bottle.tar.gz 756 + Extract name by cutting on the first "-" that is followed by a digit 757 + (the version starts with YYYYMMDD). *) 755 758 List.filter_map 756 759 (fun path -> 757 760 let basename = Filename.basename path in 758 761 let name, rest = 759 - match Astring.String.cut ~rev:true ~sep:"-" basename with 760 - | Some (n, r) -> (n, r) 761 - | None -> (basename, "") 762 + let rec find_version_sep i = 763 + match Astring.String.find_sub ~start:i ~sub:"-" basename with 764 + | None -> (basename, "") 765 + | Some pos -> 766 + if pos + 1 < String.length basename 767 + && basename.[pos + 1] >= '0' 768 + && basename.[pos + 1] <= '9' 769 + then 770 + ( String.sub basename 0 pos, 771 + String.sub basename (pos + 1) 772 + (String.length basename - pos - 1) ) 773 + else find_version_sep (pos + 1) 774 + in 775 + find_version_sep 0 762 776 in 763 777 let platform_str = 764 778 match Astring.String.cut ~sep:"." rest with