Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notice showing when trying to install a dependency already in the list #436

Closed
f-f opened this issue Oct 3, 2019 · 7 comments
Closed

Comments

@f-f
Copy link
Member

f-f commented Oct 3, 2019

If the user tries to install a package that we already have as a dependency, they get shown a confusing warning:

$ spago init
Initializing a sample project or migrating an existing one..
Skipping package set version upgrade, already on latest version: "psc-0.13.3-20190920"
Set up a local Spago project.
Try running `spago build`

$ spago install prelude
Installing 4 dependencies.
Searching for packages cache metadata..
Recent packages cache metadata found, using it..
Copying from global cache: "console"
Copying from global cache: "prelude"
Copying from global cache: "psci-support"
Copying from global cache: "effect"
Installation complete.

$ spago install prelude
WARNING: configuration file was not updated. You should have a record with the `dependencies` key for this to work.
Installation complete.

This is because we have a check to warn the user about the config being the same as when they started the command (i.e. their command didn't do anything), which is useful in some cases, but confusing in this one.
We should instead detect that the package is already there and do not show this notice somehow.

@f-f
Copy link
Member Author

f-f commented Oct 5, 2019

Fixed in #439

@f-f f-f closed this as completed Oct 5, 2019
@chrissound
Copy link

I seem to still get this error, which makes me think this is a bug as this issue is a few years old.

codewarrior@blueberry:/home/chris/temp/wiptemp/767$ spago install halogen
[warn] Configuration file was not updated.
codewarrior@blueberry:/home/chris/temp/wiptemp/767$ spago --version
0.20.9
codewarrior@blueberry:/home/chris/temp/wiptemp/767$ npx spago install halogen
[warn] Configuration file was not updated.

With verbose:

codewarrior@blueberry:/home/chris/temp/wiptemp/767$ spago -v install halogen 
[debug] Running `getGlobalCacheDir`
[debug] Transformed config is the same as the read one, not overwriting it
[debug] Ensuring that the package set is frozen
[debug] Running `spago install`
[debug] Getting transitive deps
[debug] Transformed config is the same as the read one, not overwriting it
[warn] Configuration file was not updated.
[debug] Running `fetchPackages`
[debug] Checking if `purs` is up to date

@f-f
Copy link
Member Author

f-f commented Apr 20, 2023

@chrissound are you able to put together a small reproducing example?

@chrissound
Copy link

Definitely, it's all in docker and a barebones setup anyway so should be simple enough. Will likely be in the next day or so. :) thanks!

@chrissound
Copy link

git clone git@github.com:codewars/purescript.git
cd purescript
git reset --hard c3f4316d30bdd894b92499248f15840d767e17a3
docker build -t mcve-test .

docker run --name ps-test --net=host -d -it --entrypoint sh --rm mcve-test
docker exec ps-test \
  sh -c "cd /workspace; spago install halogen"
echo "---------------"
docker exec ps-test \
  sh -c "cd /workspace; spago install halogen; spago --version"

The above outputs:

Cloning into 'purescript'...
remote: Enumerating objects: 83, done.
remote: Counting objects: 100% (83/83), done.
remote: Compressing objects: 100% (55/55), done.
remote: Total 83 (delta 30), reused 61 (delta 15), pack-reused 0
Receiving objects: 100% (83/83), 12.86 KiB | 12.86 MiB/s, done.
Resolving deltas: 100% (30/30), done.
HEAD is now at c3f4316 Merge pull request #4 from 4500zenja1/main
Sending build context to Docker daemon  22.02kB
Step 1/10 : FROM buildpack-deps:bionic
 ---> aeecfa359fe2
Step 2/10 : RUN set -ex;     useradd --create-home codewarrior;     mkdir -p /workspace;     chown -R codewarrior: /workspace;
 ---> Using cache
 ---> ce437435b713
Step 3/10 : RUN set -ex;     curl -sL https://deb.nodesource.com/setup_16.x | bash -;     apt-get install -y nodejs;     apt-get clean;     rm -rf /var/lib/apt/lists/* /tmp/*;
 ---> Using cache
 ---> bd62bca1b09a
Step 4/10 : RUN npm install -g purescript@0.15.4;
 ---> Using cache
 ---> 2430b491137b
Step 5/10 : RUN npm install -g spago@0.20.9;
 ---> Using cache
 ---> 186fe8baf83e
Step 6/10 : COPY --chown=codewarrior:codewarrior workspace/ /workspace
 ---> Using cache
 ---> 2d9c970005b6
Step 7/10 : WORKDIR /workspace
 ---> Using cache
 ---> 99eeeebb5690
Step 8/10 : USER codewarrior
 ---> Using cache
 ---> 35f7155e84d6
Step 9/10 : ENV USER=codewarrior     HOME=/home/codewarrior     PATH=/opt/purescript:$PATH
 ---> Using cache
 ---> 2031307fb9a5
Step 10/10 : RUN set -ex;     cd /workspace;     npm install;     spago install;     spago build;     spago run;     spago test || true;     rm -rf ./src/Main.purs ./output/Main/ ./test/Example/ ./output/Example.ExampleSpec/;
 ---> Using cache
 ---> ad4fad876b5f
Successfully built ad4fad876b5f
Successfully tagged mcve-test:latest
9c45bcd686375ede6da6d46b2d052ee97eafe9b64e5459425100042910d6ee8c
[info] Installing 16 dependencies.
[info] Searching for packages cache metadata..
[info] Unable to find packages cache metadata, downloading from GitHub..
[info] Installing "web-file"
[info] Installing "unsafe-reference"
[info] Installing "freeap"
[info] Installing "web-touchevents"
[info] Installing "media-types"
[info] Installing "web-pointerevents"
[info] Installing "web-storage"
[info] Installing "web-dom"
[info] Installing "web-events"
[info] Installing "halogen-vdom"
[info] Installing "web-uievents"
[info] Installing "halogen-subscriptions"
[info] Installing "web-html"
[info] Installing "halogen"
[info] Installing "dom-indexed"
[info] Installing "web-clipboard"
[info] Installation complete.
---------------
[warn] Configuration file was not updated.
0.20.9

@f-f
Copy link
Member Author

f-f commented Apr 21, 2023

@chrissound is this unexpected? Spago is adding halogen to the config the first time you call spago install halogen (before you print that series of hyphens).
If you call the command again it will realise that halogen is already in the config and inform you about that.

@chrissound
Copy link

chrissound commented Apr 22, 2023

Hmmm I wasn't paying too careful attention when I did this. So I likely ran spago install halogen a second time, however when I saw the error I mistakenly assumed it was an error/config file for the halogen library itself. It feels like a side effect to be modifying a local file with an install command as opposed to something like add as in npm add or some kind of --update-config flag, it's not something I expected.

Specially as it's a warn, maybe a better message is something like [info] The 'halogen' package is already installed and configured in your spago config file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants