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

offline flag disables source-repository-package sync #9771

Merged
merged 1 commit into from
Mar 8, 2024

Conversation

peterbecich
Copy link
Member

@peterbecich peterbecich commented Mar 4, 2024

Closes: #9641

How this was tested:

  • use the example project: https://github.com/peterbecich/cabal2nix-project-issue
    • this example pulls the text library as a source-repository-package
  • build, install Cabal from this PR
    • cabal install cabal --overwrite-policy=always
  • in the example project, delete dist-newstyle to remove the text library cached there
    • rm -rf dist-newstyle; ~/.cabal/bin/cabal build
    • text library pulled, build succeeds
  • next, build with the cached text library and offline flag
    • ~/.cabal/bin/cabal build --offline
    • this succeeds
    • offline flag does not break the cached library
  • next, delete dist-newstyle again, and attempt build with --offline
    • rm -rf dist-newstyle; ~/.cabal/bin/cabal build --offline
    • this fails, as intended
    • this proves the offline flag is preventing the text library from being pulled
    • the error message could be improved:
$ rm -rf dist-newstyle; ~/.cabal/bin/cabal build --offline
.../dist-newstyle/src/text-8e814f5854032da8: getDirectoryContents:openDirStream:
  does not exist (No such file or directory)

Please read Github PR Conventions and then fill in one of these two templates.


Template Α: This PR modifies cabal behaviour

Include the following checklist in your PR:

  • Patches conform to the coding conventions.
  • Any changes that could be relevant to users have been recorded in the changelog.
  • The documentation has been updated, if necessary.
  • Manual QA notes have been included.
  • Tests have been added. (Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!)

@geekosaur
Copy link
Collaborator

I do wonder if this should print something (not sure if level info or warning) when skipping due to being offline.

@peterbecich
Copy link
Member Author

I have implemented a warning. However, it is still followed by a cryptic error message:

$ rm -rf dist-newstyle; ~/.cabal/bin/cabal build --offline
Warning: --offline was specified, skipping sync of repositories:
Warning: https://github.com/haskell/text.git
.../dist-newstyle/src/text-8e814f5854032da8: getDirectoryContents:openDirStream: does not exist (No such file or directory)

If the dependency is cached, there is only a warning

$ ~/.cabal/bin/cabal build --offline
Warning: --offline was specified, skipping sync of repositories:
Warning: https://github.com/haskell/text.git
Warning: no repository provided none
Resolving dependencies...

@peterbecich
Copy link
Member Author

@geekosaur , can this be merged? Thanks

@geekosaur
Copy link
Collaborator

It needs another reviewer; I've attached the needs-review label, which hopefully will get some more eyes on it.

@peterbecich
Copy link
Member Author

Thank you

@geekosaur
Copy link
Collaborator

I'll add the "merge me" label for you per the PR guidelines. There will then be a 2 day cooldown period to let others comment on the PR before Mergify merges it.

@geekosaur geekosaur added merge me Tell Mergify Bot to merge and removed attention: needs-review labels Mar 6, 2024
@mergify mergify bot added the merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days label Mar 8, 2024
haskell#9641

warning when offline mode skips `source-repository-package`s
i.e.
```
Warning: --offline was specified, skipping sync of repositories:
Warning: https://github.com/haskell/text.git
```
@mergify mergify bot merged commit b0f9d0b into haskell:master Mar 8, 2024
54 checks passed
@peterbecich peterbecich deleted the source-repo-offline branch March 14, 2024 01:30
@Kleidukos
Copy link
Member

@Mergifyio backport 3.12

Copy link
Contributor

mergify bot commented May 16, 2024

backport 3.12

✅ Backports have been created

mergify bot added a commit that referenced this pull request May 16, 2024
offline flag disables `source-repository-package` sync (backport #9771)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge delay passed Applied (usually by Mergify) when PR approved and received no updates for 2 days merge me Tell Mergify Bot to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

source-repository-package clone not disabled by --offline flag or active-repositories
5 participants