v.io/jiri/profiles/profilescmdline: continue transition to subcommand based profiles.
- make sure we create a directory for subcommand based profiles
- tidyup output from profile available when there are no profiles
available.
Change-Id: I0226b72fcaed9aff658b08ba9bf4d9bc5a8f0a08
diff --git a/jiri/x.go b/jiri/x.go
index ef78566..09087b5 100644
--- a/jiri/x.go
+++ b/jiri/x.go
@@ -100,7 +100,7 @@
root := FindRoot()
fi, err := os.Stat(filepath.Join(root, ProfilesDBDir))
if err == nil && fi.IsDir() {
- return ProfilesRootDir
+ return ProfilesDBDir
}
return legacyProfilesDBFile
}
diff --git a/profiles/profilescmdline/manager_cmdline.go b/profiles/profilescmdline/manager_cmdline.go
index 344286d..1fa9aa7 100644
--- a/profiles/profilescmdline/manager_cmdline.go
+++ b/profiles/profilescmdline/manager_cmdline.go
@@ -376,11 +376,15 @@
return nil
}
}
- if !isdir && installer == "" {
+ if installer == "" {
// Old setup with no installers and writing to a file.
return db.Write(jirix, installer, path)
}
- return fmt.Errorf("Can't write a database file (%v) and specify an installer (%v)", path, installer)
+ // New setup, but the directory doesn't exist yet.
+ if err := os.MkdirAll(path, os.FileMode(0755)); err != nil {
+ return err
+ }
+ return db.Write(jirix, installer, path)
}
func updateImpl(jirix *jiri.X, cl *updateFlagValues, args []string) error {
@@ -486,7 +490,9 @@
return err
}
}
- fmt.Fprintln(jirix.Stdout(), out.String())
+ if s := strings.TrimSpace(out.String()); s != "" {
+ fmt.Fprintln(jirix.Stdout(), s)
+ }
}
mgrs := profilesmanager.Managers()
if len(mgrs) == 0 {
diff --git a/profiles/profilesmanager/util.go b/profiles/profilesmanager/util.go
index 3b8bcdf..0a0efef 100644
--- a/profiles/profilesmanager/util.go
+++ b/profiles/profilesmanager/util.go
@@ -32,7 +32,7 @@
}
return nil
}
- mgr := LookupManager(profile)
+ mgr := LookupManager(profiles.QualifiedProfileName(installer, profile))
if mgr == nil {
return fmt.Errorf("profile %v is not supported", profile)
}