Skip to content

Commit

Permalink
Add function for downloading package distro json
Browse files Browse the repository at this point in the history
  • Loading branch information
mtorpey committed Oct 16, 2024
1 parent 4408df1 commit a887f5c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gap/PackageManager.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions gap/distro.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 13 additions & 0 deletions gap/distro.gi
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit a887f5c

Please sign in to comment.