-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Idea: Use PowerShell script as a dynamic manifest #299
Comments
If using PowerShell to generate the manifests is a popular idea, it would not be much work to take a DSL style approach to it. Having syntax like this is very doable with PowerShell.
Its basically a function that takes a path and a hashtable. Because its PowerShell, you can call whatever code you need to in there. Either calling a function or just adding inline code. I'm ignoring the magic mapping for version from your example, but this would be trivial to document and more intuitive for a seasoned PowerSheller to look at an example and just go.
|
This is how I handle it in Chocolatey today. The CI pipeline (which runs on a schedule) runs a script that fetches the latest version (usually using invoke-webrequest). If the remote version is newer, the url, version and filehash are updated in the manifest and pushed. |
I think this is a very bad idea.
EDIT: In addition, Microsoft has already publicly stated that they will not allow scripts during the installation of a package source - it stands to reason they especially would not allow scripts during the searching for / indexing of packages My suggestion to OP and anyone else who wants to do this is to use cookiecutter which is a tool that reads a template file (in our case a winget manifest YAML) and inserts/edits values at certain points in the file - either fully automatic or by asking for each value one by one. It's cross platform and can be used for much more than just winget manifests as well. |
Hey all, one of our tenets is not to run "arbitrary" scripts. We haven't been able to reason about a good way to treat a script as a manifest. It is possible to generate a local manifest using a script and then call |
Description of the new feature/enhancement
TL;DR
Use PowerShell script as a dynamic manifest.
A program then parses the script and generate a manifest.
winget
reads the manifest and install the package.Example
Here is a minimal example script. With a helper script/program, it generates real
7zip
manifest.Almost everything is same as the manifest, except that
Version
will always be the latest, and$Url
now dynamic changes as$Version
change.More details
Manifest is a great idea, I like it! But I don't think they are 'Packages'...
actually what they do is telling winget how to get a package and install it silently.
A package should be msi/msix files, especially msix since it can handle dependence.
Definition of terms
winget
itself, parse the Script and generate the Manifest.winget
: the program that reads the Manifest, download the Package and install itWorkflow example
How Script converted to Manifest
The Parser reads the script first, for each field if it is a function,
run it and use the return value as new field value.
Then use these field variables to generate the yaml Manifest file.
Further Step
Now there is a offiicial Manifest repository (official repo) hosted by Microsoft.
We can have another Script repository (user repo) hosted by community.
User can submit Scripts to user repository, or submit Manifest to official repository.
There maybe also some helpers that automatically submit manifest generate by script.
There may can be a way that software developer can submit their package into official repo,
so user can download both manifest and package from Microsoft.
And such a package can be also available in Microsoft Store.
Some questions and problems
Version
function or staticVersion
variable?We should have another real manifest manage system, instead of using a git repo.
As there are more and more pull requests coming, it can be really difficult to manage.
It's also confusing that I fork and clone the whole repo, commit a file,
only for submitting a new manifest.
The text was updated successfully, but these errors were encountered: