-
Notifications
You must be signed in to change notification settings - Fork 1k
Conversation
Extract initial root manifest generation into an analyzer which combines evaluating the contents of the GOPATH with importing cfg from other managers.
This makes it easier for the importers to reuse its logic
* Warn that os, arch or subpackages specified in glide.yaml are ignored * Require the package.name field
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
@darkowlzz Woooooo! Reviewing now, I'll do my best to not cause too much grief as I work on getting #500 merged. |
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.
FYI, there will be more changes most likely incoming as a result of whatever changes are requested against #500.
c, has := manifest.Dependencies[id.ProjectRoot] | ||
if has { | ||
// Create PairedVersion if constraint details are available | ||
version := gps.NewVersion(c.Constraint.String()) |
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.
Doh! I completely forgot to pair the version in my PR. Nice catch! 😊
cmd/dep/godep_config_test.go
Outdated
t.Fatalf("Expected the lock to have a project for 'github.com/sdboyer/deptest' but got '%s'", p.Ident().ProjectRoot) | ||
} | ||
|
||
lv := p.Version().String() |
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.
Let's add a check that the version was paired with a revision. After I updated glide to copy what you are doing, I updated the test with this:
https://github.com/carolynvs/dep/blob/import-glide/cmd/dep/glide_config_test.go#L84
["init", "-no-examples", "-skip-tools"] | ||
], | ||
"error-expected": "", | ||
"gopath-initial": {}, |
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.
Let's pre-populate the gopath with the dependencies. This will:
a. Give us control over the versions used, so that they don't collide with the same versions in case 1. Right now the final Gopkg.lock is exactly the same between the two cases, making it hard to tell that the -skip-tools
flag worked.
b. Protect the test from failing when new releases are added to the test repositories. By omitting the repo from gopath, the test now depends on pulling the repo from the network.
- Adds test for PariedVersion in godep_config. - Adds dependency constraints in gopath-initial for godep integration tests when -skip-tools is used. This differentiates final locks for with and without tools.
Added the suggested test changes.
@carolynvs that's alright. Now we have working godep importer code. Once #500 is merged, we can just take the few godep parts from this PR and use them later. |
without having looked at the code in the PR yet at all, lemme just note that, given that Godep only ever stores commit hashes, probably the best route to follow is to transform it only into a lock - no manifest. We should also attempt to convert commit hashes into more friendly user-facing versions, if any are available. |
rootL.P[i] = lp | ||
} | ||
} | ||
} |
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.
@carolynvs a little problem here. Overlaying of lock isn't happening in some cases.
Let's take the example of integration test init/godep/case1/.
In godep/case1/testcase.json, although gopath-initial
contains deptest
, since deptest is a transitive dependency, the default (first analyzer) doesn't adds it to the manifest or lock it generates. And since there's no deptestdos
in gopath-initial
, the first analyzer generates empty (not nil) manifest and lock structs.
Now in the above code, when overlay is attempted for lock with godep analyzer generated manifest and lock,
for i, existingLP := range rootL.P {
is skipped because rootL
is empty from the first analyzer run. And no lock overlay happens.
Makes sense?
The final lock in init/godep/case1/ is incorrect at the moment. Commit hash in final lock is different from the one in Godep.json.
UPDATE: I see you have changed the overlay code in #500 and now it's handling this case :)
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.
Yeah found that I broke overlay at some point. I have a bunch of fixes/pr feedback I'll push tonight. 😊
break | ||
} | ||
} | ||
} |
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.
@sdboyer @carolynvs ^ tries to fetch version for a given commit hash. Is there anything, that you can think of, is available and I could have reused?
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.
That's how I would have done it. It seems useful enough that either a) it already exists in gps somewhere or b) would be a very nice function to extract out for other importers to use.
I had to do something similar for finding the default branch and ended up putting that logic into deduceConstraint. https://github.com/carolynvs/dep/blob/import-glide/cmd/dep/ensure.go#L310
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.
There is - have a look at version_unifier.go
. Actually, there's a whole pile of logic for this, but it's all hidden away unexported inside gps, as it's encoded as an extension to the Version
system, and I didn't want to leak an extra type out there.
I'd strongly prefer we not leak that unifier type publicly - note the unconditional panics in certain of the interface's method implementations - but we could expose some alternate frontend to it.
I've also been thinking that we might want to export the source
interface (and from there, sourceGateway
s), and include such methods on it. That's probably out of scope for immediate needs, though...
- Fetches versions list of project and looks for version corresponding to the given revision. - Adds test TestGodepConvertBadInput_EmptyPackageName for the same.
@darkowlzz #500 was just merged with lots of changes. Notably the config and importer structs were merged into a single struct and the interface tweaked slightly. Also I stole your logic for pairing a revision with a version and called the function I know a ton has changed out from underneath you, happy to answer any questions or help move this over! |
Closing this in favor of #742 . |
Refer #577
Built on top of #500
Adds
godep_config.go
,godep_importer.go
and tests.