microsoft / winget-create

The Windows Package Manager Manifest Creator command-line tool (aka wingetcreate)
MIT License
491 stars 84 forks source link

Add support to mine GitHub projects for data being asked for in .\Tools\YamlCreate.ps1 #368

Open asilverman opened 1 year ago

asilverman commented 1 year ago

Description of the new feature / enhancement

I recently used .\Tools\YamlCreate.ps1 to create a package manifest because wingetcreate new fails (see below)

wingetcreate new https://github.com/oras-project/oras/releases/download/v1.0.0/oras_1.0.0_windows_amd64.zip
Downloading and parsing: https://github.com/oras-project/oras/releases/download/v1.0.0/oras_1.0.0_windows_amd64.zip...
Failed to parse the package from [https://github.com/oras-project/oras/releases/download/v1.0.0/oras_1.0.0_windows_amd64.zip]

As I was doing this I noticed that YamlCreate.ps1 is asking me many many questions that it can simply harvest answers from a github repository (see below)

Select Mode:

  [1] New Manifest or Package Version
  [2] Quick Update Package Version (Note: Must be used only when previous version's metadata is complete.)
  [3] Update Package Metadata
  [4] New Locale
  [5] Remove a manifest
  [Q] Any key to quit

Selection: 1

[Required] Enter the Package Identifier, in the following format <Publisher shortname.Application shortname>. For example: Microsoft.Excel
PackageIdentifier: ORASProject.ORAS

[Required] Enter the version. for example: 1.33.7
Version: 1.0.0

[Required] Enter the download url to the installer.
Url: https://github.com/oras-project/oras/releases/download/v1.0.0/oras_1.0.0_windows_amd64.zip

Do you want to save the files to the Temp folder?
  [Y] Yes
  [N] No
  [M] Manually Enter SHA256

Enter Choice (default is 'N'): N

Downloading URL. This will take a while...
Time taken: 0 second(s)

[Required] Enter the architecture. Options: x86, x64, arm, arm64, neutral
Architecture: x64

[Required] Enter the NestedInstallerType. Options: msix, msi, appx, exe, inno, nullsoft, wix, burn, portable
NestedInstallerType: portable

[Required] Enter the relative path to the installer file
RelativeFilePath: oras.exe

[Optional] Enter the portable command alias
PortableCommandAlias:

Do you want to create another portable installer entry?
  [Y] Yes
  [N] No

Enter Choice (default is 'N'): N
[Optional] Enter any custom switches for the installer. For example: /norestart, -norestart
Custom Switch:

[Optional] Enter the installer locale. For example: en-US, en-CA
https://docs.microsoft.com/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a
InstallerLocale:

[Optional] Enter the application release date. Example: 2021-11-17
ReleaseDate: 2023-03-20

Do you want to create another installer?
  [Y] Yes
  [N] No

Enter Choice (default is 'N'): n

[Optional] Enter any File Extensions the application could support. For example: html, htm, url (Max 512)
FileExtensions:

[Optional] Enter any Protocols the application provides a handler for. For example: http, https (Max 64)
Protocols:

[Optional] Enter any Commands or aliases to run the application. For example: msedge (Max 16)
Commands:

[Optional] List of additional non-zero installer success exit codes other than known default values by winget (Max 16)
InstallerSuccessCodes:
0

[Optional] List of supported installer modes. Options: interactive, silent, silentWithProgress
InstallModes:

[Required] Enter the Package Locale. For example: en-US, en-CA
Reference Link: https://docs.microsoft.com/openspecs/office_standards/ms-oe376/6c085406-a698-4e12-9d4d-c3b0ee3dbc4a
PackageLocale: en-US

[Required] Enter the full publisher name. For example: Microsoft Corporation
Publisher: ORAS Project

[Required] Enter the full application name. For example: Microsoft Teams
PackageName: ORAS CLI

[Optional] Enter the Moniker (friendly name/alias). For example: vscode
Moniker: oras

[Optional] Enter the Publisher Url.
Publisher Url: https://github.com/oras-project/oras

[Optional] Enter the Publisher Support Url.
Publisher Support Url: https://github.com/oras-project/oras

[Optional] Enter the Publisher Privacy Url.
Publisher Privacy Url:

[Optional] Enter the application Author.
Author:

[Optional] Enter the Url to the homepage of the application.
Homepage: https://oras.land/

[Required] Enter the application License. For example: MIT, GPL, Freeware, Proprietary
License: Apache-2.0 license

[Optional] Enter the application License URL.
License URL: https://github.com/oras-project/oras/blob/main/LICENSE

[Optional] Enter the application Copyright.
Example: Copyright (c) Microsoft Corporation
Copyright:

[Optional] Enter the application Copyright Url.
CopyrightUrl:

[Optional] Enter any tags that would be useful to discover this tool.
Example: zip, c++, photos, OBS (Max 16 items)
Tags:

[Required] Enter a short description of the application.
Short Description: OCI registry client - managing content like artifacts, images, packages

[Optional] Enter a long description of the application.
Description:

[Optional] Enter release notes for this version of the package.
ReleaseNotes:

[Optional] Enter the release notes URL for this version of the package.
ReleaseNotesUrl:

Yaml file created: C:\Users\asilverman\src\ms\winget-pkgs\manifests\o\ORASProject\ORAS\1.0.0\ORASProject.ORAS.installer.yaml

Yaml file created: C:\Users\asilverman\src\ms\winget-pkgs\manifests\o\ORASProject\ORAS\1.0.0\ORASProject.ORAS.yaml

Yaml file created: C:\Users\asilverman\src\ms\winget-pkgs\manifests\o\ORASProject\ORAS\1.0.0\ORASProject.ORAS.locale.en-US.yaml
Manifest validation succeeded.

[Recommended] Do you want to test your Manifest in Windows Sandbox?
  [Y] Yes
  [N] No

Enter Choice (default is 'Y'): Y
--> Validating Manifest
Manifest validation succeeded.

--> Checking dependencies
    - Downloading:
      https://github.com/microsoft/winget-cli/releases/download/v1.4.10173/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
    - Downloading:
      https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx
    - Downloading:
      https://www.nuget.org/api/v2/package/Microsoft.UI.Xaml/2.7.0

--> Starting Windows Sandbox, and:
    - Mounting the following directories:
      - C:\Users\asilverman\AppData\Local\Temp\SandboxTest as read-only
      - C:\Users\asilverman\src\ms\winget-pkgs as read-and-write
    - Installing WinGet
    - Configuring Winget
    - Installing the Manifest 1.0.0
    - Refreshing environment variables
    - Comparing ARP Entries

Do you want to submit your PR now?
  [Y] Yes
  [N] No

Enter Choice (default is 'Y'): Y
Upstream does not exist. Permanently adding https://github.com/microsoft/winget-pkgs as remote upstream
HEAD is now at 16b1259753 Remove calibre.calibre.portable version 6.6.1.0 (#104314)
remote: Resolving deltas: 100% (79/79), completed with 6 local objects.
remote:
remote: Create a pull request for 'ORASProject.ORAS-1.0.0-34F1DF15772B0A' on GitHub by visiting:
remote:      https://github.com/asilverman/winget-pkgs/pull/new/ORASProject.ORAS-1.0.0-34F1DF15772B0A
remote:

Proposed technical implementation details

  1. Fix wingetcreate to support my usecase (of consuming a zip)
  2. Make YamlCreate.ps1 consume a github URI to answer many of the questions above by itself instead of prompting me for them
mdanish-kh commented 1 year ago
  1. Fix wingetcreate to support my usecase (of consuming a zip)

This particular issue has been fixed in PR #356 and the fix will make its way into the next release of winget-create

  1. Make YamlCreate.ps1 consume a github URI to answer many of the questions above by itself instead of prompting me for them

YamlCreate is designed to be interactive in nature; There is some work being done by one of the community moderators to have a "batch" mode for YamlCreate and you can follow up the discussion in the related issue https://github.com/microsoft/winget-pkgs/issues/97773. If you have suggestions for YamlCreate.ps1, https://github.com/microsoft/winget-pkgs would be the place to file an issue