Use git workflow.
This commit is contained in:
Родитель
ce7523196c
Коммит
a306da18fa
|
@ -1,14 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import errno
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
||||
DEPOT_TOOLS_DIR = os.path.join(SOURCE_ROOT, 'vendor', 'depot_tools')
|
||||
VENDOR_DIR = os.path.join(SOURCE_ROOT, 'vendor')
|
||||
DEPOT_TOOLS_DIR = os.path.join(VENDOR_DIR, 'depot_tools')
|
||||
DEPOT_TOOLS_URL = \
|
||||
'https://chromium.googlesource.com/chromium/tools/depot_tools.git'
|
||||
CHROMIUM_DIR = os.path.join(VENDOR_DIR, 'chromium')
|
||||
SRC_DIR = os.path.join(CHROMIUM_DIR, 'src')
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -32,9 +37,28 @@ def main():
|
|||
if result:
|
||||
return result
|
||||
|
||||
# Clean out old svn checkout.
|
||||
if os.path.isdir(os.path.join(SRC_DIR, '.svn')):
|
||||
rm_rf(SRC_DIR)
|
||||
|
||||
if not os.path.isdir(SRC_DIR):
|
||||
os.chdir(CHROMIUM_DIR)
|
||||
fetch = os.path.join(DEPOT_TOOLS_DIR, 'fetch.py')
|
||||
result = subprocess.call([fetch, 'chromium'])
|
||||
if result:
|
||||
return result;
|
||||
|
||||
update = os.path.join(SOURCE_ROOT, 'script', 'update')
|
||||
return subprocess.call([sys.executable, update])
|
||||
|
||||
|
||||
def rm_rf(path):
|
||||
try:
|
||||
shutil.rmtree(path)
|
||||
except OSError as e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
|
|
@ -16,7 +16,7 @@ CHROMIUMCONTENT_DESTINATION_DIR = os.path.join(SRC_DIR, 'chromiumcontent')
|
|||
|
||||
|
||||
def main():
|
||||
return (write_dot_gclient() or
|
||||
return (checkout_version() or
|
||||
gclient_sync() or
|
||||
apply_patches() or
|
||||
copy_chromiumcontent_files() or
|
||||
|
@ -24,21 +24,22 @@ def main():
|
|||
install_win_tool_wrapper())
|
||||
|
||||
|
||||
def write_dot_gclient():
|
||||
template = os.path.join(CHROMIUM_DIR, '.gclient.in')
|
||||
destination = os.path.join(CHROMIUM_DIR, '.gclient')
|
||||
version = chromium_version()
|
||||
with open(template) as t:
|
||||
with open(destination, 'w') as d:
|
||||
for line in t:
|
||||
d.write(line.replace('{{VERSION}}', version))
|
||||
|
||||
|
||||
def chromium_version():
|
||||
with open(os.path.join(SOURCE_ROOT, 'VERSION')) as f:
|
||||
return f.readline().strip()
|
||||
|
||||
|
||||
def checkout_version():
|
||||
os.chdir(SRC_DIR)
|
||||
result = subprocess.call(['git', 'fetch', '--tags'])
|
||||
if result:
|
||||
return result
|
||||
result = subprocess.call(['git', 'checkout',
|
||||
'refs/tags/{0}'.format(chromium_version())])
|
||||
if result:
|
||||
return result
|
||||
|
||||
|
||||
def gclient_sync():
|
||||
gclient = os.path.join(DEPOT_TOOLS_DIR, 'gclient.py')
|
||||
os.chdir(CHROMIUM_DIR)
|
||||
|
|
Загрузка…
Ссылка в новой задаче