-
Notifications
You must be signed in to change notification settings - Fork 1k
Conversation
Test failure seems to be related to credentials, I think its spurious. |
Awesome, so cool that you jumped on this right away! At the same time, I feel a bit bad - I totally meant to follow up over on #120 with some guiding suggestions on this, and didn't 😞. Hopefully it won't feel like too much wasted time, as this clearly gave you an opportunity to reach in and get familiar with some more of the gps API - which is great! So, a couple issues with the approach here. First - I think that all the information you're gleaning from the filesystem should be available in the project's lock file, via the Where "P" is the project code, "M" is the manifest, "L" is the lock, and "D" is the dependency code. As written, this is sorta jumping from "P" straight to "D". It's not that that can't work, but that it could undermine overall system consistency, if only by working differently than the other commands. I'm happy to go into more detail if you want, but for now will spare you the details 😄 To this end, I might change the following:
In an entirely separate direction, the thing I was thinking about posting last night was that we might instead look at this as modifications to be made to The advantages of taking this approach are:
|
Thanks for the feedback - will have a go at incorporating that tonight.
…On Mon, Mar 13, 2017 at 1:17 PM sam boyer ***@***.***> wrote:
Awesome, so cool that you jumped on this right away!
At the same time, I feel a bit bad - I totally meant to follow up over on
#120 <#120> with some guiding
suggestions on this, and didn't 😞. Hopefully it won't feel like too much
wasted time, as this clearly gave you an opportunity to reach in and get
familiar with some more of the gps API - which is great!
So, a couple issues with the approach here. First - I think that all the
information you're gleaning from the filesystem *should* be available in
the project's lock file, via the packages key each entry has. The general
rule behind the behavior of a gps-backed system is that we try to operate
in terms of relations between a series of states:
[image: all-sync]
<https://cloud.githubusercontent.com/assets/21599/23855006/6b1f5b28-07ca-11e7-88b2-997b87eddf56.png>
Where "P" is the project code, "M" is the manifest, "L" is the lock, and
"D" is the dependency code. As written, this is sorta jumping from "P"
straight to "D". It's not that that can't work, but that it could undermine
overall system consistency, if only by working differently than the other
commands. I'm happy to go into more detail if you want, but for now will
spare you the details 😄
To this end, I might change the following:
1. Start with doing input hash comparison against what's in the lock
(see the dep status cmd implementation for an example). If the hashes
don't match, I'd say this should probably bail out; better to have manifest
and lock in a consistent state before messing with vendor/.
2. If the hashes match, then trust the package list you see in the
lock; don't bother with reparsing code in vendor for imports.
In an entirely separate direction, the thing I was thinking about posting
last night was that we might instead look at this as modifications to be
made to gps.WriteDepTree. That third parameter, which currently controls
whether or not nested vendor/ dirs should be stripped out, could be
changed to take, say, a bitmask that controls which of a set of pruning
behaviors should be applied.
The advantages of taking this approach are:
1. We can potentially avoid ever writing the files, rather than
removing them after writing them.
2. We can consider the possible pruning strategies and implement them,
independent of what we immediately decide in dep. dep can then decide
what it needs and just flip flags later.
3. In the scenario that this ends up in a standalone tool, it'll still
be easy for that tool to pick up and just use the logic we've written into
gps.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#322 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAbGheNmZzq81tC9ij37a1O4McTYdKczks5rlUHNgaJpZM4MbGHm>
.
|
@sdboyer I've added the check for the lock file hash; it doesn't seem to make a huge amount of sense to read the dependencies out of the lock file, as it seems you need to calculate the dependencies to check the lock file hash... let me know if I'm missing anything here.
If I'm reading the code correctly, wouldn't this entail making prune an option to |
Actually computing dependencies is done by a call to
It wouldn't necessitate it - we could implement pruning as a call to that func, so it'd just recreate |
Ah I see, you're suggesting we compute the interdependencies between the modules in
Okay, I think I follow - let me take a another stab. Thanks for your patience. |
Err...no? I'm suggesting the opposite. I'm saying don't call s, err := gps.Prepare(params, sm)
if err != nil {
return fmt.Errorf("could not set up solver for input hashing: %s", err)
}
if bytes.Equal(s.HashInputs(), p.Lock.Memo) {
// do prune stuff, because we know the lock is an acceptable solution for the inputs
} I'm also suggesting that you not care about the import statements of the actual code in |
Ah I see - thats what I'm doing here: 73da178#diff-ea232c8c4adc96b53990f3c480439164R80 I didn't realise the lock file also contains transitive dependancies, but that makes sense now. |
I've done this now; didn't go for a bit mask just yet, as there are only two options.
I still copy the files into (a temporary) vendor dir then go through and remove them, as that was a small change and matches how the nested vendor dir stripping works. WDYT? |
@sdboyer ping? |
yikes, eleven days. sorry, i've been falling behind with dep things, in
part due to finangling a job change.
i'll try to make a proper response here tonight.
…On 3/26/17 10:42, Tom Wilkie wrote:
@sdboyer <https://github.com/sdboyer> ping?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#322 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AABUX_jDerMh8gW9ThU4-JQNm9l0eWoRks5rpnlMgaJpZM4MbGHm>.
|
No worries! Just wanted to make sure it wasn't because it took me 4 goes to get there... Let me know if I can help out in any way. |
FWIW I tested this PR locally and ran into an error:
I have an override specified for the serf package and it specifies an alternate location: "github.com/hashicorp/serf": {
"branch": "nc-fix-races",
"source": "https://github.com/nathanielc/serf.git"
} |
...and i did it again. Sorry, @tomwilkie. Let's get this moving. First thing - we have to split it up, as we can't make changes directly in In the meantime, let's go back to just doing the pruning work after the Sound good? Again, sorry for the ridiculous delay. |
@nathanielc interesting - I don't immediately see what in this PR would cause that to happen (but not happen on a normal |
Sounds good! I'll investigate this error too.
…On Wed, 5 Apr 2017 at 18:41, sam boyer ***@***.***> wrote:
@nathanielc <https://github.com/nathanielc> interesting - I don't
immediately see what in this PR would cause that to happen (but not happen
on a normal dep ensure, but it's a good data point- thanks!
...and i did it again. Sorry, @tomwilkie <https://github.com/tomwilkie>.
Let's get this moving. First thing - we have to split it up, as we can't
make changes directly in vendor/. (It's strange that tests are even
passing - I've pinged @jessfraz <https://github.com/jessfraz> about the
black bash magic she conjured in hack/validate-vendor.bash). So let's
pull that stuff out into a PR against gps.
In the meantime, let's go back to just doing the pruning work after the
gps.WriteDepTree() call. So, copy over calculatePrune() and deleteDirs()
into somewhere within dep, then just do those operations in-place on vendor
tree you've written to the tempdir in PruneProject().
Sound good? Again, sorry for the ridiculous delay.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#322 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAbGhdEnvzjmRmMK-9ru9uhyXsfJjTbQks5rs9JJgaJpZM4MbGHm>
.
|
- Check the external dependencies match those in the lock file. - Read all the dependencies out of the lock file, don't calculate them myself. - Prune by rebuilding the vendor dir with WriteDepTree
@sdboyer there you go - I squashed the whole thing down and rebased on something more recent too. No changes in gps required. @nathanielc there were a few bugs in the version you ran, when I moved the code into gps I accidentally got a bit over-zealous about what I deleted. I've ran this new version on a couple of large project and it worked for me - mind testing again? |
@tomwilkie Thanks its working! My vendor dir went from 2M loc to 500K loc. Thanks! |
Excellent. Thanks for testing it.
…On Fri, 7 Apr 2017 at 20:41, Nathaniel Cook ***@***.***> wrote:
@tomwilkie <https://github.com/tomwilkie> Thanks its working! My vendor
dir went from 2M loc to 500K loc. Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#322 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAbGhRNiH2sIUfixsgpL_O5dSDxm8hARks5rtpFcgaJpZM4MbGHm>
.
|
hey hey sorry for the delay, back to real life now, so is the validate vendor still not working... i see that this is green but I can look into any problems with it |
@jessfraz welcome back 😄 so @tomwilkie's latest doesn't break the |
|
||
const pruneShortHelp = `Prune the vendor tree of unused packages` | ||
const pruneLongHelp = ` | ||
Prune is used to remove unused packages from your vendor tree. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I now just have one docs nit...let's please have this say the following:
Prune is used to remove unused packages from your vendor tree.
STABILITY NOTICE: this command creates problems for vendor/ verification. As such, it may be removed and/or moved out into a separate project later on.
I just want to warn people everywhere we can 😄
sweet will play around and see whats up |
@sdboyer sorry for the delay, am travelling tight now. Have added the stability notice. Thanks. |
Fantastic. In we go. Thanks so much! |
Thanks!
…On Thu, 13 Apr 2017 at 01:21, sam boyer ***@***.***> wrote:
Merged #322 <#322>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#322 (comment)>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AAbGhZAjS5y7Yv-V1fWl0zC75vI-T_-Iks5rvbDPgaJpZM4MbGHm>
.
|
Add dep prune subcommand
@tomwilkie @sdboyer Any reason this was implemented as a separate command and not in form of a flag on $ dep ensure -prune -update
$ dep ensure -prune github.com/pkg/errors@^v2.0.0 This is good progress, by the way! Thanks for your work. |
@VojtechVitek lots of discussion as to why went on on issue #120 |
Part of #120
This changes adds a basic pruning strategy for the vendor directory. Before this changes, vendoring with
dep
resulting in a +4m loc change to weaveworks/cortex vsgvt
, after running prune its -1.3m.There is a bunch left to do, I thought it best to open this PR and get feedback early. If you like this approach I will open a PR on sdboyer/gps for the
PackageDeps
method.We could also potentially add code to remove non-go files and
*_test.go
from vendoring - currently I use this in my makefile: