veyron/tools/*: Remove dependence on rt.R()/rt.Init()

Change-Id: I2dd04028a2eaefdf99efa1177926dada7d54f91c
diff --git a/tools/profile/impl.go b/tools/profile/impl.go
index 459b2ab..8869787 100644
--- a/tools/profile/impl.go
+++ b/tools/profile/impl.go
@@ -7,7 +7,6 @@
 	"veyron.io/lib/cmdline"
 	"veyron.io/veyron/veyron/services/mgmt/profile"
 	"veyron.io/veyron/veyron/services/mgmt/repository"
-	"veyron.io/veyron/veyron2/rt"
 	"veyron.io/veyron/veyron2/services/mgmt/build"
 )
 
@@ -26,7 +25,7 @@
 	}
 	name := args[0]
 	p := repository.ProfileClient(name)
-	ctx, cancel := rt.R().NewContext().WithTimeout(time.Minute)
+	ctx, cancel := runtime.NewContext().WithTimeout(time.Minute)
 	defer cancel()
 	label, err := p.Label(ctx)
 	if err != nil {
@@ -51,7 +50,7 @@
 	}
 	name := args[0]
 	p := repository.ProfileClient(name)
-	ctx, cancel := rt.R().NewContext().WithTimeout(time.Minute)
+	ctx, cancel := runtime.NewContext().WithTimeout(time.Minute)
 	defer cancel()
 	desc, err := p.Description(ctx)
 	if err != nil {
@@ -76,7 +75,7 @@
 	}
 	name := args[0]
 	p := repository.ProfileClient(name)
-	ctx, cancel := rt.R().NewContext().WithTimeout(time.Minute)
+	ctx, cancel := runtime.NewContext().WithTimeout(time.Minute)
 	defer cancel()
 	spec, err := p.Specification(ctx)
 	if err != nil {
@@ -111,7 +110,7 @@
 		Label:       "example",
 		OS:          build.Linux,
 	}
-	ctx, cancel := rt.R().NewContext().WithTimeout(time.Minute)
+	ctx, cancel := runtime.NewContext().WithTimeout(time.Minute)
 	defer cancel()
 	if err := p.Put(ctx, spec); err != nil {
 		return err
@@ -135,7 +134,7 @@
 	}
 	name := args[0]
 	p := repository.ProfileClient(name)
-	ctx, cancel := rt.R().NewContext().WithTimeout(time.Minute)
+	ctx, cancel := runtime.NewContext().WithTimeout(time.Minute)
 	defer cancel()
 	if err := p.Remove(ctx); err != nil {
 		return err
diff --git a/tools/profile/impl_test.go b/tools/profile/impl_test.go
index 1dd149d..b442271 100644
--- a/tools/profile/impl_test.go
+++ b/tools/profile/impl_test.go
@@ -108,7 +108,13 @@
 }
 
 func TestProfileClient(t *testing.T) {
-	runtime := rt.Init()
+	var err error
+	runtime, err = rt.New()
+	if err != nil {
+		t.Fatalf("Unexpected error initializing runtime: %s", err)
+	}
+	defer runtime.Cleanup()
+
 	server, endpoint, err := startServer(t, runtime)
 	if err != nil {
 		return
diff --git a/tools/profile/main.go b/tools/profile/main.go
index 9e5d556..66c4112 100644
--- a/tools/profile/main.go
+++ b/tools/profile/main.go
@@ -4,12 +4,20 @@
 package main
 
 import (
+	"veyron.io/veyron/veyron2"
 	"veyron.io/veyron/veyron2/rt"
 
 	_ "veyron.io/veyron/veyron/profiles"
 )
 
+var runtime veyron2.Runtime
+
 func main() {
-	defer rt.Init().Cleanup()
+	var err error
+	runtime, err = rt.New()
+	if err != nil {
+		panic(err)
+	}
+	defer runtime.Cleanup()
 	root().Main()
 }