gitextensions / gitextensions.pluginmanager

Package manager for downloading and installing Git Extensions plugins.
MIT License
13 stars 10 forks source link

NuGet package is "Not compatible" #27

Closed mast-eu closed 5 years ago

mast-eu commented 5 years ago

I tried to install the plugin GitExtensions.SVN via the PM. The plugin is available here: https://www.nuget.org/packages/GitExtensions.SVN/0.2.0.21

It has a dependency on GitExtensions.Extensibility, which is available on the same feed: https://www.nuget.org/packages/GitExtensions.Extensibility/0.1.0.31

Reproduction steps:

  1. download and extract the portable build from https://github.com/gitextensions/gitextensions/pull/6664: https://ci.appveyor.com/api/buildjobs/d4jebf45vply353j/artifacts/Setup%2FGitExtensions-Portable-3.2.0.6454.zip
  2. open GE and start the PluginManager plugin
  3. search for GitExtensions.SVN
  4. Nothing is found image
  5. However, the log states that the package GitExtensions.SVN.0.2.0.21 was correctly found, but skipped for some unknown reason:
    
    22/08/2019 22:08:24 root.Search(DEBUG)

Searching 'GitExtensions.SVN'.

22/08/2019 22:08:24 root.Search(DEBUG)

Loading page '0'.

22/08/2019 22:08:24 root.Search(DEBUG)

Searching in 'https://api.nuget.org/v3/index.json'.

22/08/2019 22:08:25 root.Search(DEBUG)

Found 'GitExtensions.SVN.0.2.0.21'.

22/08/2019 22:08:25 root.Search(DEBUG)

Package skipped.

22/08/2019 22:08:25 root.Search(DEBUG)

Loading page '1'.

22/08/2019 22:08:25 root.Search(DEBUG)

Search completed. Found '0' items.



**What I found so far**

I think I found a problem in https://github.com/gitextensions/gitextensions.pluginmanager/blob/3dad53b79112f75a6ae0b1c00801132e9a251bb0/src/PackageManager.NuGet/Services/NuGetSearchService.cs#L131-L132

It seems like the package is correctly found on nuget.org, but for some reason the var `filterResult` is always `NuGetPackageFilterResult.NotCompatible` (line 131).

