Merge "v.io/jiri/profiles: prevent use of target Tags."
diff --git a/profiles/env_test.go b/profiles/env_test.go
index 85154bf..535bfdd 100644
--- a/profiles/env_test.go
+++ b/profiles/env_test.go
@@ -46,9 +46,9 @@
 	profiles.InstallProfile("a", "root")
 	profiles.InstallProfile("b", "root")
 	t1, t2 := &profiles.Target{}, &profiles.Target{}
-	t1.Set("t1=cpu1-os1@1")
+	t1.Set("cpu1-os1@1")
 	t1.Env.Set("A=B C=D,B=C Z=Z")
-	t2.Set("t1=cpu1-os1@1")
+	t2.Set("cpu1-os1@1")
 	t2.Env.Set("A=Z,B=Z,Z=Z1")
 	profiles.AddProfileTarget("a", *t1)
 	profiles.AddProfileTarget("b", *t2)
@@ -66,7 +66,7 @@
 		t.Fatal(err)
 	}
 	ch.Vars = envvar.VarsFromSlice([]string{})
-	t1Target, _ := profiles.NewTarget("t1")
+	t1Target, _ := profiles.NewTarget("cpu1-os1@1")
 	ch.MergeEnvFromProfiles(map[string]profiles.MergePolicy{
 		"A": profiles.AppendFlag,
 		"B": profiles.UseLast,
diff --git a/profiles/manager_test.go b/profiles/manager_test.go
index dd78b8e..400fe7e 100644
--- a/profiles/manager_test.go
+++ b/profiles/manager_test.go
@@ -103,7 +103,7 @@
 		profiles.Register(myProfile, newProfile(myProfile))
 		flags := flag.NewFlagSet("example", flag.ContinueOnError)
 		profiles.RegisterTargetAndEnvFlags(flags, &target)
-		flags.Parse([]string{"--target=myTarget=arm-linux@1", "--env=A=B,C=D", "--env=E=F"})
+		flags.Parse([]string{"--target=arm-linux@1", "--env=A=B,C=D", "--env=E=F"})
 	}
 	init()
 
@@ -148,10 +148,10 @@
 
 	// Output:
 	// Profile: myNewProfile: installed
-	// [myTarget=arm-linux@1]
+	// [=arm-linux@1]
 	//
 	// Profile: myNewProfile: installed
-	// [myTarget=arm-linux@1]
+	// [=arm-linux@1]
 	//
 	// Profile: myNewProfile: uninstalled
 	//
diff --git a/profiles/manifest.go b/profiles/manifest.go
index b1dc2ff..91f798c 100644
--- a/profiles/manifest.go
+++ b/profiles/manifest.go
@@ -290,6 +290,10 @@
 			if len(target.version) == 0 {
 				return fmt.Errorf("missing version for profile %s target: %s", name, target)
 			}
+			// TODO(cnicolaou): enable this in a subsequent CL.
+			//if len(target.tag) > 0 {
+			//	return fmt.Errorf("tags are no longer supported - the following profile and target has one: %s %s", name, target)
+			//}
 			schema.Profiles[i].Targets = append(schema.Profiles[i].Targets,
 				&targetSchema{
 					Tag:             target.tag,
diff --git a/profiles/manifest_test.go b/profiles/manifest_test.go
index c6eae49..8a8d2dd 100644
--- a/profiles/manifest_test.go
+++ b/profiles/manifest_test.go
@@ -20,8 +20,8 @@
 )
 
 func addProfileAndTargets(t *testing.T, name string) {
-	t1, _ := profiles.NewTargetWithEnv("t1=cpu1-os1@1", "A=B,C=D")
-	t2, _ := profiles.NewTargetWithEnv("t2=cpu2-os2@bar", "A=B,C=D")
+	t1, _ := profiles.NewTargetWithEnv("cpu1-os1@1", "A=B,C=D")
+	t2, _ := profiles.NewTargetWithEnv("cpu2-os2@bar", "A=B,C=D")
 	if err := profiles.AddProfileTarget(name, t1); err != nil {
 		t.Fatal(err)
 	}
@@ -50,17 +50,6 @@
 	return strings.TrimSpace(result.String())
 }
 
-func TestDuplicateTag(t *testing.T) {
-	profiles.Clear()
-	addProfileAndTargets(t, "b")
-	t1 := &profiles.Target{}
-	t1.Set("t2")
-	err := profiles.AddProfileTarget("b", *t1)
-	if got, want := err.Error(), "tag \"t2\" is already used"; !strings.Contains(got, want) {
-		t.Fatalf("got %v doesn't contain %v", got, want)
-	}
-}
-
 func TestWrite(t *testing.T) {
 	profiles.Clear()
 	filename := tmpFile()
@@ -68,7 +57,7 @@
 	ctx := tool.NewDefaultContext()
 
 	// test for no version being set.
-	t1, _ := profiles.NewTargetWithEnv("t1=cpu1-os1", "A=B,C=D")
+	t1, _ := profiles.NewTargetWithEnv("cpu1-os1", "A=B,C=D")
 	if err := profiles.AddProfileTarget("b", t1); err != nil {
 		t.Fatal(err)
 	}
@@ -114,9 +103,6 @@
 		t.Errorf("got %v, want %v", got, want)
 	}
 	p := profiles.LookupProfile("a")
-	if got, want := p.Targets()[0].Tag(), "t1"; got != want {
-		t.Errorf("got %v, want %v", got, want)
-	}
 	if got, want := p.Targets()[0].OS(), "os1"; got != want {
 		t.Errorf("got %v, want %v", got, want)
 	}
@@ -165,7 +151,7 @@
 	defer os.RemoveAll(filepath.Dir(filename))
 
 	var t1 profiles.Target
-	t1.Set("tag=cpu-os@1")
+	t1.Set("cpu-os@1")
 	profiles.AddProfileTarget("__first", t1)
 
 	if err := profiles.Write(ctx, filename); err != nil {
diff --git a/profiles/testdata/m1.xml b/profiles/testdata/m1.xml
index f86975a..d54ea6f 100644
--- a/profiles/testdata/m1.xml
+++ b/profiles/testdata/m1.xml
@@ -1,13 +1,13 @@
 <profiles version="3">
   <profile name="a" root="">
-    <target tag="t1" arch="cpu1" os="os1" installation-directory="" version="1">
+    <target tag="" arch="cpu1" os="os1" installation-directory="" version="1">
       <envvars></envvars>
       <command-line>
         <var>A=B</var>
         <var>C=D</var>
       </command-line>
     </target>
-    <target tag="t2" arch="cpu2" os="os2" installation-directory="bar" version="bar">
+    <target tag="" arch="cpu2" os="os2" installation-directory="bar" version="bar">
       <envvars></envvars>
       <command-line>
         <var>A=B</var>
@@ -16,14 +16,14 @@
     </target>
   </profile>
   <profile name="b" root="">
-    <target tag="t1" arch="cpu1" os="os1" installation-directory="" version="1">
+    <target tag="" arch="cpu1" os="os1" installation-directory="" version="1">
       <envvars></envvars>
       <command-line>
         <var>A=B</var>
         <var>C=D</var>
       </command-line>
     </target>
-    <target tag="t2" arch="cpu2" os="os2" installation-directory="bar" version="bar">
+    <target tag="" arch="cpu2" os="os2" installation-directory="bar" version="bar">
       <envvars></envvars>
       <command-line>
         <var>A=B</var>