Reland "packages.proto: Add NeedsChromeSource endpoint.""

This reverts commit 593d766e61c787a7b45b6614da2bed7922ce5581
(Relands 7e9f617ada9710f0f68a888023f7028c9913adfe).

BUG=chromium:1086714
TEST=generate.sh

Cq-Depend: chromium:2683218
Change-Id: I74b99f11a8c4028bab6e4fef304eed6ef8842a72
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/2683207
Reviewed-by: Sean McAllister <smcallis@google.com>
Commit-Queue: LaMont Jones <lamontjones@chromium.org>
diff --git a/go/chromite/api/packages.pb.go b/go/chromite/api/packages.pb.go
index 61b6ad7..ceecb53 100644
--- a/go/chromite/api/packages.pb.go
+++ b/go/chromite/api/packages.pb.go
@@ -1928,7 +1928,7 @@
 	0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74,
 	0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x72, 0x65, 0x76, 0x50, 0x61, 0x63, 0x6b, 0x61,
 	0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x52, 0x09, 0x72, 0x65, 0x73,
-	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x32, 0x96, 0x07, 0x0a, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x61,
+	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x73, 0x32, 0xfc, 0x07, 0x0a, 0x0e, 0x50, 0x61, 0x63, 0x6b, 0x61,
 	0x67, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x55, 0x0a, 0x0c, 0x42, 0x75, 0x69,
 	0x6c, 0x64, 0x73, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x12, 0x21, 0x2e, 0x63, 0x68, 0x72, 0x6f,
 	0x6d, 0x69, 0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x73, 0x43,
@@ -1971,26 +1971,32 @@
 	0x61, 0x70, 0x69, 0x2e, 0x48, 0x61, 0x73, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x52,
 	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74,
 	0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x48, 0x61, 0x73, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c,
-	0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x05, 0x55, 0x70, 0x72,
-	0x65, 0x76, 0x12, 0x22, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2e, 0x61, 0x70,
-	0x69, 0x2e, 0x55, 0x70, 0x72, 0x65, 0x76, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52,
-	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74,
-	0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x72, 0x65, 0x76, 0x50, 0x61, 0x63, 0x6b, 0x61,
-	0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xc2, 0xed, 0x1a,
-	0x02, 0x10, 0x02, 0x12, 0x78, 0x0a, 0x15, 0x55, 0x70, 0x72, 0x65, 0x76, 0x56, 0x65, 0x72, 0x73,
-	0x69, 0x6f, 0x6e, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x2a, 0x2e, 0x63,
+	0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x64, 0x0a, 0x11, 0x4e, 0x65, 0x65,
+	0x64, 0x73, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x26,
+	0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4e, 0x65,
+	0x65, 0x64, 0x73, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74,
+	0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x4e, 0x65, 0x65, 0x64, 0x73, 0x43, 0x68, 0x72, 0x6f, 0x6d,
+	0x65, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
+	0x58, 0x0a, 0x05, 0x55, 0x70, 0x72, 0x65, 0x76, 0x12, 0x22, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d,
+	0x69, 0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x72, 0x65, 0x76, 0x50, 0x61, 0x63,
+	0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x63,
 	0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x72, 0x65,
-	0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67,
-	0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d,
-	0x69, 0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70, 0x72, 0x65, 0x76, 0x56, 0x65, 0x72,
-	0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73,
-	0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xc2, 0xed, 0x1a, 0x02, 0x10, 0x02, 0x1a, 0x10, 0xc2,
-	0xed, 0x1a, 0x0c, 0x0a, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x10, 0x01, 0x42,
-	0x38, 0x5a, 0x36, 0x67, 0x6f, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x2e, 0x6f,
-	0x72, 0x67, 0x2f, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75, 0x6d, 0x6f, 0x73, 0x2f, 0x69, 0x6e,
-	0x66, 0x72, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x68, 0x72,
-	0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
-	0x33,
+	0x76, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
+	0x65, 0x22, 0x06, 0xc2, 0xed, 0x1a, 0x02, 0x10, 0x02, 0x12, 0x78, 0x0a, 0x15, 0x55, 0x70, 0x72,
+	0x65, 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x61,
+	0x67, 0x65, 0x12, 0x2a, 0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2e, 0x61, 0x70,
+	0x69, 0x2e, 0x55, 0x70, 0x72, 0x65, 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64,
+	0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b,
+	0x2e, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x55, 0x70,
+	0x72, 0x65, 0x76, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x65, 0x64, 0x50, 0x61, 0x63, 0x6b,
+	0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xc2, 0xed, 0x1a,
+	0x02, 0x10, 0x02, 0x1a, 0x10, 0xc2, 0xed, 0x1a, 0x0c, 0x0a, 0x08, 0x70, 0x61, 0x63, 0x6b, 0x61,
+	0x67, 0x65, 0x73, 0x10, 0x01, 0x42, 0x38, 0x5a, 0x36, 0x67, 0x6f, 0x2e, 0x63, 0x68, 0x72, 0x6f,
+	0x6d, 0x69, 0x75, 0x6d, 0x2e, 0x6f, 0x72, 0x67, 0x2f, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x75,
+	0x6d, 0x6f, 0x73, 0x2f, 0x69, 0x6e, 0x66, 0x72, 0x61, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f,
+	0x67, 0x6f, 0x2f, 0x63, 0x68, 0x72, 0x6f, 0x6d, 0x69, 0x74, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x62,
+	0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -2079,19 +2085,21 @@
 	9,  // 36: chromite.api.PackageService.GetBuilderMetadata:input_type -> chromite.api.GetBuilderMetadataRequest
 	11, // 37: chromite.api.PackageService.HasChromePrebuilt:input_type -> chromite.api.HasChromePrebuiltRequest
 	15, // 38: chromite.api.PackageService.HasPrebuilt:input_type -> chromite.api.HasPrebuiltRequest
