Skip to content

Commit 046f989

Browse files
wjtraceySkia Commit-Bot
authored andcommitted
Add ccache_mac cipd package scripts.
Change-Id: If71fc5fe27b4cf60cf963fff86d3e6a8224bf853 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269150 Auto-Submit: Weston Tracey <[email protected]> Reviewed-by: Ben Wagner aka dogben <[email protected]> Commit-Queue: Ben Wagner aka dogben <[email protected]>
1 parent c767209 commit 046f989

File tree

6 files changed

+145
-0
lines changed

6 files changed

+145
-0
lines changed

infra/bots/assets/ccache_mac/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2017 Google Inc.
4+
#
5+
# Use of this source code is governed by a BSD-style license that can be
6+
# found in the LICENSE file.
7+
8+
9+
"""Common vars used by scripts in this directory."""
10+
11+
12+
import os
13+
import sys
14+
15+
FILE_DIR = os.path.dirname(os.path.abspath(__file__))
16+
INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir))
17+
18+
sys.path.insert(0, INFRA_BOTS_DIR)
19+
from assets import assets
20+
21+
ASSET_NAME = os.path.basename(FILE_DIR)
22+
23+
24+
def run(cmd):
25+
"""Run a command, eg. "upload" or "download". """
26+
assets.main([cmd, ASSET_NAME] + sys.argv[1:])
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2016 Google Inc.
4+
#
5+
# Use of this source code is governed by a BSD-style license that can be
6+
# found in the LICENSE file.
7+
8+
9+
"""Create a ccache binary for mac hosts."""
10+
11+
12+
import argparse
13+
import common
14+
import os
15+
import subprocess
16+
import utils
17+
18+
URL = "https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz"
19+
VERSION = "ccache-3.7.7"
20+
21+
def create_asset(target_dir):
22+
# configure --prefix requires an absolute path.
23+
target_dir = os.path.abspath(target_dir)
24+
25+
# Download and extract the source.
26+
with utils.tmp_dir():
27+
subprocess.check_call(["curl", "-L", "-o", VERSION + ".tar.gz",
28+
"https://github.com/ccache/ccache/releases/download/v3.7.7/ccache-3.7.7.tar.gz"])
29+
subprocess.check_call(["tar", "-xzf", VERSION + ".tar.gz"])
30+
os.chdir(VERSION)
31+
32+
subprocess.check_call(["./configure", "--disable-man", "--prefix=" + target_dir])
33+
subprocess.check_call(["make"])
34+
subprocess.check_call(["make" ,"install"])
35+
36+
def main():
37+
parser = argparse.ArgumentParser()
38+
parser.add_argument('--target_dir', '-t', required=True)
39+
args = parser.parse_args()
40+
create_asset(args.target_dir)
41+
42+
43+
if __name__ == '__main__':
44+
main()
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2016 Google Inc.
4+
#
5+
# Use of this source code is governed by a BSD-style license that can be
6+
# found in the LICENSE file.
7+
8+
9+
"""Create the asset and upload it."""
10+
11+
12+
import argparse
13+
import common
14+
import os
15+
import subprocess
16+
import sys
17+
import utils
18+
19+
20+
def main():
21+
parser = argparse.ArgumentParser()
22+
parser.add_argument('--gsutil')
23+
args = parser.parse_args()
24+
25+
with utils.tmp_dir():
26+
cwd = os.getcwd()
27+
create_script = os.path.join(common.FILE_DIR, 'create.py')
28+
upload_script = os.path.join(common.FILE_DIR, 'upload.py')
29+
30+
try:
31+
subprocess.check_call(['python', create_script, '-t', cwd])
32+
cmd = ['python', upload_script, '-t', cwd]
33+
if args.gsutil:
34+
cmd.extend(['--gsutil', args.gsutil])
35+
subprocess.check_call(cmd)
36+
except subprocess.CalledProcessError:
37+
# Trap exceptions to avoid printing two stacktraces.
38+
sys.exit(1)
39+
40+
41+
if __name__ == '__main__':
42+
main()
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2017 Google Inc.
4+
#
5+
# Use of this source code is governed by a BSD-style license that can be
6+
# found in the LICENSE file.
7+
8+
9+
"""Download the current version of the asset."""
10+
11+
12+
import common
13+
14+
15+
if __name__ == '__main__':
16+
common.run('download')
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env python
2+
#
3+
# Copyright 2017 Google Inc.
4+
#
5+
# Use of this source code is governed by a BSD-style license that can be
6+
# found in the LICENSE file.
7+
8+
9+
"""Upload a new version of the asset."""
10+
11+
12+
import common
13+
14+
15+
if __name__ == '__main__':
16+
common.run('upload')

0 commit comments

Comments
 (0)