v.io/jiri: remove support for old style profiles

MultiPart: 1/2
Change-Id: Ie8c92e4349f30bb99fdd40f2bdb71228cc8eaf37
diff --git a/.api b/.api
index f4648d7..d02b8f3 100644
--- a/.api
+++ b/.api
@@ -6,7 +6,6 @@
 pkg jiri, const ProjectMetaFile ideal-string
 pkg jiri, const RootEnv ideal-string
 pkg jiri, const RootMetaDir ideal-string
-pkg jiri, func DefaultProfilesDBPath() string
 pkg jiri, func ExpandEnv(*X, *envvar.Vars)
 pkg jiri, func FindRoot() string
 pkg jiri, func NewRelPath(...string) RelPath
diff --git a/cmd/jiri/doc.go b/cmd/jiri/doc.go
index e22ec42..2b58edd 100644
--- a/cmd/jiri/doc.go
+++ b/cmd/jiri/doc.go
@@ -297,9 +297,9 @@
    	Note: if no profiles are specified then the requested field will be displayed for all profiles.
  -merge-policies=+CCFLAGS,+CGO_CFLAGS,+CGO_CXXFLAGS,+CGO_LDFLAGS,+CXXFLAGS,GOARCH,GOOS,GOPATH:,^GOROOT*,+LDFLAGS,:PATH,VDLPATH:
    specify policies for merging environment variables
- -profiles=base,jiri
+ -profiles=v23:base,jiri
    a comma separated list of profiles to use
- -profiles-db=$JIRI_ROOT/.jiri_v23_profiles
+ -profiles-db=$JIRI_ROOT/.jiri_root/profile_db
    the path, relative to JIRI_ROOT, that contains the profiles database.
  -skip-profiles=false
    if set, no profiles will be used
@@ -332,9 +332,9 @@
    specify an environment variable in the form: <var>=[<val>],...
  -merge-policies=+CCFLAGS,+CGO_CFLAGS,+CGO_CXXFLAGS,+CGO_LDFLAGS,+CXXFLAGS,GOARCH,GOOS,GOPATH:,^GOROOT*,+LDFLAGS,:PATH,VDLPATH:
    specify policies for merging environment variables
- -profiles=base,jiri
+ -profiles=v23:base,jiri
    a comma separated list of profiles to use
- -profiles-db=$JIRI_ROOT/.jiri_v23_profiles
+ -profiles-db=$JIRI_ROOT/.jiri_root/profile_db
    the path, relative to JIRI_ROOT, that contains the profiles database.
  -skip-profiles=false
    if set, no profiles will be used
@@ -360,7 +360,7 @@
    specify an environment variable in the form: <var>=[<val>],...
  -force=false
    force install the profile even if it is already installed
- -profiles-db=$JIRI_ROOT/.jiri_v23_profiles
+ -profiles-db=$JIRI_ROOT/.jiri_root/profile_db
    the path, relative to JIRI_ROOT, that contains the profiles database.
  -profiles-dir=.jiri_root/profiles
    the directory, relative to JIRI_ROOT, that profiles are installed in
@@ -384,7 +384,7 @@
 The jiri profile uninstall flags are:
  -all-targets=false
    apply to all targets for the specified profile(s)
- -profiles-db=$JIRI_ROOT/.jiri_v23_profiles
+ -profiles-db=$JIRI_ROOT/.jiri_root/profile_db
    the path, relative to JIRI_ROOT, that contains the profiles database.
  -profiles-dir=.jiri_root/profiles
    the directory, relative to JIRI_ROOT, that profiles are installed in
@@ -406,7 +406,7 @@
 <profiles> is a list of profiles to update, if omitted all profiles are updated.
 
 The jiri profile update flags are:
- -profiles-db=$JIRI_ROOT/.jiri_v23_profiles
+ -profiles-db=$JIRI_ROOT/.jiri_root/profile_db
    the path, relative to JIRI_ROOT, that contains the profiles database.
  -profiles-dir=.jiri_root/profiles
    the directory, relative to JIRI_ROOT, that profiles are installed in
@@ -431,7 +431,7 @@
 The jiri profile cleanup flags are:
  -gc=false
    uninstall profile targets that are older than the current default
- -profiles-db=$JIRI_ROOT/.jiri_v23_profiles
+ -profiles-db=$JIRI_ROOT/.jiri_root/profile_db
    the path, relative to JIRI_ROOT, that contains the profiles database.
  -profiles-dir=.jiri_root/profiles
    the directory, relative to JIRI_ROOT, that profiles are installed in
