Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix protobuf regeneration script. #5291

Merged
merged 7 commits into from
Apr 24, 2020
Merged

Fix protobuf regeneration script. #5291

merged 7 commits into from
Apr 24, 2020

Conversation

danielmai
Copy link
Contributor

@danielmai danielmai commented Apr 24, 2020

In master, the make regenerate command that should create the generated protobuf code doesn't work:

  1. make regenerate fails to run, showing the following error messages:

    make regenerate error log
    $ make regenerate
    Checking for semantic version 3.6.1 or newer
    OK
    Upgrading proto libraries before regenerating.
    google/protobuf/descriptor.proto: File not found.
    github.com/gogo/protobuf/gogoproto/gogo.proto:32:1: Import "google/protobuf/descriptor.proto" was not found or had errors.
    github.com/gogo/protobuf/gogoproto/gogo.proto:38:8: "google.protobuf.EnumOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.EnumOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.EnumOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.EnumOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.EnumOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto:46:8: "google.protobuf.EnumValueOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto:50:8: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FileOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto:92:8: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.MessageOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto:129:8: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/.gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    github.com/gogo/protobuf/gogoproto/gogo.proto: "google.protobuf.FieldOptions" is not defined.
    pb.proto:29:1: Import "github.com/gogo/protobuf/gogoproto/gogo.proto" was not found or had errors.
    make: *** [regenerate] Error 1
    
  2. The protobuf dependencies are updated in the latest version, which is not intended.

  3. It was referencing protobuf definitions from GOPATH. So, if a package was not updated to the right version (e.g., updating github.com/dgraph-io/badger to the latest master), then there could be errors like these:

    pb.proto:285:18: "badgerpb2.KV" is not defined.
    pb.proto:297:11: "badgerpb2.KV" is not defined.
    pb.proto:545:5: "badgerpb2.KVList" is not defined.
    pb.proto:537:60: "badgerpb2.KVList" is not defined.
    pb.proto:28:1: warning: Import github.com/dgraph-io/badger/pb/pb.proto is unused.
    

Changes

  • Include proto path /usr/local/include in protoc command to fix (1).
    • Update depcheck.sh to check that this directory exists. Error out with installation instructions otherwise if it's missing.
  • Install protobuf libraries from the versions in go.mod, and use go install instead of go get so the protobuf versions aren't updated automatically to fix (2).
  • Copy to temporary directory for proper import paths from go mod versions to remove any dependencies on $GOPATH to fix (3).
    • protos from proto library
    • proto from badger
    • proto from dgo
  • Regenerate protos

This change is Reviewable

Need to explicitly include --proto_path /usr/local/include in order to
pick up the standard protobuf files.
@danielmai danielmai requested review from manishrjain and a team as code owners April 24, 2020 00:50
Copy link
Contributor

@parasssh parasssh left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @danielmai and @manishrjain)

a discussion (no related file):
:lgtm: minor comment below.



protos/Makefile, line 46 at r1 (raw file):

	@protoc \
                --proto_path=/usr/local/include \
		--proto_path=${PROTO_PATH} \

Formatting looks odd.

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

It fixes it on my machine but it changes the go.mod and go.sum files.

:lgtm: if that's expected or once it's fixed.

Reviewable status: 0 of 1 files reviewed, 2 unresolved discussions (waiting on @danielmai and @manishrjain)

Copy link
Contributor

@martinmr martinmr left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @danielmai and @manishrjain)

Copy link
Contributor

@parasssh parasssh left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this.

Copy link
Contributor Author

@danielmai danielmai left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 3 files reviewed, 2 unresolved discussions (waiting on @manishrjain, @martinmr, and @parasssh)

a discussion (no related file):

Previously, parasssh wrote…

:lgtm: minor comment below.

Done.



protos/Makefile, line 46 at r1 (raw file):

Previously, parasssh wrote…

Formatting looks odd.

Done.

@danielmai danielmai merged commit ef04272 into master Apr 24, 2020
@danielmai danielmai deleted the danielmai/proto branch April 24, 2020 18:29
danielmai added a commit that referenced this pull request Apr 24, 2020
release/v20.03-specific change: use dgo/v2 instead of dgo/v200.

This fixes the make regenerate command that should create the generated
protobuf code.

1. make regenerate fails to run (error log attached in PR)
2. The protobuf dependencies are unintentionally updated to the latest
   version.
3. It was referencing protobuf definitions from GOPATH. So, if a package
   was not updated to the right version (e.g., updating
   github.com/dgraph-io/badger to the latest master), then there could
   be errors like the following when referencing the wrong version of a
   proto:

      pb.proto:285:18: "badgerpb2.KV" is not defined.
      pb.proto:297:11: "badgerpb2.KV" is not defined.
      pb.proto:545:5: "badgerpb2.KVList" is not defined.
      pb.proto:537:60: "badgerpb2.KVList" is not defined.
      pb.proto:28:1: warning: Import github.com/dgraph-io/badger/pb/pb.proto is unused.

Changes

* Include proto path /usr/local/include in protoc command to fix (1).
* Update depcheck.sh to check that this directory exists. Error out with
  installation instructions otherwise if it's missing.
* Install protobuf libraries from the versions in go.mod, and use go install
  instead of go get so the protobuf versions aren't updated automatically to fix
  (2).
* Copy to temporary directory for proper import paths from go mod versions to
  remove any dependencies on $GOPATH to fix (3).
  * protos from proto library
  * proto from badger
  * proto from dgo
* Regenerate protos
danielmai added a commit that referenced this pull request Apr 24, 2020
release/v20.03-specific change: use dgo/v2 instead of dgo/v200.

