Skip to content
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

Add facilities to query the association between package versions and package sets #1218

Open
f-f opened this issue Apr 19, 2024 · 0 comments

Comments

@f-f
Copy link
Member

f-f commented Apr 19, 2024

Right now it's hard to explore the relationship between a package, its versions, and the various package sets - there are only a few facilities:

  • spago ls packages will list the packages present in the package set that the project uses
  • spago registry package-sets will list the package sets that have been published, together with the compiler that they are compatible with

We should improve on that, and have ways to:

  1. list which packages exist in any given package set, not just the local one
  2. list which package sets a certain package version is part of

For each of the points above, I propose that:

  1. we extend spago registry package-sets $SET to show which packages are in the set
  2. we extend spago registry info $PACKAGE with a list of which package set each version is present in.

I'll note that we already have all this info in the Spago DB, and even have code in place to query it, and most likely just needs to be exposed:

spago/src/Spago/Db.purs

Lines 70 to 80 in b5a8ab9

We'll need these when implementing a command for "show me what's in this package set"
selectPackageSetEntriesBySet :: Db -> Version -> Effect (Array PackageSetEntry)
selectPackageSetEntriesBySet db packageSetVersion = do
packageSetEntries <- Uncurried.runEffectFn2 selectPackageSetEntriesBySetImpl db (Version.print packageSetVersion)
pure $ Array.mapMaybe packageSetEntryFromJs packageSetEntries
selectPackageSetEntriesByPackage :: Db -> PackageName -> Version -> Effect (Array PackageSetEntry)
selectPackageSetEntriesByPackage db packageName version = do
packageSetEntries <- Uncurried.runEffectFn3 selectPackageSetEntriesByPackageImpl db (PackageName.print packageName) (Version.print version)
pure $ Array.mapMaybe packageSetEntryFromJs packageSetEntries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant