#!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""A tool to package a checkout's source and upload it to Google Storage."""


import sys


if '__main__' == __name__:
  sys.exit(0)

#!/usr/bin/python
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

"""A tool to package a checkout's source and upload it to Google Storage."""


import os
import sys

from common import chromium_utils
from slave import slave_utils


FILENAME = 'chromium-src.tgz'
GSBASE = 'chromium-browser-csindex'


def main(argv):
  if not os.path.exists('src'):
    raise Exception('ERROR: no src directory to package, exiting')

  chromium_utils.RunCommand(['rm', '-f', FILENAME])
  if os.path.exists(FILENAME):
    raise Exception('ERROR: %s cannot be removed, exiting' % FILENAME)

  if chromium_utils.RunCommand(['tar', 'czf', FILENAME, 'src/']) != 0:
    raise Exception('ERROR: failed to create %s, exiting' % FILENAME)

  status = slave_utils.GSUtilCopyFile(FILENAME, GSBASE)
  if status != 0:
    raise Exception('ERROR: GSUtilCopyFile error %d. "%s" -> "%s"' % (
        status, FILENAME, GSBASE))

  return 0


if '__main__' == __name__:
  sys.exit(main(None))

Create source snapshot and upload to GS.
Create source snapshot and upload to GS.

BUG=79198

Review URL: http://codereview.chromium.org/7129020

git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@88372 0039d316-1c4b-4281-b951-d872f2087c98