This fixes the make regenerate command that should create the generated
protobuf code.

1. make regenerate fails to run (error log attached in PR)
2. The protobuf dependencies are unintentionally updated to the latest
   version.
3. It was referencing protobuf definitions from GOPATH. So, if a package
   was not updated to the right version (e.g., updating
   github.com/dgraph-io/badger to the latest master), then there could
   be errors like the following when referencing the wrong version of a
   proto:

      pb.proto:285:18: "badgerpb2.KV" is not defined.
      pb.proto:297:11: "badgerpb2.KV" is not defined.
      pb.proto:545:5: "badgerpb2.KVList" is not defined.
      pb.proto:537:60: "badgerpb2.KVList" is not defined.
      pb.proto:28:1: warning: Import github.com/dgraph-io/badger/pb/pb.proto is unused.

Changes

* Include proto path /usr/local/include in protoc command to fix (1).
* Update depcheck.sh to check that this directory exists. Error out with
  installation instructions otherwise if it's missing.
* Install protobuf libraries from the versions in go.mod, and use go install
  instead of go get so the protobuf versions aren't updated automatically to fix
  (2).
* Copy to temporary directory for proper import paths from go mod versions to
  remove any dependencies on $GOPATH to fix (3).
  * protos from proto library
  * proto from badger
  * proto from dgo
* Regenerate protos
danielmai added a commit that referenced this pull request Apr 24, 2020
release/v1.2-specific change: use dgo/v2.

This fixes the make regenerate command that should create the generated
protobuf code.

1. make regenerate fails to run (error log attached in PR)
2. The protobuf dependencies are unintentionally updated to the latest
   version.
3. It was referencing protobuf definitions from GOPATH. So, if a package
   was not updated to the right version (e.g., updating
   github.com/dgraph-io/badger to the latest master), then there could
   be errors like the following when referencing the wrong version of a
   proto:

      pb.proto:285:18: "badgerpb2.KV" is not defined.
      pb.proto:297:11: "badgerpb2.KV" is not defined.
      pb.proto:545:5: "badgerpb2.KVList" is not defined.
      pb.proto:537:60: "badgerpb2.KVList" is not defined.
      pb.proto:28:1: warning: Import github.com/dgraph-io/badger/pb/pb.proto is unused.

Changes

* Include proto path /usr/local/include in protoc command to fix (1).
* Update depcheck.sh to check that this directory exists. Error out with
  installation instructions otherwise if it's missing.
* Install protobuf libraries from the versions in go.mod, and use go install
  instead of go get so the protobuf versions aren't updated automatically to fix
  (2).
* Copy to temporary directory for proper import paths from go mod versions to
  remove any dependencies on $GOPATH to fix (3).
  * protos from proto library
  * proto from badger
  * proto from dgo
* Regenerate protos
danielmai added a commit that referenced this pull request Apr 24, 2020
release/v1.2-specific change: use dgo/v2.

This fixes the make regenerate command that should create the generated
protobuf code.

1. make regenerate fails to run (error log attached in PR)
2. The protobuf dependencies are unintentionally updated to the latest
   version.
3. It was referencing protobuf definitions from GOPATH. So, if a package
   was not updated to the right version (e.g., updating
   github.com/dgraph-io/badger to the latest master), then there could
   be errors like the following when referencing the wrong version of a
   proto:

      pb.proto:285:18: "badgerpb2.KV" is not defined.
      pb.proto:297:11: "badgerpb2.KV" is not defined.
      pb.proto:545:5: "badgerpb2.KVList" is not defined.
      pb.proto:537:60: "badgerpb2.KVList" is not defined.
      pb.proto:28:1: warning: Import github.com/dgraph-io/badger/pb/pb.proto is unused.

Changes

* Include proto path /usr/local/include in protoc command to fix (1).
* Update depcheck.sh to check that this directory exists. Error out with
  installation instructions otherwise if it's missing.
* Install protobuf libraries from the versions in go.mod, and use go install
  instead of go get so the protobuf versions aren't updated automatically to fix
  (2).
* Copy to temporary directory for proper import paths from go mod versions to
  remove any dependencies on $GOPATH to fix (3).
  * protos from proto library
  * proto from badger
  * proto from dgo
* Regenerate protos
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 18, 2020
This fixes the make regenerate command that should create the generated
protobuf code.

1. make regenerate fails to run (error log attached in PR)
2. The protobuf dependencies are unintentionally updated to the latest
   version.
3. It was referencing protobuf definitions from GOPATH. So, if a package
   was not updated to the right version (e.g., updating
   github.com/dgraph-io/badger to the latest master), then there could
   be errors like the following when referencing the wrong version of a
   proto:

      pb.proto:285:18: "badgerpb2.KV" is not defined.
      pb.proto:297:11: "badgerpb2.KV" is not defined.
      pb.proto:545:5: "badgerpb2.KVList" is not defined.
      pb.proto:537:60: "badgerpb2.KVList" is not defined.
      pb.proto:28:1: warning: Import github.com/dgraph-io/badger/pb/pb.proto is unused.

Changes

* Include proto path /usr/local/include in protoc command to fix (1).
* Update depcheck.sh to check that this directory exists. Error out with
  installation instructions otherwise if it's missing.
* Install protobuf libraries from the versions in go.mod, and use go install
  instead of go get so the protobuf versions aren't updated automatically to fix
  (2).
* Copy to temporary directory for proper import paths from go mod versions to
  remove any dependencies on $GOPATH to fix (3).
  * protos from proto library
  * proto from badger
  * proto from dgo
* Regenerate protos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants