microsoft / winget-create

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

Interactive update throws Duplicate installer entry found #463

Open Eddga opened 11 months ago

Eddga commented 11 months ago

Brief description of your issue

First I want to say that I'm very new to this whole Github and winget thingy and just created my first pull requests today using wingetcreate. And I still don't fully understand everything. So please bear with me. I picked CPU-Z as a first try as I noticed it having newer versions online. Maybe I picked a bad example.

When I wingetcreate update CPUID.CPU-Z --version 2.08 -i it will ask me 12 times for installers even though there exist only two installers - en and cn and both work for both x86 and x64 architectures. The 2.07 YAML lists the architectures separately (same download URL) and also lists 5 different locales for the cn installer. Running through it and trying to update it gives me Manifest validation succeeded: False Manifest Error: Duplicate installer entry found. which makes sense to me. So are the current yaml files just overly complicated or is it an issue of wingetcreate?

Steps to reproduce

In Terminal run: wingetcreate update CPUID.CPU-Z --version '2.08' -i and run through the interactive process providing the same URL for both architectures and use the en link for en-US and the cn link for all the **-cn languages. https://download.cpuid.com/cpu-z/cpu-z_2.08-en.exe https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe

Expected behavior

As I only provide links as they are already present in the present yaml just with a newer version I would expect the manifest file to be successfully created, validated and uploaded.

Actual behavior

Manifest is saved locally though no pull request is created and an error is thrown instead: Manifest validation succeeded: False Manifest Error: Duplicate installer entry found.

Environment

Windows Package Manager Manifest Creator v1.5.5.0

Windows Package Manager v1.6.2771
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.2428
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.2771.0
mdanish-kh commented 11 months ago

When I wingetcreate update CPUID.CPU-Z --version 2.08 -i it will ask me 12 times for installers even though there exist only two installers

This bit is fine and expected. If you view the existing manifest on winget-pkgs or run wingetcreate show CPUID.CPU-Z --installer-manifest, you'll find that the previous manifest has 12 installer nodes and Winget-Create wouldn't know what new URL you want to use for each installer node, so it asks you for a new URL for each installer node in the previous manifest. The problem here is that Winget-Create is not retaining the architecture fields from the previous manifest and replaces it with the architecture it detects from the downloaded binary.

This is related to:

If you want to submit a PR for CPUID.CPU-Z, I would recommend running it through YamlCreate.ps1 for now. You could take the manifest generated from winget-create, modify the architectures in a text editor, and then use wingetcreate submit (it will validate the changes before submission) but I imagine that's more hassle.

Eddga commented 11 months ago

Thanks for the answer @mdanish-kh ! Now I understood the underlying issue. Yeah I tried YamlCreate, too. But it gave me some other error when trying to submit and didn't successfully create a new branch with the new data but instead created only a new branch with the old data. But that might have been an user error. Will give it another try when the time comes. For now I was successful going the hassleful route with text editing and wingetcreate submit 😅:

123836

I also tried wingetcreate in non-interactive mode: wingetcreate update CPUID.CPU-Z --version 2.0.8 --submit --urls "https://download.cpuid.com/cpu-z/cpu-z_2.08-en.exe|x86|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-en.exe|x64|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x86|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x64|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x86|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x64|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x86|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x64|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x86|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x64|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x86|machine" "https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe|x64|machine"

But that gave me:

Each new installer URL must have a single match to an existing installer based on architecture, installer type and scope. The following installers failed to match an existing installer: No matches found for X86 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-en.exe No matches found for X64 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-en.exe No matches found for X86 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X64 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X86 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X64 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X86 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X64 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X86 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X64 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X86 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe No matches found for X64 Inno installer detected from url: https://download.cpuid.com/cpu-z/cpu-z_2.08-cn.exe If the installer you provided fails to match an existing installer even when overriding the architecture, you may need to override the scope or edit the existing manifest manually. Make sure that the existing manifest has a single installer that matches the overriding architecture, scope and installer type of the new installer. To modify an existing manifest, use the '--interactive' flag with the update command and submit the new changes. Once the changes are published, please try again.

So I guess updating this specific package is just not possible using wingetcreate at the moment?

You are welcome to close this issue if it essentially is a duplicate of #405.

mdanish-kh commented 11 months ago

So I guess updating this specific package is just not possible using wingetcreate at the moment?

Unfortunately yes