chickenPackages_5: Remove ocaml dependency, switch to TOML

This commit is contained in:
Konstantin Astafurov 2023-02-11 21:01:24 -05:00 committed by Daniel Nagy
parent 3545373f30
commit ca0335c064
No known key found for this signature in database
GPG key ID: 1B8E8DCB576FB671
7 changed files with 3940 additions and 5568 deletions

1
.gitattributes vendored
View file

@ -1,5 +1,6 @@
**/deps.nix linguist-generated **/deps.nix linguist-generated
**/deps.json linguist-generated **/deps.json linguist-generated
**/deps.toml lingust-generated
**/node-packages.nix linguist-generated **/node-packages.nix linguist-generated
pkgs/applications/editors/emacs-modes/*-generated.nix linguist-generated pkgs/applications/editors/emacs-modes/*-generated.nix linguist-generated

View file

@ -65,7 +65,7 @@ stdenv.mkDerivation rec {
meta = { meta = {
homepage = "https://call-cc.org/"; homepage = "https://call-cc.org/";
license = lib.licenses.bsd3; license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ corngood nagy ]; maintainers = with lib.maintainers; [ corngood nagy konst-aa ];
platforms = lib.platforms.unix; platforms = lib.platforms.unix;
description = "A portable compiler for the Scheme programming language"; description = "A portable compiler for the Scheme programming language";
longDescription = '' longDescription = ''

View file

@ -1,16 +1,15 @@
{ lib, newScope, fetchzip }: { lib, newScope, fetchurl }:
let let
callPackage = newScope self; callPackage = newScope self;
self = with lib; { self = with lib; {
pkgs = self; pkgs = self;
fetchegg = { name, version, sha256, ... }: fetchegg = { pname, version, sha256, ... }:
fetchzip { fetchurl {
inherit sha256; inherit sha256;
name = "chicken-${name}-${version}-source";
url = url =
"https://code.call-cc.org/egg-tarballs/5/${name}/${name}-${version}.tar.gz"; "https://code.call-cc.org/egg-tarballs/5/${pname}/${pname}-${version}.tar.gz";
}; };
eggDerivation = callPackage ./eggDerivation.nix { }; eggDerivation = callPackage ./eggDerivation.nix { };
@ -19,21 +18,21 @@ let
bootstrap-chicken = self.chicken.override { bootstrap-chicken = null; }; bootstrap-chicken = self.chicken.override { bootstrap-chicken = null; };
}; };
chickenEggs = recurseIntoAttrs (mapAttrs (name: chickenEggs = recurseIntoAttrs (mapAttrs (pname:
eggData@{ version, synopsis, dependencies, license, ... }: eggData@{ version, synopsis, dependencies, license, ... }:
self.eggDerivation { self.eggDerivation {
name = "chicken-${name}-${version}"; name = "${pname}-${version}";
src = self.fetchegg (eggData // { inherit name; }); src = self.fetchegg (eggData // { inherit pname; });
buildInputs = map (x: self.chickenEggs.${x}) dependencies; buildInputs = map (x: self.chickenEggs.${x}) dependencies;
meta.homepage = meta.homepage =
"https://code.call-cc.org/cgi-bin/gitweb.cgi?p=eggs-5-latest.git;a=tree;f=${name}/${version}"; "https://code.call-cc.org/cgi-bin/gitweb.cgi?p=eggs-5-latest.git;a=tree;f=${pname}/${version}";
meta.description = synopsis; meta.description = synopsis;
meta.license = (licenses // { meta.license = (licenses // {
"bsd-2-clause" = licenses.bsd2; "bsd-2-clause" = licenses.bsd2;
"bsd-3-clause" = licenses.bsd3; "bsd-3-clause" = licenses.bsd3;
"public-domain" = licenses.publicDomain; "public-domain" = licenses.publicDomain;
}).${license} or license; }).${license} or license;
}) (importJSON ./deps.json)); }) (importTOML ./deps.toml));
egg2nix = callPackage ./egg2nix.nix { }; egg2nix = callPackage ./egg2nix.nix { };
}; };

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,40 @@
(import (chicken process-context)
(chicken format)
(chicken string))
(define env-var get-environment-variable)
(define ref alist-ref)
(define egg (read))
(printf "[~A]\n" (env-var "EGG_NAME"))
(define dependencies
(map (lambda (dep)
(->string (if (list? dep)
(car dep)
dep)))
(ref 'dependencies egg eqv? '())))
(printf "dependencies = [~A]\n"
(string-intersperse (map (lambda (dep) (sprintf "~S" dep))
dependencies)
", "))
(define license (ref 'license egg))
(printf "license = ~S\n"
(if (not license)
""
(string-translate (->string (car license))
"ABCDEFGHIJKLMNOPQRSTUVWXYZ "
"abcdefghijklmnopqrstuvwxyz-")))
(printf "sha256 = ~S\n" (env-var "EGG_SHA256"))
(define synopsis (ref 'synopsis egg))
(printf "synopsis = ~S\n"
(if (not synopsis)
""
(car synopsis)))
(printf "version = ~S\n" (env-var "EGG_VERSION"))
(print)

View file

@ -1,23 +1,19 @@
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#! nix-shell -i oil -p oil jq ocaml-ng.ocamlPackages_latest.sexp #! nix-shell -i oil -p oil chicken
export URL_PREFIX="https://code.call-cc.org/egg-tarballs/5/" export URL_PREFIX="https://code.call-cc.org/egg-tarballs/5/"
cd $(nix-prefetch-url \ cd $(nix-prefetch-url \
'https://code.call-cc.org/cgi-bin/gitweb.cgi?p=eggs-5-latest.git;a=snapshot;h=master;sf=tgz' \ 'https://code.call-cc.org/cgi-bin/gitweb.cgi?p=eggs-5-latest.git;a=snapshot;h=master;sf=tgz' \
--name chicken-eggs-5-latest --unpack --print-path | tail -1) --name chicken-eggs-5-latest --unpack --print-path | tail -1)
const eggExpr = '
def toarray: if type=="array" then . else [.] end; echo "# THIS IS A GENERATED FILE. DO NOT EDIT!" > $_this_dir/deps.toml
if type=="array" then map({(first): .[1:]}) | add else . end |
{synopsis: .synopsis | toarray | first | tostring,
version: env.EGG_VERSION,
sha256: env.EGG_SHA256,
dependencies: (.dependencies // []) | toarray | map(toarray) | map(first),
license: .license | toarray | first | ascii_downcase | sub(" ";"-")}'
for i, item in */*/*.egg { for i, item in */*/*.egg {
var EGG_NAME=$(dirname $(dirname $item)) var EGG_NAME=$(dirname $(dirname $item))
var EGG_VERSION=$(basename $(dirname $item)) var EGG_VERSION=$(basename $(dirname $item))
var EGG_URL="${URL_PREFIX}${EGG_NAME}/${EGG_NAME}-${EGG_VERSION}.tar.gz" var EGG_URL="${URL_PREFIX}${EGG_NAME}/${EGG_NAME}-${EGG_VERSION}.tar.gz"
var EGG_SHA256=$(nix-prefetch-url $EGG_URL --unpack --name "chicken-${EGG_NAME}-${EGG_VERSION}-source") var EGG_SHA256=$(nix-prefetch-url $EGG_URL)
sexp pp < $item | sexp to-json | jq --slurp first | \ export EGG_NAME
EGG_VERSION=$[EGG_VERSION] EGG_SHA256=$[EGG_SHA256] \ export EGG_VERSION
jq $eggExpr | EGG_NAME=$[EGG_NAME] jq '{($ENV.EGG_NAME): .}' export EGG_SHA256
} | jq --slurp --sort-keys add > $_this_dir/deps.json csi -s $_this_dir/read-egg.scm < $item
} >> $_this_dir/deps.toml