-	17, // 39: chromite.api.PackageService.Uprev:input_type -> chromite.api.UprevPackagesRequest
-	18, // 40: chromite.api.PackageService.UprevVersionedPackage:input_type -> chromite.api.UprevVersionedPackageRequest
-	2,  // 41: chromite.api.PackageService.BuildsChrome:output_type -> chromite.api.BuildsChromeResponse
-	4,  // 42: chromite.api.PackageService.GetBestVisible:output_type -> chromite.api.GetBestVisibleResponse
-	6,  // 43: chromite.api.PackageService.GetChromeVersion:output_type -> chromite.api.GetChromeVersionResponse
-	8,  // 44: chromite.api.PackageService.GetTargetVersions:output_type -> chromite.api.GetTargetVersionsResponse
-	10, // 45: chromite.api.PackageService.GetBuilderMetadata:output_type -> chromite.api.GetBuilderMetadataResponse
-	12, // 46: chromite.api.PackageService.HasChromePrebuilt:output_type -> chromite.api.HasChromePrebuiltResponse
-	16, // 47: chromite.api.PackageService.HasPrebuilt:output_type -> chromite.api.HasPrebuiltResponse
-	19, // 48: chromite.api.PackageService.Uprev:output_type -> chromite.api.UprevPackagesResponse
-	20, // 49: chromite.api.PackageService.UprevVersionedPackage:output_type -> chromite.api.UprevVersionedPackageResponse
-	41, // [41:50] is the sub-list for method output_type
-	32, // [32:41] is the sub-list for method input_type
+	13, // 39: chromite.api.PackageService.NeedsChromeSource:input_type -> chromite.api.NeedsChromeSourceRequest
+	17, // 40: chromite.api.PackageService.Uprev:input_type -> chromite.api.UprevPackagesRequest
+	18, // 41: chromite.api.PackageService.UprevVersionedPackage:input_type -> chromite.api.UprevVersionedPackageRequest
+	2,  // 42: chromite.api.PackageService.BuildsChrome:output_type -> chromite.api.BuildsChromeResponse
+	4,  // 43: chromite.api.PackageService.GetBestVisible:output_type -> chromite.api.GetBestVisibleResponse
+	6,  // 44: chromite.api.PackageService.GetChromeVersion:output_type -> chromite.api.GetChromeVersionResponse
+	8,  // 45: chromite.api.PackageService.GetTargetVersions:output_type -> chromite.api.GetTargetVersionsResponse
+	10, // 46: chromite.api.PackageService.GetBuilderMetadata:output_type -> chromite.api.GetBuilderMetadataResponse
+	12, // 47: chromite.api.PackageService.HasChromePrebuilt:output_type -> chromite.api.HasChromePrebuiltResponse
+	16, // 48: chromite.api.PackageService.HasPrebuilt:output_type -> chromite.api.HasPrebuiltResponse
+	14, // 49: chromite.api.PackageService.NeedsChromeSource:output_type -> chromite.api.NeedsChromeSourceResponse
+	19, // 50: chromite.api.PackageService.Uprev:output_type -> chromite.api.UprevPackagesResponse
+	20, // 51: chromite.api.PackageService.UprevVersionedPackage:output_type -> chromite.api.UprevVersionedPackageResponse
+	42, // [42:52] is the sub-list for method output_type
+	32, // [32:42] is the sub-list for method input_type
 	32, // [32:32] is the sub-list for extension type_name
 	32, // [32:32] is the sub-list for extension extendee
 	0,  // [0:32] is the sub-list for field type_name
diff --git a/go/chromite/api/packages_grpc.pb.go b/go/chromite/api/packages_grpc.pb.go
index 79d8d02..7687f32 100644
--- a/go/chromite/api/packages_grpc.pb.go
+++ b/go/chromite/api/packages_grpc.pb.go
@@ -43,6 +43,9 @@
 	// Check if there is an available prebuilt for the most recent version of the
 	// package.  Added in R83.
 	HasPrebuilt(ctx context.Context, in *HasPrebuiltRequest, opts ...grpc.CallOption) (*HasPrebuiltResponse, error)
