spago icon indicating copy to clipboard operation
spago copied to clipboard

--config option doesnt accept absolute path

Open srghma opened this issue 6 years ago • 2 comments
trafficstars

if you do

YOUR_PROJECT_DIR_FULLPATH=$HOME/example
YOUR_PROJECT_DIR_RELATIVE_PATH=example
cd $SOME_OTHER_DIR

then

$ spago --config $YOUR_PROJECT_DIR_FULLPATH/spago.dhall list-packages --filter transitive --json
spago:
Error: Invalid input

(input):1:3:
  |
1 | .//home/srghma/projects/spago2nix/spago.dhall
  |   ^
unexpected '/'
expecting expression or whitespace

and

$ spago --config $YOUR_PROJECT_DIR_RELATIVE_PATH/spago.dhall list-packages --filter transitive --json
↳ ./packages.dhall

Error: Missing file ./packages.dhall

21│     ./packages.dhall

21:5

real example

[nix-shell:~/projects]$ spago --config $HOME/projects/spago2nix/spago.dhall list-packages --filter transitive --json
spago:
Error: Invalid input

(input):1:3:
  |
1 | .//home/srghma/projects/spago2nix/spago.dhall
  |   ^
unexpected '/'
expecting expression or whitespace


[nix-shell:~/projects]$ spago --config spago2nix/spago.dhall list-packages --filter transitive --json
spago:
↳ ./packages.dhall

Error: Missing file ./packages.dhall

21│     ./packages.dhall

21:5

[nix-shell:~/projects]$

the second error Missing file ./packages.dhall is a bit different, I believe that path should be derived from spago.dhall packages option

{-
Welcome to a Spago project!
You can edit this file as you like.
-}
{ sources =
    [ "src/**/*.purs", "test/**/*.purs" ]
, name =
    "my-project"
, dependencies =
    [ "console"
    , "generics-rep"
    , "kishimen"
    , "node-fs-aff"
    , "parallel"
    , "prelude"
    , "simple-json-utils"
    , "sunde"
    , "validation"
    ]
, packages =
    ./packages.dhall
}

srghma avatar Oct 27 '19 16:10 srghma

Hi @srghma! I can reproduce the first problem you reported, and it's a bug in this line: https://github.com/spacchetti/spago/blob/8ce19ea5648f8bd65d6db88428bac56e66cf2560/src/Spago/Config.hs#L115

The way we should fix it is that we should call makeAbsolute on the config path, either here or when we read it in

I cannot replicate the second problem you report, could you share a repo with instructions on how to replicate this? Also a gist or a series of commands could work

f-f avatar Nov 04 '19 09:11 f-f

I cannot replicate the second problem you report, could you share a repo with instructions on how to replicate this? Also a gist or a series of commands could work

I have created separate issue https://github.com/spacchetti/spago/issues/478

srghma avatar Nov 04 '19 10:11 srghma

The new Spago does not allow for pointing to a configuration anymore, see the new docs on monorepo support

f-f avatar Sep 20 '23 16:09 f-f