Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Address mixup between bzr revisions and semver suffixes #869

Merged
merged 3 commits into from
Jul 22, 2017

Conversation

sebdah
Copy link
Contributor

@sebdah sebdah commented Jul 21, 2017

What does this do / why do we need it?

This PR handles the case in the godep_importer where the imported dependency is referencing a semantic version with a suffix. E.g.

{
	"ImportPath": "github.com/Shopify/sarama",
	"Comment": "v1.12.0-12-g2fd980e",
	"Rev": "2fd980e23bdcbb8edeb78fc704de0c39a6567ffc"
},

Will now become:

[[constraint]]
  name = "github.com/Shopify/sarama"
  version = ">=1.12.0, <=12.0.0-g2fd980e"

What should your reviewer look out for in this PR?

As per my understanding it is fine to assume that bzr revisions contain @ symbols. But I'm not a bzr user so I'm half guessing (with some reading on the Internet) that it's valid.

Do you need help or clarification on anything?

I think I've gotten what I needed in #827.

There was a comment in the code that I modified that was a bit too long. I have wrapped it. Don't know if you'd like to keep such things out of the PR. Let me know and I can drop that commit, no biggie 😄 .

Which issue(s) does this PR fix?

fixes #827

This commit addresses an issue where the godep importer would confuse semver
suffixes for being bzr revisions.

Now we have stricter checks on the bzr revision checks which will be able to
distinguish between semver with a suffix and a bzr revision. The new check
enforces bzr revisions to contain an @ symbol.

Closes golang#827.
@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

@sebdah
Copy link
Contributor Author

sebdah commented Jul 21, 2017

I signed it!

@googlebot
Copy link
Collaborator

CLAs look good, thanks!

@sebdah sebdah mentioned this pull request Jul 21, 2017
Copy link
Collaborator

@carolynvs carolynvs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hurray! This is a great fix and I'm glad y'all found the real root cause of the bug.

@@ -479,7 +479,7 @@ func (sm *SourceMgr) InferConstraint(s string, pi ProjectIdentifier) (Constraint
// Next, try for bzr, which has a three-component GUID separated by
// dashes. There should be two, but the email part could contain
// internal dashes
if strings.Count(s, "-") >= 2 {
if strings.Contains(s, "@") && strings.Count(s, "-") >= 2 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Nice catch!

@@ -24,10 +24,16 @@ func TestSourceManager_InferConstraint(t *testing.T) {
t.Fatal(err)
}

svs, err := NewSemverConstraintIC(">=0.12.0, <=12.0.0-de4dcafe0")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Let's change this to NewSemverConstraintIC("v0.12.0-12-de4dcafe0").

@sebdah
Copy link
Contributor Author

sebdah commented Jul 21, 2017

Thanks for the review, @carolynvs. I'll address your comments.

@sebdah
Copy link
Contributor Author

sebdah commented Jul 22, 2017

@carolynvs I have addressed your comment in commit a2c11c7 🙇

@carolynvs carolynvs merged commit 167adc2 into golang:master Jul 22, 2017
@carolynvs
Copy link
Collaborator

@sebdah Thank you for the fix! 🎉 💖

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Godeps.json with extra hash on comment string confuses dep init parsing semver
3 participants