veyron/services/mgmt/binary/impl,veyron/tools/binary: minor cleanups
Change-Id: I498fc1b0a5de94cd6f473ec1c52551c8946c094e
diff --git a/services/mgmt/binary/impl/fs_utils.go b/services/mgmt/binary/impl/fs_utils.go
index 9468fb6..d72c6d4 100644
--- a/services/mgmt/binary/impl/fs_utils.go
+++ b/services/mgmt/binary/impl/fs_utils.go
@@ -13,9 +13,11 @@
)
const (
- checksum = "checksum"
- data = "data"
- lock = "lock"
+ checksum = "checksum"
+ data = "data"
+ lock = "lock"
+ name = "name"
+ mediainfo = "mediainfo"
)
// checksumExists checks whether the given part path is valid and
@@ -80,7 +82,7 @@
}
result[idx] = filepath.Join(path, partName)
} else {
- if info.Name() == "name" || info.Name() == "mediainfo" {
+ if info.Name() == name || info.Name() == mediainfo {
continue
}
// The only entries should correspond to the part dirs.
@@ -97,7 +99,7 @@
for d := 0; d < i.state.depth; d++ {
pattern = filepath.Join(pattern, "*")
}
- pattern = filepath.Join(pattern, "*", "name")
+ pattern = filepath.Join(pattern, "*", name)
matches, err := filepath.Glob(pattern)
if err != nil {
return nil
diff --git a/services/mgmt/binary/impl/service.go b/services/mgmt/binary/impl/service.go
index 718e9e2..f2137db 100644
--- a/services/mgmt/binary/impl/service.go
+++ b/services/mgmt/binary/impl/service.go
@@ -12,6 +12,8 @@
// name
// acls/data
// acls/sig
+// mediainfo
+// name
// <part_1>/checksum
// <part_1>/data
// ...
@@ -115,7 +117,7 @@
vlog.Errorf("TempDir(%v, %v) failed: %v", parent, prefix, err)
return verror.Make(ErrOperationFailed, context.Context())
}
- nameFile := filepath.Join(tmpDir, "name")
+ nameFile := filepath.Join(tmpDir, name)
if err := ioutil.WriteFile(nameFile, []byte(i.suffix), os.FileMode(0600)); err != nil {
vlog.Errorf("WriteFile(%q) failed: %v", nameFile)
return verror.Make(ErrOperationFailed, context.Context())
@@ -128,7 +130,7 @@
return verror.Make(ErrOperationFailed, context.Context())
}
- infoFile := filepath.Join(tmpDir, "mediainfo")
+ infoFile := filepath.Join(tmpDir, mediainfo)
jInfo, err := json.Marshal(mediaInfo)
if err != nil {
vlog.Errorf("json.Marshal(%v) failed: %v", mediaInfo, err)
@@ -272,7 +274,7 @@
}
result = append(result, binary.PartInfo{Checksum: string(bytes), Size: fi.Size()})
}
- infoFile := filepath.Join(i.path, "mediainfo")
+ infoFile := filepath.Join(i.path, mediainfo)
jInfo, err := ioutil.ReadFile(infoFile)
if err != nil {
vlog.Errorf("ReadFile(%q) failed: %v", infoFile)
diff --git a/tools/binary/impl.go b/tools/binary/impl.go
index cfd78f9..9d9f56a 100644
--- a/tools/binary/impl.go
+++ b/tools/binary/impl.go
@@ -59,15 +59,15 @@
var cmdUpload = &cmdline.Command{
Run: runUpload,
Name: "upload",
- Short: "Upload a binary",
+ Short: "Upload a binary or directory archive",
Long: `
Upload connects to the binary repository and uploads the binary of the specified
-file. When successful, it writes the name of the new binary to stdout.
+file or archive of the specified directory. When successful, it writes the name of the new binary to stdout.
`,
ArgsName: "<von> <filename>",
ArgsLong: `
<von> is the veyron object name of the binary to upload
-<filename> is the name of the file to upload
+<filename> is the name of the file or directory to upload
`,
}