-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add multiple URL support for autoupdate #2803
Add multiple URL support for autoupdate #2803
Conversation
002c4cd
to
9ca051c
Compare
Tested and working with |
I will look into it in today and tommorow and give some feedback |
A "hashExtractionOrArrayOfHashExtrasctions": {
"anyOf": [
{
"$ref": "#/definitions/hashExtraction"
},
{
"items": {
"$ref": "#/definitions/hashExtraction"
},
"minItems": 1,
"type": "array",
"uniqueItems": true
}
]
}, and change There might be some tweaks in hash extraction handling for multiple URL autoupdate, e.g. using same hash extraction formula for multi-files, or some other variations. Let's think about it~ |
@niheaven Good catch! I'll add it now. |
|
To get all the other .jsons to validate, we need to change "uriOrArrayOfUris": {
"anyOf": [
{
"format": "uri",
"not": {
"pattern": "(\\$)"
}, to "uriOrArrayOfUris": {
"anyOf": [
{
"format": "uri", or "uriOrArrayOfUris": {
"anyOf": [
{
"format": "uri",
"not": {
"pattern": "(^\\$)"
}, Is this pattern here to avoid empty URLs? If so, then doesn't |
No that pattern disallows URLs containing $, so the autoupdater can't slip an unresolved variable in 😄 |
e805766
to
ae350e0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small tweak by static review. There is some code duplicacy, which I think could be removed and simplified, but i need to think about it little bit more.
Now the codes are applied to noarch, and they should be copied to arch-32 and arch-64 too. BTW, the hash handling part is insufficiency, I thought, and a specialized function to handle multiple hash extracting methods may help. I'm trying to make one, but maybe later. |
Enhance lets_do_autoupdates to return $has_changes and $has_errors Co-Authored-By: rasa <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion about reusing hash extraction expression and applying lets_do_autoupdates
to au.arch
.
$hash = get_hash_for_app $app $json.autoupdate.hash $version $url $substitutions | ||
if ($json.autoupdate.hash.length -gt $i) { | ||
$h = $json.autoupdate.hash[$i] | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else { | |
} elseif ($json.autoupdate.hash.length -ne 0) { | |
$h = $json.autoupdate.hash[-1] | |
} else { |
If hash
's length is less than url
, the last hash
expression is reused for remaining url
s.
So we could use one hash
expression for all these url
s if hash extraction url and regex are the same, e.g., $sha256.*?$basename
, different hashes for different $basename
s.
$has_changes = $true | ||
update_manifest_with_new_version $json $version $url $hash | ||
if ($json.url) { | ||
if ($json.autoupdate.url -is [System.Array]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if...else... should be applied to $json.architecture
's ForEach-Object
script too.
@rasa Could I keep on working with multi-urls and hashes autoupdate support based on this PR? |
Sure! Sorry I dropped the ball on implementing your suggestions. |
Moved to #3518 |
Fixes (?) #2757. See also ScoopInstaller/Extras#1459