+	// Check whether the Chrome source tree is needed.  Does not compile nor
+	// install any packages.
+	NeedsChromeSource(ctx context.Context, in *NeedsChromeSourceRequest, opts ...grpc.CallOption) (*NeedsChromeSourceResponse, error)
 	// The generic uprev process -- performs uprevs for all packages in the
 	// public and/or private overlays for the build target(s) specified.
 	// This handles all cros_workon packages except those that have a separate
@@ -127,6 +130,15 @@
 	return out, nil
 }
 
+func (c *packageServiceClient) NeedsChromeSource(ctx context.Context, in *NeedsChromeSourceRequest, opts ...grpc.CallOption) (*NeedsChromeSourceResponse, error) {
+	out := new(NeedsChromeSourceResponse)
+	err := c.cc.Invoke(ctx, "/chromite.api.PackageService/NeedsChromeSource", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 func (c *packageServiceClient) Uprev(ctx context.Context, in *UprevPackagesRequest, opts ...grpc.CallOption) (*UprevPackagesResponse, error) {
 	out := new(UprevPackagesResponse)
 	err := c.cc.Invoke(ctx, "/chromite.api.PackageService/Uprev", in, out, opts...)
@@ -174,6 +186,9 @@
 	// Check if there is an available prebuilt for the most recent version of the
 	// package.  Added in R83.
 	HasPrebuilt(context.Context, *HasPrebuiltRequest) (*HasPrebuiltResponse, error)
+	// Check whether the Chrome source tree is needed.  Does not compile nor
+	// install any packages.
+	NeedsChromeSource(context.Context, *NeedsChromeSourceRequest) (*NeedsChromeSourceResponse, error)
 	// The generic uprev process -- performs uprevs for all packages in the
 	// public and/or private overlays for the build target(s) specified.
 	// This handles all cros_workon packages except those that have a separate
@@ -213,6 +228,9 @@
 func (UnimplementedPackageServiceServer) HasPrebuilt(context.Context, *HasPrebuiltRequest) (*HasPrebuiltResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method HasPrebuilt not implemented")
 }
+func (UnimplementedPackageServiceServer) NeedsChromeSource(context.Context, *NeedsChromeSourceRequest) (*NeedsChromeSourceResponse, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method NeedsChromeSource not implemented")
+}
 func (UnimplementedPackageServiceServer) Uprev(context.Context, *UprevPackagesRequest) (*UprevPackagesResponse, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method Uprev not implemented")
 }
@@ -358,6 +376,24 @@
 	return interceptor(ctx, in, info, handler)
 }
 
+func _PackageService_NeedsChromeSource_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(NeedsChromeSourceRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(PackageServiceServer).NeedsChromeSource(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/chromite.api.PackageService/NeedsChromeSource",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(PackageServiceServer).NeedsChromeSource(ctx, req.(*NeedsChromeSourceRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 func _PackageService_Uprev_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
 	in := new(UprevPackagesRequest)
 	if err := dec(in); err != nil {
@@ -430,6 +466,10 @@
 			Handler:    _PackageService_HasPrebuilt_Handler,
 		},
 		{
+			MethodName: "NeedsChromeSource",
+			Handler:    _PackageService_NeedsChromeSource_Handler,
+		},
+		{
 			MethodName: "Uprev",
 			Handler:    _PackageService_Uprev_Handler,
 		},
diff --git a/src/chromite/api/packages.proto b/src/chromite/api/packages.proto
index 5580579..9a2ed27 100644
--- a/src/chromite/api/packages.proto
+++ b/src/chromite/api/packages.proto
@@ -295,13 +295,6 @@
   // Check if the build target has chrome in its depgraph.  Added in R79.
   rpc BuildsChrome(BuildsChromeRequest) returns (BuildsChromeResponse);
 
-  // Check whether the Chrome source tree is needed.  Does not compile nor
-  // install any packages.
-  // TODO(crbug/1086714): Uncomment this when the endpoint actually exists.
-  // See https://ci.chromium.org/b/8875124107016783184
-  //rpc NeedsChromeSource(NeedsChromeSourceRequest)
-  //  returns (NeedsChromeSourceResponse);
-
   // Find the best (highest) available version of the requested package.
   // This must be run after the chroot is set up (for chroot package lookup) or
   // after the sysroot is created (for build target package lookup).
@@ -335,6 +328,11 @@
   // package.  Added in R83.
   rpc HasPrebuilt(HasPrebuiltRequest) returns (HasPrebuiltResponse);
 
+  // Check whether the Chrome source tree is needed.  Does not compile nor
+  // install any packages.
+  rpc NeedsChromeSource(NeedsChromeSourceRequest)
+    returns (NeedsChromeSourceResponse);
+
   // The generic uprev process -- performs uprevs for all packages in the
   // public and/or private overlays for the build target(s) specified.
   // This handles all cros_workon packages except those that have a separate