[build_init] Use a single spec_remote flag

After updating recipes this is easier than passing both host and
project seprately

Bug: IN-1102 #comment
Change-Id: Ib81356cbd5094b906ae94d0010fea32af49297d4
diff --git a/cmd/build_init/main.go b/cmd/build_init/main.go
index 0421bee..ff85122 100644
--- a/cmd/build_init/main.go
+++ b/cmd/build_init/main.go
@@ -38,11 +38,8 @@
 
 // Command line flags.
 var (
-	// The host where the spec repository lives.
-	specRepoHost string
-
-	// The name of the spec repository.
-	specRepo string
+	// The URL of the spec repository.
+	specRemote string
 
 	// The directory containing specs in the spec repository.
 	specDir string
@@ -51,16 +48,15 @@
 // Variables derived from user input.
 var (
 	// The URL to the spec repository.
-	specRepoURL url.URL
+	specRepoURL *url.URL
 
 	// The build.proto object read from stdin.
-	build buildbucketpb.Build
+	build *buildbucketpb.Build
 )
 
 func init() {
 	// Required
-	flag.StringVar(&specRepoHost, "spec_repo_host", "", "The URL of the spec repository")
-	flag.StringVar(&specRepo, "spec_project", "", "The name of the spec repository")
+	flag.StringVar(&specRemote, "spec_remote", "", "The URL of the spec repository")
 
 	// Optional
 	flag.StringVar(&specDir, "spec_dir", defaultSpecDir, "The directory containing specs")
@@ -76,29 +72,25 @@
 	}
 }
 
-func validateInputs() error {
-	if specRepoHost == "" {
-		return errors.New("missing -spec_repo_host")
-	}
-	if specRepo == "" {
-		return errors.New("missing -spec_project")
-	}
-	specRepoURL = url.URL{
-		Scheme: "https",
-		Host:   specRepoHost,
-		Path:   "/" + specRepo,
+func validateInputs() (err error) {
+	if specRemote == "" {
+		return errors.New("missing -spec_remote")
 	}
 
-	buildProto, err := loadBuildProto(os.Stdin)
+	specRepoURL, err = url.Parse(specRemote)
+	if err != nil {
+		return fmt.Errorf("invalid URL for -spec_remote: %v", err)
+	}
+
+	build, err = loadBuildProto(os.Stdin)
 	if err != nil {
 		return fmt.Errorf("failed to read build.proto: %v", err)
 	}
-	build = *buildProto
-	return nil
+	return err
 }
 
 func execute(ctx context.Context) error {
-	if err := checkout.Checkout(*build.Input, specRepoURL); err != nil {
+	if err := checkout.Checkout(*build.Input, *specRepoURL); err != nil {
 		return err
 	}
 	specPath := fmt.Sprintf("%s/%s/%s", specDir, build.Builder.Bucket, build.Builder.Builder)