diff --git a/gap/PackageManager.gi b/gap/PackageManager.gi index c3c34d9..c3cf829 100644 --- a/gap/PackageManager.gi +++ b/gap/PackageManager.gi @@ -289,7 +289,10 @@ function(dir, cmd, args...) fi; # Streams - instream := InputTextNone(); + instream := ValueOption("instream"); + if instream = fail then + instream := InputTextNone(); + fi; out := ""; outstream := OutputTextString(out, true); diff --git a/gap/distro.gd b/gap/distro.gd index ba2894a..62eadd3 100644 --- a/gap/distro.gd +++ b/gap/distro.gd @@ -29,10 +29,13 @@ DeclareGlobalFunction("InstallRequiredPackages"); DeclareGlobalFunction("InstallPackageFromName"); DeclareGlobalFunction("GetPackageURLs"); DeclareGlobalFunction("PKGMAN_InstallDependencies"); +DeclareGlobalFunction("PKGMAN_GetPackageDistroJson"); # Source of latest package releases PKGMAN_PackageInfoURLList := "https://github.com/gap-system/PackageDistro/releases/download/latest/pkglist.csv"; +PKGMAN_PackageDistroJsonUrl := + "https://github.com/gap-system/PackageDistro/releases/download/latest/package-infos.json.gz"; PKGMAN_InstallQueue := []; # Queue of dependencies to install PKGMAN_MarkedForInstall := []; # Packages currently halfway through installing diff --git a/gap/distro.gi b/gap/distro.gi index dff04a8..55a68ce 100644 --- a/gap/distro.gi +++ b/gap/distro.gi @@ -230,3 +230,16 @@ function(dir) Remove(PKGMAN_MarkedForInstall); # this package return true; end); + +InstallGlobalFunction(PKGMAN_GetPackageDistroJson, +function() + local download, instream, out, json; + download := PKGMAN_DownloadURL(PKGMAN_PackageDistroJsonUrl); + # TODO: check download.success + instream := InputTextString(download.result);; + out := PKGMAN_Exec(".", "gunzip" : instream := instream);; + # TODO: check out.code + json := out.output; + # TODO: use this data somehow (json package?) + return json; +end);