Skip to content
This repository has been archived by the owner on May 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #13 from cgay/new-catalog-format
Browse files Browse the repository at this point in the history
New catalog format
  • Loading branch information
cgay authored Feb 11, 2022
2 parents bcb1ca2 + 7024b99 commit 4e7dbf5
Show file tree
Hide file tree
Showing 16 changed files with 626 additions and 522 deletions.
443 changes: 229 additions & 214 deletions catalog.dylan

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions deps.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ end function;
// package will be used during the build process anyway. The returned deps do not include
// the active releases.
//
// Signal <dep-error> if dependencies can't be resolved due to circularities or
// conflicting constraints.
// Signal <dep-error> if dependencies can't be resolved due to circularities,
// conflicting constraints, or if they are simply missing from the catalog.
//
// The algorithm used here is based on my understanding of
// https://research.swtch.com/vgo-principles, which can be very roughly summarized as
Expand Down Expand Up @@ -171,7 +171,13 @@ define function resolve-deps
let deps = as(<list>, value-sequence(maxima));
trace(depth, deps, "<= %s", deps);
end method;
let deps = resolve-release(release, #(), 0);
let deps = block ()
resolve-release(release, #(), 0)
exception (ex :: <package-missing-error>)
dep-error(make(<dep-error>,
format-string: "package %= not in catalog",
format-arguments: list(ex.package-name)));
end;
trace(0, deps, "Resolved %= to %s", release, deps)
end function;

Expand Down
5 changes: 2 additions & 3 deletions install.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ define method %download
let command
= format-to-string("git clone%s --quiet --branch=%s -- %s %s",
(update-submodules? & " --recurse-submodules") | "",
branch, release.release-location, dest-dir);
branch, release.release-url, dest-dir);
let (exit-code, signal-code /* , process, #rest streams */)
= os/run(command, output: #"null", error: #"null");
if (exit-code = 0)
Expand Down Expand Up @@ -111,9 +111,8 @@ end method;
// re-install all dependencies.
define method install-deps
(release :: <release>, #key force? :: <bool>)
let cat = load-catalog();
// TODO(cgay): pass correct `active:` arg.
for (rel in resolve-deps(release, cat))
for (rel in resolve-deps(release, catalog()))
if (force? | ~installed?)
install(rel, force?: force?, deps?: #t);
end;
Expand Down
35 changes: 23 additions & 12 deletions library.dylan
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,20 @@ end library pacman;

define module pacman
export
catalog,
dylan-directory, // $DYLAN or $HOME/dylan or /opt/dylan
load-catalog,
<catalog-error>,

<catalog>,
find-package,
find-package-release,
package-names,
validate-catalog,

<package>,
package-name,
package-releases,
package-summary,
package-description,
package-contact,
package-license-type,
package-category,
package-keywords,

Expand All @@ -53,11 +51,16 @@ define module pacman
release-directory,
source-directory,
read-package-file,
load-all-packages,
load-package,

<release>,
release-to-string,
release-deps,
release-location,
release-license,
// TODO:
// release-license-url,
release-url,
release-to-string,
release-version,

<dep>,
Expand All @@ -83,6 +86,8 @@ define module %pacman
import: { delete-directory,
directory-contents,
directory-empty?,
do-directory,
ensure-directories-exist,
file-property,
<file-system-error>,
<file-does-not-exist-error>,
Expand All @@ -98,10 +103,13 @@ define module %pacman
use json,
import: { parse-json => json/parse,
encode-json => json/encode,
print-json => json/print,
do-print-json => json/do-print,
<json-error> => json/<error> };
use locators,
import: { <directory-locator>,
<file-locator>,
<locator>,
locator-name,
merge-locators,
subdirectory-locator };
Expand Down Expand Up @@ -142,15 +150,18 @@ define module %pacman

// For the test suite.
export
all-packages,
<dep-error>,
$dylan-env-var,
<dep-conflict>,
<dep-error>,
<latest>,
add-release,
cache-package,
cached-package,
catalog-directory,
catalog-package-cache,
find-release,
max-release,
string-parser, // #string:...

string-to-version, version-to-string,

read-json-catalog,
validate-catalog;
write-package-file;
end module %pacman;
Loading

0 comments on commit 4e7dbf5

Please sign in to comment.