You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
haddock: can't find a package database at <sandbox> #1281
Aha. I found the reason. This package that I'm building docs for was add-source'd into haskell-names, so it was configured with its sandbox package database. cabal clean solved the problem.
It'd still be nice if that didn't happen, but I've no idea how to address it.
Perhaps add-source'd packages should be copied rather than built in place?
This way they'll have to be rebuilt from scratch each time, which is unrealistic. The point of add-source is that it tracks changes in the add-sourced directories. I guess we can run cabal clean on all add-source packages in cabal sandbox delete, except that won't help if you delete the sandbox with rm.
In any case, copying will also introduce additional overhead on each build. Current behaviour is already annoying, and this will just make it worse. I think that implementing add-source --snapshot is a better way to work around this.
...though if we decide to implement the smarter rebuild check I described in #1274, copying might become feasible (just copy over the files that have a newer timestamp than .cabal-sandbox/sandbox-timestamp).
Copying the source files is not really necessary. It doesn't really matter where source files lie, as soon as we always want to use the latest version (which is not true for --snapshot — I realize it.). What we really want is just to use a different build tree (i.e. a different dist directory) to keep things hygienic. So a simple proposal could be:
for cabal commands inside that directory, use dist as we've always done
if we're building something in that directory for the purpose of a sandbox, use dist-$ID, where $ID could be a hash of the sandbox path, for example.
@feuerbach
On second thought I think this won't work. --builddir is set at configure time, so if you try to build an add-sourced project after the sandbox has been deleted, you'll still get an error.
But a different dist directory would also have its own setup-config. So sandboxes wouldn't even have a chance to interfere with ordinary cabal commands and with each other.
I think people shouldn't be using the same source directory for different sandboxes. It's confusing (modifying the source for the purpose of one project will affect the other). If we accept that we should be fine using the builddir in the add-source:d package's dir. This might require some retraining for a few people, but I think it's worth it.
Alternatively we could try to use the builddir of the current package for all building. This makes sense when we move to a less current-package centric world where the builddir will probably be in a directory that doesn't contain any packages.
If the source a git clone then I think it should be fine. Although I'd like to support this case directly in the future.
What I meant is that the following is a bad idea:
mkdir proj1
git clone https://github.com/bos/text.git
cd proj1
cabal add-source ../text
$EDITOR ../text/SomeSource.hs
cabal build
# Some time later:
mkdir proj2
cd proj2
cabal add-source ../text
$EDITOR ../text/SomeSource.hs
cabal build
As changes made to text for the purpose of proj2 happened to affect proj1. The user probably wanted to clone the text repo twice, once for each project.
As changes made to text for the purpose of proj2 happened to affect proj1.
This may or may not be a bad idea, depending on the circumstances. E.g. a company can have a bunch of patched libraries intended to be used by all projects in the source tree.
This may or may not be a bad idea, depending on the circumstances. E.g. a company can have a bunch of patched libraries intended to be used by all projects in the source tree.
That's totally fine. Those patches would be checked into the source tree. What I'm saying is not the greatest idea is to share local modifications (i.e. not checked in) between two local checkouts of two different projects.
Also, using the builddir in the add-sourced package dir won't by itself prevent the users from reusing the same source directory for different sandboxes. We'll have to come up with additional checks.
It's confusing (modifying the source for the purpose of one project will affect the other).
I don't think it's confusing — it's doing precisely what the user has asked. Yes, users can make mistakes, but you can't prevent all of them. If you force the user to have two separate source trees, it is as likely that she will make changes to the wrong tree, or make changes to one when both need that change.
Activity
UnkindPartition commentedon Apr 21, 2013
Aha. I found the reason. This package that I'm building docs for was add-source'd into haskell-names, so it was configured with its sandbox package database.
cabal cleansolved the problem.It'd still be nice if that didn't happen, but I've no idea how to address it.
UnkindPartition commentedon Apr 21, 2013
Perhaps add-source'd packages should be copied rather than built in place?..
23Skidoo commentedon Apr 21, 2013
This way they'll have to be rebuilt from scratch each time, which is unrealistic. The point of
add-sourceis that it tracks changes in the add-sourced directories. I guess we can runcabal cleanon all add-source packages incabal sandbox delete, except that won't help if you delete the sandbox withrm.Again,
add-source --snapshotwould help here.UnkindPartition commentedon Apr 21, 2013
Not necessarily. We could keep the build tree (
*.o,*.hietc.) and copy source files preserving modification time.23Skidoo commentedon Apr 21, 2013
Is there a portable way to do this?
23Skidoo commentedon Apr 21, 2013
In any case, copying will also introduce additional overhead on each build. Current behaviour is already annoying, and this will just make it worse. I think that implementing
add-source --snapshotis a better way to work around this.23Skidoo commentedon Apr 22, 2013
...though if we decide to implement the smarter rebuild check I described in #1274, copying might become feasible (just copy over the files that have a newer timestamp than
.cabal-sandbox/sandbox-timestamp).UnkindPartition commentedon Apr 23, 2013
I've got a new idea.
Copying the source files is not really necessary. It doesn't really matter where source files lie, as soon as we always want to use the latest version (which is not true for
--snapshot— I realize it.). What we really want is just to use a different build tree (i.e. a differentdistdirectory) to keep things hygienic. So a simple proposal could be:distas we've always donedist-$ID, where$IDcould be a hash of the sandbox path, for example.Would it make things any easier for you?
23Skidoo commentedon Apr 24, 2013
@feuerbach I like this idea. We will still use copying for things like
--snapshotand references to git repos.@tibbe, what do you think?
23Skidoo commentedon Apr 24, 2013
@feuerbach
On second thought I think this won't work.
--builddiris set at configure time, so if you try tobuildan add-sourced project after the sandbox has been deleted, you'll still get an error.UnkindPartition commentedon Apr 24, 2013
But a different
distdirectory would also have its ownsetup-config. So sandboxes wouldn't even have a chance to interfere with ordinary cabal commands and with each other.23Skidoo commentedon Apr 24, 2013
@feuerbach You may be right, I need to test this.
tibbe commentedon Apr 24, 2013
I think people shouldn't be using the same source directory for different sandboxes. It's confusing (modifying the source for the purpose of one project will affect the other). If we accept that we should be fine using the builddir in the add-source:d package's dir. This might require some retraining for a few people, but I think it's worth it.
Alternatively we could try to use the builddir of the current package for all building. This makes sense when we move to a less current-package centric world where the builddir will probably be in a directory that doesn't contain any packages.
@dcoutts thoughts?
23Skidoo commentedon Apr 24, 2013
I'm not sure this won't lead to conflicts. I think something like
.cabal-sandbox/dist/$PACKAGENAME-distis better.23Skidoo commentedon Apr 24, 2013
If the source a git clone then I think it should be fine. Although I'd like to support this case directly in the future.
tibbe commentedon Apr 24, 2013
Yes, that's what I had in mind. We should still compile the current package in
distas users will expect that dir to be there.tibbe commentedon Apr 24, 2013
What I meant is that the following is a bad idea:
As changes made to text for the purpose of proj2 happened to affect proj1. The user probably wanted to clone the text repo twice, once for each project.
23Skidoo commentedon Apr 24, 2013
This may or may not be a bad idea, depending on the circumstances. E.g. a company can have a bunch of patched libraries intended to be used by all projects in the source tree.
tibbe commentedon Apr 24, 2013
That's totally fine. Those patches would be checked into the source tree. What I'm saying is not the greatest idea is to share local modifications (i.e. not checked in) between two local checkouts of two different projects.
23Skidoo commentedon Apr 24, 2013
Yes, I guess that could be confusing. The behaviour described in the first post is also confusing.
I should say that I like this idea better than copying. We'll still use copying (or tarballs, like
cabal-dev) for--snapshot.23Skidoo commentedon Apr 24, 2013
Also, using the builddir in the add-sourced package dir won't by itself prevent the users from reusing the same source directory for different sandboxes. We'll have to come up with additional checks.
UnkindPartition commentedon Apr 24, 2013
I don't think it's confusing — it's doing precisely what the user has asked. Yes, users can make mistakes, but you can't prevent all of them. If you force the user to have two separate source trees, it is as likely that she will make changes to the wrong tree, or make changes to one when both need that change.
Use a non-default build dir when building add-source deps.