Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: client/cipd/local/deployer.go

Issue 1872363004: cipd: accept a function in EnsureFile (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: rebased Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « client/cipd/client.go ('k') | client/cipd/local/fs.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « client/cipd/client.go ('k') | client/cipd/local/fs.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698