-
Notifications
You must be signed in to change notification settings - Fork 696
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
--offline flag doesn't seem to affect new-build #5346
Comments
Looks like an oversight. |
This is affecting our workflow at the day job. Sometimes folks will update our |
@parsonsmatt if you have cabal >= 3.4, you can use -- "Offline" mode
active-repositories: none Maybe |
Furthermore, I note that there's a global I'd like discussion to confirm first what I think -- i.e. that the |
Ok, there's a pr in place to get the active repositories flag documented in So as a distinct discussion we should just figure out the best solution for the existing |
There might be problems with "file" repositories. Technically, those are "offline", but will still be deactivated by that flag I think |
That should fix our use case, thanks! I think it'd be nice to have Having If the intent is to remove the |
By the way, one really nice thing that the Nix tools now do is automatically detect whether you're online, so when you're on the airplane or whatnot it behaves sensibly and gives "you can't do this without the internet" error messages. |
Another problem is source repositories in the |
We definitely should find a better interaction for the source repository issue! And this motivates keeping the offline flag -- to both handle that situation, and also set active repositories to either none, or only file-based ones. 🤔 |
I want to try looking into this |
I'm trying to write a test for this. Is there a way to force cabal to check a specific directory for a local package? That way I can write a script that deletes that directory every time and forces cabal to re download the package |
See "Hermetic tests" and possibly "How can I add a dependency on a package from Hackage in a test?" in cabal-testsuite |
@fgaz I can add a dependency but I assume that would pull from my |
Local as in the current host, in the Cabal store? I’m asking because “local package” means something completely different in Cabal’s parlance. To answer that (according to my understanding of your question), there’s a --store-dir option, which comes close. Otherwise, you could use cabal.project file with source-repository-package, I think. More generally, it’s not clear to me that your question necessarily needs to be solved to write a test for this. Could you perhaps lay out your idea for a test in more detail? That way you will have a better chance for helpful comments. |
@ulysses4ever I am trying to write a test that will probably go in the |
I assume that's what the flag is supposed to do |
I need to have control of the package directory because I need to remove the folder before it runs and I don't want it to be affected by my local packages in my |
@cbclemmer okay, there are several conditions one may test here. For example, assuming
By default, the cache is empty, so it seems straightforward to test (2). How about we stop here and leave (1) for future work? More concretely, how about adding an integration test with a package |
@cbclemmer: no pressure ;) but do you require assistance? |
@Mikolaj I was working on making a test for it and it took longer than I thought. Now I'm not doing much oss stuff until the holidays are over. Someone is free to take it if they want to but otherwise I'll get back to it in January |
@cbclemmer: no rush. I wish you that the holidays are merry for you. :) |
@ulysses4ever I've been work on this on and off and I got a test that should create a new store and retrieve from a local repo, but I can't get the output to say that it is "downloading". I tried to do it as you outlined before but that's what I end up with. Can you look at my test and see if I'm missing something? Here is the branch and the test folder is |
That's the crux of the issue and the reason I proposed what I proposed above: afaik you can't get an explicit message that the cache is used or not used. My proposal above is supposed to work around it. I looked at your test case: it looks pretty good. It's just I think you have to Thank you for working on it! |
I believe this is still an issue for |
This is an excerpt from the output of running
cabal new-build --offline
:Either the
--offline
flag isn't working, or that is some misleading build output?Here's another trial, this time with my network link disabled and
~/.cabal
directory cleared:Again here it seems like it's trying to make HTTP requests despite the
--offline
flag which I thought was supposed to be an instruction to the contrary.For context: My Nix shell environment should be providing all of the necessary dependencies, so I don't ever need or want cabal-install to download anything.
The text was updated successfully, but these errors were encountered: