Scoop icon indicating copy to clipboard operation
Scoop copied to clipboard

Feature Request: Reuse checkver JSON, XML objects in autoupdate

Open se35710 opened this issue 5 years ago • 1 comments

Consider the following manifest:

    "checkver": {
        "url": "https://api.adoptopenjdk.net/v3/assets/feature_releases/14/ga?jvm_impl=hotspot&heap_size=normal&os=windows&image_type=jdk&project=jdk&vendor=adoptopenjdk&page_size=1&sort_order=DESC",
        "jsonpath": "$..version_data.samver"
    },
    "autoupdate": {
        "architecture": {
            "64bit": {
                "url": {
                    "mode": "json",
                    "jsonpath": "$..binaries[?(@.architecture == 'x64')].package.link"
                },
                "hash": {
                    "mode": "json",
                    "jsonpath": "$..binaries[?(@.architecture == 'x64')].package.checksum"
                }
            },
[...]
  • Since we don't provide a new url in autoupdate, the checkver url is reused.
  • url uses same modes as hash, for flexibility, eg hash mode might be string, while url mode might be json.
  • no version parsing required for url.

se35710 avatar Mar 30 '20 09:03 se35710

A different proposal

To make "checkver" an array. "$version" will match the last unnamed (or named as "version") capture; other fields will match named captures.

"checkver": [
    {
        "url": "https://domain/version_api",
        "jsonpath": "$..version_data.samver"
    },
    {
        "url": "https://domain/download_api",
        "jsonpath": "$..binaries[?(@.architecture == 'x64')].package.link",
        "regex": "(?<link>.+)"
    },
    {
        // omit to re-use previous url
        "jsonpath": "$..binaries[?(@.architecture == 'x64')].package.checksum",
        "regex": "(?<checksum>.+)"
    }
],
"autoupdate": {
    "url": "$matchLink",
    "hash": "$matchChecksum"
}

amorphobia avatar Apr 17 '25 03:04 amorphobia