-
-
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
[Bug] XPath namespace errors from atom feed #5187
Comments
I'm not using XPath and could you provide some test cases? |
Here is an example that works, but not a real use-case. It's using the {
"description": "The IBM Semeru Runtimes are free production-ready binaries built with the OpenJDK class libraries and the Eclipse OpenJ9 JVM",
"homepage": "https://developer.ibm.com/languages/java/semeru-runtimes/",
"version": "18.0.2-9-0.33.1",
"license": "GPL-2.0-only WITH Classpath-exception-2.0,EPL-2.0",
"architecture": {
"64bit": {
"url": "https://github.com/ibmruntimes/semeru18-binaries/releases/download/jdk-18.0.2+9_openj9-0.33.1/ibm-semeru-open-jdk_x64_windows_18.0.2_9_openj9-0.33.1.zip",
"hash": "cba270f40308ac503a039bb9f53becc0da679e550b019ed6721634229b1e65f8"
}
},
"extract_dir": "jdk-18.0.2+9",
"env_add_path": "bin",
"env_set": {
"JAVA_HOME": "$dir"
},
"checkver": {
"url": "https://github.com/ibmruntimes/semeru18-binaries/releases.atom",
"xpath": "/ns:feed/ns:entry[1]/ns:title",
"regex": "(?<tag>jdk-(?<major>(?<jdk>[\\d]+)[\\d.]+)(?:\\%2B|\\+)(?<build>[\\d]+)(?<patch>[\\d.]*)(?:(?<oj>_openj9?)(?<jvmver>-[\\d.]+(?:-m[\\d]+)?))?)",
"replace": "${major}-${build}${patch}${jvmver}"
},
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/ibmruntimes/semeru18-binaries/releases/download/$matchTag/ibm-semeru-open-jdk_x64_windows_$matchMajor_$matchBuild$matchPatch_openj9$matchJvmver.zip"
}
},
"hash": {
"url": "$url.sha256.txt",
"regex": "^([a-fA-F0-9]+)\\s"
},
"extract_dir": "jdk-$matchMajor+$matchBuild"
}
} |
$nsList | ForEach-Object {
if ($_.LocalName -eq 'xmlns') {
$nsmgr.AddNamespace('ns', $_.Value)
$xpath = $xpath -replace '/([^:/]+)((?=/)|(?=$))', '/ns:$1'
} else {
$nsmgr.AddNamespace($_.LocalName, $_.Value)
}
} It works. I'll submit a PR and please test it. |
Tested, and working great! |
This bug was only fixed in the checkver.ps1 -- the issue persists in the autoupdate.ps1 xpath implementation in the find_hash_in_xml function. The same fix works in my local testing. |
Hi, could you raise a PR for the same? |
Bug Report
Current Behavior
When using XPath with a Github release atom feed, Scoop throws the following error:
Scoop/bin/checkver.ps1
Line 313 in 8aee6f9
Expected Behavior
Scoop should happily import all namespaces
Additional context/output
N/A
Possible Solution
Not sure if this is a good idea, but we need a predictable namespace name for XPath ease of use.
System details
Windows version: [e.g. 7, 8, 10, 11]
11
OS architecture: [e.g. 32bit, 64bit, arm64]
64bit
PowerShell version: [output of
"$($PSVersionTable.PSVersion)"
]Tested on 5.1 and 7.2.6
Additional software: [(optional) e.g. ConEmu, Git]
N/A
Scoop Configuration
N/A
The text was updated successfully, but these errors were encountered: