flora-pm / flora-server

A package index for the Haskell ecosystem
https://flora.pm/about
Other
124 stars 38 forks source link

Duplicated dependencies in the package overview page #491

Closed tchoutri closed 3 months ago

tchoutri commented 7 months ago

In @cardano/ouroboros-network we can see that bytestring is listed twice as a dependency in the deps overview.

image

This is caused because we take all the library components of a release

select distinct dependency.namespace, dependency.name, req.requirement
from requirements as req
inner join packages as dependency on dependency.package_id = req.package_id
inner join package_components as pc ON pc.package_component_id = req.package_component_id
      and (pc.component_type = 'library') <-- ⚠️
inner join releases as rel on rel.release_id = pc.release_id
where rel."release_id" = ?
order by dependency.namespace desc

Listing the components of ouroboros-network shows that we have the following components

select component_name, component_type from package_components where release_id = 'f4eaaa9b-a268-303e-88da-31b0382cbf6a';
  component_name   | component_type 
-------------------+----------------
 demo-chain-sync   | executable
 io-tests          | test
 sim-benchmarks    | benchmark
 sim-tests-lib     | library
 ouroboros-network | library
 sim-tests         | test

It would make more sense to take the component that has the same name as the library.

One problem is that it returns no dependency at all for packages containing only an executable. So we would have to determine which query to use:

tchoutri commented 3 months ago

closed by #492