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

Side by Side Diff: client/bin/local_host.py

Issue 5626007: move chromiumos_update into client/common_lib/cros (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: Created 10 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | client/common_lib/cros/__init__.py » ('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 2009 Google Inc. Released under the GPL v2 1 # Copyright 2009 Google Inc. Released under the GPL v2
2 2
3 """ 3 """
4 This file contains the implementation of a host object for the local machine. 4 This file contains the implementation of a host object for the local machine.
5 """ 5 """
6 6
7 import glob, httplib, logging, os, platform, socket, urlparse 7 import glob, httplib, logging, os, platform, socket, urlparse
8 from autotest_lib.client.bin import utils 8 from autotest_lib.client.bin import utils
9 from autotest_lib.client.common_lib import chromiumos_updater, error, hosts 9 from autotest_lib.client.common_lib import error, hosts
10 from autotest_lib.client.common_lib.cros import autoupdater
10 11
11 12
12 class LocalHost(hosts.Host): 13 class LocalHost(hosts.Host):
13 def _initialize(self, hostname=None, bootloader=None, *args, **dargs): 14 def _initialize(self, hostname=None, bootloader=None, *args, **dargs):
14 super(LocalHost, self)._initialize(*args, **dargs) 15 super(LocalHost, self)._initialize(*args, **dargs)
15 16
16 # hostname will be an actual hostname when this client was created 17 # hostname will be an actual hostname when this client was created
17 # by an autoserv process 18 # by an autoserv process
18 if not hostname: 19 if not hostname:
19 hostname = platform.node() 20 hostname = platform.node()
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 """ 52 """
52 Get a list of files on a remote host given a glob pattern path. 53 Get a list of files on a remote host given a glob pattern path.
53 """ 54 """
54 return glob.glob(path_glob) 55 return glob.glob(path_glob)
55 56
56 57
57 def machine_install(self, update_url=None): 58 def machine_install(self, update_url=None):
58 if not update_url: 59 if not update_url:
59 return False 60 return False
60 61
61 updater = chromiumos_updater.ChromiumOSUpdater(host=self, 62 updater = autoupdater.ChromiumOSUpdater(host=self,
62 update_url=update_url) 63 update_url=update_url)
63 # Updater has returned, successfully, reboot the host and 64 # Updater has returned, successfully, reboot the host and
64 # validate the installation from the calling script. 65 # validate the installation from the calling script.
65 return updater.run_update() 66 return updater.run_update()
66 67
67 68
68 def symlink_closure(self, paths): 69 def symlink_closure(self, paths):
69 """ 70 """
70 Given a sequence of path strings, return the set of all paths that 71 Given a sequence of path strings, return the set of all paths that
71 can be reached from the initial set by following symlinks. 72 can be reached from the initial set by following symlinks.
72 73
73 @param paths: sequence of path strings. 74 @param paths: sequence of path strings.
74 @return: a sequence of path strings that are all the unique paths that 75 @return: a sequence of path strings that are all the unique paths that
75 can be reached from the given ones after following symlinks. 76 can be reached from the given ones after following symlinks.
76 """ 77 """
77 paths = set(paths) 78 paths = set(paths)
78 closure = set() 79 closure = set()
79 80
80 while paths: 81 while paths:
81 path = paths.pop() 82 path = paths.pop()
82 if not os.path.exists(path): 83 if not os.path.exists(path):
83 continue 84 continue
84 closure.add(path) 85 closure.add(path)
85 if os.path.islink(path): 86 if os.path.islink(path):
86 link_to = os.path.join(os.path.dirname(path), 87 link_to = os.path.join(os.path.dirname(path),
87 os.readlink(path)) 88 os.readlink(path))
88 if link_to not in closure: 89 if link_to not in closure:
89 paths.add(link_to) 90 paths.add(link_to)
90 91
91 return closure 92 return closure
OLDNEW
« no previous file with comments | « no previous file | client/common_lib/cros/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698