Closed tamird closed 9 years ago
@dkulchenko the title should be "Bunchfile.lock versions not being respected during install"
Copied your Bunchfile/.lock verbatim into a test dir:
daniilk:~/test ∞ bunch i
setting up github.com/cockroachdb/cockroach-prod link ... done
fetching github.com/awslabs/aws-sdk-go/service/ec2 ... done
fetching github.com/awslabs/aws-sdk-go/service/elb ... done
installing github.com/awslabs/aws-sdk-go/service/ec2 ... done
installing github.com/awslabs/aws-sdk-go/service/elb ... done
daniilk:~/test ∞ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git rev-parse HEAD)
deaa78b60cfd55045252c52f4f7840c6d697c491
daniilk:~/test ∞
What you're running is a rebuild (which is just an alias for bunch update
). An update forces a checkout of the latest version and will ignore pinned versions in the Bunchfile.lock, exactly as rubygems and npm behave.
But now that I think about it, a "rebuild" should probably not have that behavior, only an "update" proper should. Done in 3d071d52f.
Your change fixed bunch rebuild
, but bunch install
is still broken.
Your change fixed bunch rebuild, but bunch install is still broken.
How so? My comment above shows version pinning during an install working perfectly fine with your provided Bunchfile.
Right, install does the right thing the first time - if you create a drift between what's in Bunchfile.lock
and what's on disk (as would happen when someone updates a project's dependencies), bunch install
will happily report that everything is up to date.
I'm not seeing it. Set a new version in the Bunchfile.lock:
daniilk:~/test ∞ cat Bunchfile.lock
{
"github.com/awslabs/aws-sdk-go/service/ec2": "b7d25c610b45f96dd22ed98469a0a05b85d7a54f",
"github.com/awslabs/aws-sdk-go/service/elb": "b7d25c610b45f96dd22ed98469a0a05b85d7a54f"
}
daniilk:~/test ∞ bunch i
fetching github.com/awslabs/aws-sdk-go/service/ec2 ... done
installing github.com/awslabs/aws-sdk-go/service/ec2 ... done
daniilk:~/test ∞ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git rev-parse HEAD)
b7d25c610b45f96dd22ed98469a0a05b85d7a54f
daniilk:~/test ∞
And changing it back...
daniilk:~/test ∞ cat Bunchfile.lock
{
"github.com/awslabs/aws-sdk-go/service/ec2": "deaa78b60cfd55045252c52f4f7840c6d697c491",
"github.com/awslabs/aws-sdk-go/service/elb": "deaa78b60cfd55045252c52f4f7840c6d697c491"
}
daniilk:~/test ∞ bunch i
fetching github.com/awslabs/aws-sdk-go/service/ec2 ... done
installing github.com/awslabs/aws-sdk-go/service/ec2 ... done
daniilk:~/test ∞ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git rev-parse HEAD)
deaa78b60cfd55045252c52f4f7840c6d697c491
daniilk:~/test ∞
$ go get -u github.com/dkulchenko/bunch
$ cat Bunchfile.lock
{
"github.com/awslabs/aws-sdk-go/service/ec2": "deaa78b60cfd55045252c52f4f7840c6d697c491",
"github.com/awslabs/aws-sdk-go/service/elb": "deaa78b60cfd55045252c52f4f7840c6d697c491"
}
$ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git rev-parse HEAD)
29717a72a2fc649e790ce97dc2c4d96e32950844
$ bunch i
up to date (use 'bunch update' to force update)
$ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git rev-parse HEAD)
29717a72a2fc649e790ce97dc2c4d96e32950844
$ bunch --verbose i
skipping github.com/cockroachdb/cockroach-prod, up to date
skipping github.com/awslabs/aws-sdk-go/service/ec2, up to date
skipping github.com/awslabs/aws-sdk-go/service/elb, up to date
$ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git rev-parse HEAD)
29717a72a2fc649e790ce97dc2c4d96e32950844
Ah, here's the reason:
$ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git branch)
* master 29717a7 Updated service examples to do nil check before using err
$ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git status)
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
$ bunch i
up to date (use 'bunch update' to force update)
$ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git checkout head^)
Note: checking out 'head^'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 38194d5... aws/awserr: Cleaned up Error examples
$ (cd .vendor/src/github.com/awslabs/aws-sdk-go; git status)
HEAD detached at 38194d5
nothing to commit, working directory clean
$ bunch i
fetching github.com/awslabs/aws-sdk-go/service/ec2 ... done
installing github.com/awslabs/aws-sdk-go/service/ec2 ... done
So when things are sitting on master
, bunch gets confused and decides they're all up to date.
Good catch, thanks! Should be fixed in 75101f3.
Works. Thanks.
consider the following Bunchfile:
and the following Bunchfile.lock:
Also consider:
In other words, the checked-out ref on disk does not match the ref specified in Bunchfile.lock. Now, consider the output of various bunch commands:
Am I doing something wrong? cc @MBerhault