[Feature] add `archvar` in `architecture` and use it in `env_add_path`, `bin`, `shortcuts` etc rather than stuffing these hard-coded inside `architecture`
goyalyashpal opened this issue · comments
Summaries & Titles
- add something like
archvar
inarchitecture
and use it inenv_add_path
,bin
,shortcuts
etc rather than stuffing these hard-coded insidearchitecture
Feature Request
Is your feature request related to a problem? Please describe.
- for packages which have arch dependent env_path, bin, or shortcuts;
- the current approach is to put these repeatedly in the each of
architecture.<arch>
- otherwise, problems shared by @ issaclin32 in reply to @ rashil2000 at ScoopInstaller/Main#2784 come up
- #1372 (comment)
i.e. you want to:
- be able to select or deselect an arch (like with nesting currently)
- while simultaneously getting DRYness & leanness of global vars
Describe the solution you'd like
the basic idea is to define a variable (say archvar
) in each arch of architecture
i.e. at architecture.<arch>.archvar
,
then using that in the global definition of all these other fields.
fields like:
bin
,shortcuts
env_add_path
,env_set
- maybe even
autoupdate..url
&autoupdate..regex
too lol
but i can't fathom that right now, so, it isn't enacted in examples.
also, this will likely intermingle the manifest-update logic with manifest-install logic which would be unwanted
more details posted at this comment below:
#5961 (comment)
example manifest
examples posted at this comment below:
#5961 (comment)
Describe alternatives you've considered
Example manifests
found using github.com/search on searching by nesting's 8-space indent for:
main/autoit: "_x64", ""
{
"version": "3.3.16.1",
"description": "Scripting language designed for automating the Windows GUI and general scripting",
"homepage": "https://www.autoitscript.com/site/autoit/",
"license": {
"identifier": "Freeware",
"url": "https://www.autoitscript.com/autoit3/docs/license.htm"
},
"suggest": {
"vcredist": [
"extras/vcredist2005",
"extras/vcredist2008",
"extras/vcredist2022"
],
"AutoIt Script Editor": "extras/autoit-script-editor"
},
"url": "https://www.autoitscript.com/files/autoit3/autoit-v3.zip",
"hash": "8b7098c44275d0203c23f2ce56c0e913c0d6b6d2264bc537e8a9f0a9f07badc9",
"extract_dir": "install",
"architecture": {
"64bit": { "archvar": "_x64" },
"32bit": { "archvar": "" },
},
"bin": [
[
"AutoIt3$archvar.exe",
"AutoIt"
],
[
"Aut2Exe\\Aut2exe$archvar.exe",
"Aut2exe"
],
"Au3Check.exe"
],
"shortcuts": [
[
"AutoIt3$archvar.exe",
"AutoIt"
],
[
"Au3Info$archvar.exe",
"AutoIt Window Info Tool"
],
[
"Aut2Exe\\Aut2exe$archvar.exe",
"AutoIt Script Compiler"
],
[
"SciTe\\SciTE.exe",
"AutoIt Script Editor"
]
],
"post_install": [
"$editor = versiondir 'autoit-script-editor' 'current'",
"if (Test-Path $editor) {",
" Remove-Item \"$dir\\SciTe\" -Recurse -Force",
" New-Item -Path \"$dir\\SciTE\" -Value \"$editor\" -ItemType Junction | Out-Null",
"}"
],
"checkver": {
"url": "https://www.autoitscript.com/site/autoit/downloads/",
"regex": "<td>v([\\d.]+)</td>"
},
"autoupdate": {
"url": "https://www.autoitscript.com/files/autoit3/autoit-v3.zip"
}
}
main/miktex: "x64"
{
"version": "24.1",
"description": "MikTeX, an up-to-date implementation of TeX/LaTeX and related programs.",
"homepage": "https://miktex.org",
"license": {
"identifier": "LPPL1.3c,GPL-3.0-or-later,Public Domain,...",
"url": "https://miktex.org/copying"
},
"architecture": {
"64bit": {
"url": "https://mirrors.mit.edu/CTAN/systems/win32/miktex/setup/windows-x64/basic-miktex-24.1-x64.exe",
"hash": "94ddd75e2b90309b75db6dbda7d8103fcebda4495b579695e925e885d2b92704",
"archvar": "x64"
}
},
"bin": [
[
"texmfs\\install\\miktex\\bin\\$archvar\\miktex-console.exe",
"miktex",
"--hide --mkmaps"
]
],
"shortcuts": [
[
"texmfs\\install\\miktex\\bin\\$archvar\\miktex-console.exe",
"MiKTeX Console"
]
],
"env_add_path": "texmfs\\install\\miktex\\bin\\$archvar",
"installer": {
"args": [
"--portable=$dir",
"--unattended",
"--private"
]
},
"persist": "texmfs\\config",
"checkver": {
"url": "https://miktex.org/download",
"regex": "basic-miktex-([\\d.]+)-x64\\.exe"
},
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://mirrors.mit.edu/CTAN/systems/win32/miktex/setup/windows-x64/basic-miktex-$version-x64.exe"
}
},
"hash": {
"url": "https://miktex.org/download",
"regex": "(?sm)$basename</div>.*?$sha256"
}
}
}
extras/idea: "64", ""
{
"version": "2024.1.1-241.15989.150",
"description": "Cross-Platform IDE for Java by JetBrains (Community edition).",
"homepage": "https://www.jetbrains.com/idea/",
"license": {
"identifier": "Apache-2.0",
"url": "https://sales.jetbrains.com/hc/en-gb/articles/115001015290-Where-can-I-find-the-EULA-End-User-License-Agreement-"
},
"url": "https://download.jetbrains.com/idea/ideaIC-2024.1.1.win.zip",
"hash": "347caa8c4d848bbc5694d32b99b52747c65e082d353fa1ea9428dca00ae2efaf",
"extract_to": "IDE",
"installer": {
"script": "& \"$bucketsdir\\extras\\scripts\\jetbrains\\portable.ps1\" $dir $persist_dir"
},
"architecture": {
"64bit": { "archvar": "64" },
"32bit": { "archvar": "" }
},
"bin": [
[
"IDE\\bin\\idea$archvar.exe",
"idea"
]
],
"shortcuts": [
[
"IDE\\bin\\idea$archvar.exe",
"JetBrains\\IDEA"
]
],
"persist": [
"IDE\\bin\\idea.properties",
"IDE\\bin\\idea.exe.vmoptions",
"IDE\\bin\\idea64.exe.vmoptions",
"profile"
],
"checkver": {
"url": "https://data.services.jetbrains.com/products/releases?code=IIC&latest=true&platform=zip&type=release",
"regex": "version\":\"(?<ver>[\\d.]+)\".*\"build\":\"(?<build>[\\d.]+)\"",
"replace": "${ver}-${build}"
},
"autoupdate": {
"url": "https://download.jetbrains.com/idea/ideaIC-$matchHead.win.zip",
"hash": {
"url": "$url.sha256"
}
}
}
extras/q-dir "_x64", ""
changes not synthesized yet
<local>/context.json "win64", "mswin"
manifest not figured out yet
https://github.com/ScoopInstaller/Main/blob/7303e0576ff3f4a616f9796941974615a616e0c6/bucket/ag.json#L10
https://github.com/ScoopInstaller/Main/blob/7303e0576ff3f4a616f9796941974615a616e0c6/bucket/dxc.json#L13
https://github.com/ScoopInstaller/Extras/blob/4068aeacb118ee5fe31f17529d8f1083b7c71e5e/bucket/folder-painter.json#L11
Describe the solution you'd like
- being able to specify some variable inside the each of the
architecture
, sayarchvar
orarchspec
orarchdir
or (as used by context typesetting:)platform
- and then using that in the (global)
bin
,shortcuts
,env_add_path
,env_set
etc - this way, the manifests will become much more DRY, leaner & easier to follow
a nuance:
- set it to
""
(empty string) to indicate empty string, but valid - set it to
null
to indicate invalid
but i think this would be superfluous - as in, why is that arch there in first place if it's invalid - this invalid case can be used at place where some arch doesn't fit this generalisation
say,bin
doesn't exist for32bit
or there's inconsistency inarchvar
for some of the variables for an <arch>
but what would be its default value? i.e. what will happen in following cases:
- where it's used in global definitions (say
bin
) & is not defined in at least one of the otherwise used archs?
i'd say that such a manifest itself should be discarded right at the schema level.