You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

自制Brew Cask中livecheck失效:版本校验不符问题求助

解决Brew Cask Pronote的livecheck版本不匹配问题

问题描述

创建Pronote的Brew Cask后,执行brew audit --new-cask pronote时报错:

Version '0.2.1' differs from '' retrieved by livecheck.

原Cask代码:

cask "pronote" do
  version "0.2.1"
  sha256 "36366e0353cb4a7be95c78617205440a55985bd7cdbedf6a3e39466ee96f72b7"

  url "https://tele7.index-education.com/telechargement/pn/v2023.0/exe/Install_PRNclient_FR_2023.#{version}_win32.dmg"
  name "pronote"
  desc "Logiciel"
  homepage "https://www.index-education.com/fr/"


  app "Pronote"
end

问题原因

Brew默认livecheck策略无法从当前配置的URL或主页自动提取版本号,导致返回空值,触发版本不匹配校验。

解决方案

添加自定义livecheck策略,针对Pronote的下载URL结构提取版本:

修改后的Cask代码:

cask "pronote" do
  version "0.2.1"
  sha256 "36366e0353cb4a7be95c78617205440a55985bd7cdbedf6a3e39466ee96f72b7"

  url "https://tele7.index-education.com/telechargement/pn/v2023.0/exe/Install_PRNclient_FR_2023.#{version}_win32.dmg"
  name "Pronote"
  desc "Logiciel de gestion scolaire pour les établissements et les familles"
  homepage "https://www.index-education.com/fr/"

  app "Pronote"

  livecheck do
    url "https://tele7.index-education.com/telechargement/pn/v2023.0/exe/"
    regex(/Install_PRNclient_FR_2023\.(\d+\.\d+\.\d+)_win32\.dmg/i)
    strategy :page_match
  end
end

说明

  1. livecheck配置:

    • 指定下载文件所在的目录URL,该页面会列出所有可用的Pronote安装包
    • 用正则表达式匹配文件名中2023.后的版本号部分(即你的0.2.1)
    • 使用strategy :page_match扫描页面中的文件名来提取版本
  2. 额外优化:

    • 将name改为首字母大写的Pronote,符合Brew Cask规范
    • 细化desc描述,使其更清晰准确
  3. 测试验证:
    先执行brew livecheck pronote,确认能正确返回版本号0.2.1,再重新运行brew audit --new-cask pronote即可通过校验。

如果上述目录URL无法直接访问,可改用从主页提取的策略:

livecheck do
  url homepage
  regex(/Install_PRNclient_FR_2023\.(\d+\.\d+\.\d+)_win32\.dmg/i)
end

内容的提问来源于stack exchange,提问作者Jayen

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.12 14:28:33