def SetChrootVersion(self, version, chroot=None): """Update the version file in the chroot to |version|. Args: version: Version to use. E.g. 6394.0.0-rc3 chroot: Path to chroot. Defaults to 'chroot' under build root. """ chroot_version_file = self._ChrootVersionPath(chroot) if os.path.exists(os.path.dirname(chroot_version_file)): sudo.SetFileContents(chroot_version_file, version)
def _SudoSet(self, key, value): """Set a cgroup file in this namespace to a specific value""" name = self._LimitName(key, True) try: return sudo.SetFileContents(name, value, cwd=os.path.dirname(name)) except cros_build_lib.RunCommandError, e: if e.exception is not None: # Command failed before the exec itself; convert ENOENT # appropriately. exc = e.exception if isinstance(exc, EnvironmentError) and exc.errno == errno.ENOENT: raise _GroupWasRemoved(self.namespace, e) raise