| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package local | 5 package local |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "crypto/sha1" | 8 "crypto/sha1" |
| 9 "encoding/base64" | 9 "encoding/base64" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 return current, nil | 355 return current, nil |
| 356 } | 356 } |
| 357 | 357 |
| 358 // setCurrentInstanceID changes a pointer to currently installed instance ID. It | 358 // setCurrentInstanceID changes a pointer to currently installed instance ID. It |
| 359 // takes a path to a package directory (.cipd/pkgs/<name>) as input. | 359 // takes a path to a package directory (.cipd/pkgs/<name>) as input. |
| 360 func (d *deployerImpl) setCurrentInstanceID(packageDir string, instanceID string
) error { | 360 func (d *deployerImpl) setCurrentInstanceID(packageDir string, instanceID string
) error { |
| 361 if err := common.ValidateInstanceID(instanceID); err != nil { | 361 if err := common.ValidateInstanceID(instanceID); err != nil { |
| 362 return err | 362 return err |
| 363 } | 363 } |
| 364 if runtime.GOOS == "windows" { | 364 if runtime.GOOS == "windows" { |
| 365 » » return d.fs.EnsureFile(filepath.Join(packageDir, currentTxt), st
rings.NewReader(instanceID)) | 365 » » return EnsureFile(d.fs, filepath.Join(packageDir, currentTxt), s
trings.NewReader(instanceID)) |
| 366 } | 366 } |
| 367 return d.fs.EnsureSymlink(filepath.Join(packageDir, currentSymlink), ins
tanceID) | 367 return d.fs.EnsureSymlink(filepath.Join(packageDir, currentSymlink), ins
tanceID) |
| 368 } | 368 } |
| 369 | 369 |
| 370 // readManifest reads package manifest given a path to a package instance | 370 // readManifest reads package manifest given a path to a package instance |
| 371 // (.cipd/pkgs/<name>/<instance id>). | 371 // (.cipd/pkgs/<name>/<instance id>). |
| 372 func (d *deployerImpl) readManifest(instanceDir string) (Manifest, error) { | 372 func (d *deployerImpl) readManifest(instanceDir string) (Manifest, error) { |
| 373 manifestPath := filepath.Join(instanceDir, filepath.FromSlash(manifestNa
me)) | 373 manifestPath := filepath.Join(instanceDir, filepath.FromSlash(manifestNa
me)) |
| 374 r, err := os.Open(manifestPath) | 374 r, err := os.Open(manifestPath) |
| 375 if err != nil { | 375 if err != nil { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 Size: uint64(info.Size()), | 536 Size: uint64(info.Size()), |
| 537 Executable: (info.Mode().Perm() & 0111)
!= 0, | 537 Executable: (info.Mode().Perm() & 0111)
!= 0, |
| 538 Symlink: symlink, | 538 Symlink: symlink, |
| 539 }) | 539 }) |
| 540 } | 540 } |
| 541 } | 541 } |
| 542 return nil | 542 return nil |
| 543 }) | 543 }) |
| 544 return out, err | 544 return out, err |
| 545 } | 545 } |
| OLD | NEW |