• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# Copyright 2020 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""Module to translate the xbuddy config."""
8
9from __future__ import print_function
10
11import os
12import sys
13
14if '/mnt/host/source/src/third_party/toolchain-utils/crosperf' in sys.path:
15  dev_path = os.path.expanduser('~/trunk/chromite/lib/xbuddy')
16  sys.path.append(dev_path)
17else:
18  print('This script can only be run from inside a ChromeOS chroot.  Please '
19        'enter your chroot, go to ~/src/third_party/toolchain-utils/crosperf'
20        ' and try again.')
21  sys.exit(0)
22
23# pylint: disable=import-error,wrong-import-position
24import xbuddy
25
26
27def Main(xbuddy_string):
28  if not os.path.exists('./xbuddy_config.ini'):
29    config_path = os.path.expanduser(
30        '~/trunk/chromite/lib/xbuddy/xbuddy_config.ini')
31    os.symlink(config_path, './xbuddy_config.ini')
32  x = xbuddy.XBuddy(manage_builds=False, static_dir='/tmp/devserver/static')
33  build_id = x.Translate(os.path.split(xbuddy_string))
34  return build_id
35
36
37if __name__ == '__main__':
38  print(Main(sys.argv[1]))
39  sys.exit(0)
40