diff --git a/cmd/jiri/profile.go b/cmd/jiri/profile.go
index a94ee0d..118aebf 100644
--- a/cmd/jiri/profile.go
+++ b/cmd/jiri/profile.go
@@ -17,6 +17,6 @@
 }
 
 func init() {
-	profilescmdline.RegisterReaderCommands(cmdProfile, jiri.DefaultProfilesDBPath())
-	profilescmdline.RegisterManagementCommands(cmdProfile, true, "", jiri.DefaultProfilesDBPath(), jiri.ProfilesRootDir)
+	profilescmdline.RegisterReaderCommands(cmdProfile, jiri.ProfilesDBDir)
+	profilescmdline.RegisterManagementCommands(cmdProfile, true, "", jiri.ProfilesDBDir, jiri.ProfilesRootDir)
 }
diff --git a/profiles/profilescmdline/reader_cmdline.go b/profiles/profilescmdline/reader_cmdline.go
index 0fa5180..ef71e0e 100644
--- a/profiles/profilescmdline/reader_cmdline.go
+++ b/profiles/profilescmdline/reader_cmdline.go
@@ -12,7 +12,6 @@
 	"bytes"
 	"flag"
 	"fmt"
-	"os"
 	"path/filepath"
 	"strings"
 	"text/template"
@@ -130,16 +129,10 @@
 
 // RegisterProfilesFlag registers the --profiles flag
 func RegisterProfilesFlag(flags *flag.FlagSet, profiles *string) {
-	// TODO(cnicolaou): delete this when the new profiles are in use.
-	root := jiri.FindRoot()
-	fi, err := os.Stat(filepath.Join(root, jiri.ProfilesDBDir))
-	defaultProfiles := "base,jiri"
-	if err == nil && fi.IsDir() {
-		// TODO(cnicolaou): we need a better way of setting the default profiles,
-		// ideally via the profiles db, or some other config. Provide a command
-		// line tool for setting the default profiles.
-		defaultProfiles = "v23:base,jiri"
-	}
+	// TODO(cnicolaou): we need a better way of setting the default profiles,
+	// ideally via the profiles db, or some other config. Provide a command
+	// line tool for setting the default profiles.
+	defaultProfiles := "v23:base,jiri"
 	flags.StringVar(profiles, "profiles", defaultProfiles, "a comma separated list of profiles to use")
 }
 
diff --git a/x.go b/x.go
index fc59598..2dda4b1 100644
--- a/x.go
+++ b/x.go
@@ -20,14 +20,13 @@
 )
 
 const (
-	RootEnv              = "JIRI_ROOT"
-	RootMetaDir          = ".jiri_root"
-	ProjectMetaDir       = ".jiri"
-	ProjectMetaFile      = "metadata.v2"
-	legacyProfilesDBFile = ".jiri_v23_profiles"
-	ProfilesDBDir        = RootMetaDir + string(filepath.Separator) + "profile_db"
-	ProfilesRootDir      = RootMetaDir + string(filepath.Separator) + "profiles"
-	JiriManifestFile     = ".jiri_manifest"
+	RootEnv          = "JIRI_ROOT"
+	RootMetaDir      = ".jiri_root"
+	ProjectMetaDir   = ".jiri"
+	ProjectMetaFile  = "metadata.v2"
+	ProfilesDBDir    = RootMetaDir + string(filepath.Separator) + "profile_db"
+	ProfilesRootDir  = RootMetaDir + string(filepath.Separator) + "profiles"
+	JiriManifestFile = ".jiri_manifest"
 
 	// PreservePathEnv is the name of the environment variable that, when set to a
 	// non-empty value, causes jiri tools to use the existing PATH variable,
@@ -115,19 +114,6 @@
 	return root
 }
 
-// DefaultProfilesDBPath returns the appropriate profiles database to use
-// based on whether profile-v23 has been run. It will be removed once
-// transition to profile-v23 is complete.
-// TODO(cnicolaou): delete this and use ProfilesDBDir in the client apps.
-func DefaultProfilesDBPath() string {
-	root := FindRoot()
-	fi, err := os.Stat(filepath.Join(root, ProfilesDBDir))
-	if err == nil && fi.IsDir() {
-		return ProfilesDBDir
-	}
-	return legacyProfilesDBFile
-}
-
 // Clone returns a clone of the environment.
 func (x *X) Clone(opts tool.ContextOpts) *X {
 	return &X{