janet-lang / jpm

Janet Project Manager
MIT License
68 stars 22 forks source link

`make-lockfile` failure #13

Closed subsetpark closed 2 years ago

subsetpark commented 2 years ago

Creating a lockfile for Bagatto fails either in local-tree or global-tree mode.

Local Behaviour

~/code-src/bagatto [master!] ⊕ jpm -l make-lockfile
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/pkgs.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/json.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/mago.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/path.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/sh.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/spork.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/sqlite3.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/argparse.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/posix-spawn.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/Markable.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/Testament.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/temple.jdn to lockfile, skipping...
Cannot add local or malformed package /home/zax/code-src/bagatto/jpm_tree/lib/.manifests/jdn.jdn to lockfile, skipping...
created lockfile.jdn

Global Behaviour

(after sudo jpm deps)

Cannot add local or malformed package /usr/lib/janet/.manifests/jpm.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/json.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/mago.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/path.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/sh.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/argparse.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/posix-spawn.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/Markable.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/Testament.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/temple.jdn to lockfile, skipping...
Cannot add local or malformed package /usr/lib/janet/.manifests/jdn.jdn to lockfile, skipping...
created lockfile.jdn

In both cases, the resulting lockfile is empty:

~/code-src/bagatto [master!] ⊕ cat lockfile.jdn                                                                               
@[]
sogaiu commented 2 years ago

AFAICT, here I get a similar result because the .jdn files under the .manifests directory do not contain :repo entries, e.g. json.jdn has the following content:

{:sha "c24d1b7b15f9c576e0d48bb78b351e88ce51cfcd"
 :paths @["/home/user/.local/lib/janet/json.so"
          "/home/user/.local/lib/janet/json.meta.janet"
          "/home/user/.local/lib/janet/json.a"]
 :type :git
 :url "https://github.com/janet-lang/json.git"
 :dependencies @[]}

IIUC, that causes the second branch to be taken in the following code: https://github.com/janet-lang/jpm/blob/1cd77f978afab5c722e61c6f3cf8adb1dfbafa90/jpm/pm.janet#L210-L212

bakpakin commented 2 years ago

You may need to rebuild the manifest with jpm clear-manifest.

sogaiu commented 2 years ago

FWIW, immediately after jpm clear-manifest, jpm make-lockfile gave me this:

$ jpm make-lockfile
error: cannot open directory /home/user/.local/lib/janet/.manifests
  in os/dir [src/core/os.c] on line 1858
  in make-lockfile [/home/user/.local/lib/janet/jpm/pm.janet] (tailcall) on line 208, column 13
  in _thunk [/home/user/.local/bin/jpm] on line -1, column -1
  in cli-main [boot.janet] on line 3618, column 39

Perhaps the .manifests directory was removed by jpm clear-manifest.

Doing a jpm deps and then trying again seemed to work though :)