![image](https://user-images.githubusercontent.com/46861028/63514454-f007a380-c4e8-11e9-8a05-bfbb796150a2.png)

If I force the var `filterResult` to `NuGetPackageFilterResult.Ok` (line 132, added by me for testing), the PM lists my plugin as expected.
With this trick, I can _install_, _use_ and _uninstall_ it (I didn't test _updating_ yet):
![image](https://user-images.githubusercontent.com/46861028/63514675-65737400-c4e9-11e9-938b-e4d00b63bb78.png)

However, looking in the "Installed" tab, it still says in red the plugin is `Not compatible`:
![image](https://user-images.githubusercontent.com/46861028/63514737-9489e580-c4e9-11e9-9faf-e04f26e9bf83.png)
mast-eu commented 5 years ago

@maraf Can your confirm this is actually an issue of the PM? Or did I miss something within the NuGet packages https://www.nuget.org/packages/GitExtensions.SVN/0.2.0.21 and https://www.nuget.org/packages/GitExtensions.Extensibility/0.1.0.31?

maraf commented 5 years ago

@mast-eu The problem is with casing in dependency definition. PM declares dependency on "GitExtensions.Extensibility", but SVN package has dependency on "gitextensions.extensibility".

image

Being case nonsesitive for package ids makes sense, so it is a bug.

mast-eu commented 5 years ago

PM declares dependency on "GitExtensions.Extensibility", but SVN package has dependency on "gitextensions.extensibility".

I suspected a problem with casing. Therefore I locally changed the line you indicate to all lower case. This change alone did not work. There must be some other point that needs to be changed, too.

Being case nonsesitive for package ids makes sense, so it is a bug.

Agree. The .nuspec reference states that package IDs are not case-sensitive https://docs.microsoft.com/en-us/nuget/reference/nuspec#id

mast-eu commented 5 years ago

I made a new release of GitExtensions.SVN plugin which has the dependency GitExtensions.Extensibility (with "correct" casing): https://www.nuget.org/packages/GitExtensions.SVN/0.2.1.24

But still, it is not found by the PM.

There's one difference though. I used the same trick as above (force filterResult = NuGetPackageFilterResult.Ok;) to install the plugin anyhow. Now, when I check the "installed" tab, it doen't say "Not compatible" anymore.

image

maraf commented 5 years ago

This one is weird. Package from nuget.org says it has zero dependencies...

image

But when I download it and let PM search a directory on disk, it works.

mast-eu commented 5 years ago

@RussKie consider that this one needs to be fixed too for PM version 1.0.0, if you want to delay GE 3.2.

In the current state the list of search results in PM is always empty.

maraf commented 5 years ago

The dependencyGroup from nuget API is always empty. It might be possible that they changed it lately.

maraf commented 5 years ago

Even on search resource for nuget V3 is dependency graph always empty. NuGet.Client library has this property, other nuget feed implementers provides it, but nuget.org doesn't. The fix for this isn't an easy one. I see two posibilities:

  1. For each found package execute a separate nuget query to get dependencies (might be quite slow).
  2. Use some different mechanism to identify GE plugins.
RussKie commented 5 years ago

Suggest reporting the issue to NuGet folks

On Mon, Aug 26, 2019, 10:17 PM Marek Fišera notifications@github.com wrote:

Even on search resource for nuget V3 is dependency graph always empty. NuGet.Client library has this property, other nuget feed implementers provides it, but nuget.org doesn't. The fix for this isn't an easy one. I see two posibilities:

  1. For each found package execute a separate nuget query to get dependencies (might be quite slow).
  2. Use some different mechanism to identify GE plugins.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gitextensions/gitextensions.pluginmanager/issues/27?email_source=notifications&email_token=ABBTEXTG6VE55PPLPYZF7LTQGQT4TA5CNFSM4IOZPNO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5FMCYY#issuecomment-524992867, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBTEXQ4M2U6VM4ZTHWNK4DQGQT4TANCNFSM4IOZPNOQ .

mast-eu commented 5 years ago

NuGet.Client library has this property, other nuget feed implementers provides it, but nuget.org doesn't.

I was a bit hesitant in responding, because I'm new to everything related to nuget. However the documentation for search query results does not contain any dependency info. See also the sample response.

1) For each found package execute a separate nuget query to get dependencies (might be quite slow).

Not good.

2) Use some different mechanism to identify GE plugins.

How about a tag "GitExtensionsPlugin"? Tags are included in query response.

maraf commented 5 years ago

How about a tag "GitExtensionsPlugin"? Tags are included in query response.

Tags are possible. What is missing is version for checking compatibility. Right it is disabled, but I always thought we will enable it one day. We could check tags for fast filtering and them load dependencies for matched packages. Thoughts?

RussKie commented 5 years ago

Can we filter by tags first, and then make additional nuget calls for matching packages?

On Tue, 27 Aug 2019 at 09:24, Marek Fišera notifications@github.com wrote:

How about a tag "GitExtensionsPlugin"? Tags are included in query response.

Tags are possible. What is missing is version for checking compatibility. Right it is disabled, but I always thought we will enable it one day. We could check tags for fast filtering and them load dependencies for matched packages. Thoughts?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gitextensions/gitextensions.pluginmanager/issues/27?email_source=notifications&email_token=ABBTEXUYWJDNGAH2P42I2XLQGTCALA5CNFSM4IOZPNO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5GUGLQ#issuecomment-525157166, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBTEXSGGVS2MAYGGCZPAFTQGTCALANCNFSM4IOZPNOQ .

maraf commented 5 years ago

Can we filter by tags first, and then make additional nuget calls for matching packages?

That's exactly what I was thinking about.

mast-eu commented 5 years ago

I agree.

Tags have also another advantage: They can be used in a search query.

This means that PM on startup could directly show the full list of plugins, without the need to manually enter some search term. Maybe that's not needed right now, but would improve UX on the long run.

mast-eu commented 5 years ago

From https://docs.microsoft.com/en-us/nuget/api/search-query-service-resource#search-for-packages:

The search API allows a client to query for a page of packages matching a specified search query. [...] the general expectation is that the search query is used for matching package IDs, titles, descriptions, and tags.

From https://docs.microsoft.com/en-us/nuget/consume-packages/finding-and-choosing-packages#search-syntax:

Filtering: You can apply a search term to a specific property by using the syntax <property>:<term> where <property> (case-insensitive) can be id, packageid, version, title, tags, author, description, summary, and owner.