Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(91)

Side by Side Diff: build/linux/install-chromeos-fonts.py

Issue 12314144: Wrong file/dir owner and permission for installed Chrome OS fonts (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 178612 Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2013 The Chromium Authors. All rights reserved. 2 # Copyright 2013 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 # Script to install the Chrome OS fonts on Linux. 6 # Script to install the Chrome OS fonts on Linux.
7 # This script can be run manually (as root), but is also run as part 7 # This script can be run manually (as root), but is also run as part
8 # install-build-deps.sh. 8 # install-build-deps.sh.
9 9
10 import os 10 import os
(...skipping 21 matching lines...) Expand all
32 return 1 32 return 1
33 33
34 if not os.path.isdir(FONTS_DIR): 34 if not os.path.isdir(FONTS_DIR):
35 print "Error: Destination directory does not exist: %s" % FONTS_DIR 35 print "Error: Destination directory does not exist: %s" % FONTS_DIR
36 return 1 36 return 1
37 37
38 dest_dir = os.path.join(FONTS_DIR, 'chromeos') 38 dest_dir = os.path.join(FONTS_DIR, 'chromeos')
39 39
40 url = "%s/%s/%s" % (URL_PREFIX, URL_DIR, URL_FILE) 40 url = "%s/%s/%s" % (URL_PREFIX, URL_DIR, URL_FILE)
41 41
42 stamp = os.path.join(dest_dir, ".stamp") 42 stamp = os.path.join(dest_dir, ".stamp02")
43 if os.path.exists(stamp): 43 if os.path.exists(stamp):
44 with open(stamp) as s: 44 with open(stamp) as s:
45 if s.read() == url: 45 if s.read() == url:
46 print "Chrome OS fonts already up-to-date in %s." % dest_dir 46 print "Chrome OS fonts already up-to-date in %s." % dest_dir
47 return 0 47 return 0
48 48
49 if os.path.isdir(dest_dir): 49 if os.path.isdir(dest_dir):
50 shutil.rmtree(dest_dir) 50 shutil.rmtree(dest_dir)
51 os.mkdir(dest_dir); 51 os.mkdir(dest_dir)
52 os.chmod(dest_dir, 0755)
52 53
53 print "Installing Chrome OS fonts to %s." % dest_dir 54 print "Installing Chrome OS fonts to %s." % dest_dir
54 tarball = os.path.join(dest_dir, URL_FILE) 55 tarball = os.path.join(dest_dir, URL_FILE)
55 subprocess.check_call(['curl', '-L', url, '-o', tarball]) 56 subprocess.check_call(['curl', '-L', url, '-o', tarball])
56 subprocess.check_call(['tar', 'xf', tarball, '-C', dest_dir]) 57 subprocess.check_call(['tar', '--no-same-owner', '--no-same-permissions',
58 '-xf', tarball, '-C', dest_dir])
57 os.remove(tarball) 59 os.remove(tarball)
58 60
59 readme = os.path.join(dest_dir, "README") 61 readme = os.path.join(dest_dir, "README")
60 with open(readme, 'w') as s: 62 with open(readme, 'w') as s:
61 s.write("This directory and its contents are auto-generated.\n") 63 s.write("This directory and its contents are auto-generated.\n")
62 s.write("It may be deleted and recreated. Do not modify.\n") 64 s.write("It may be deleted and recreated. Do not modify.\n")
63 s.write("Script: %s\n" % __file__) 65 s.write("Script: %s\n" % __file__)
64 66
65 with open(stamp, 'w') as s: 67 with open(stamp, 'w') as s:
66 s.write(url) 68 s.write(url)
67 69
70 for base, dirs, files in os.walk(dest_dir):
71 for dir in dirs:
72 os.chmod(os.path.join(base, dir), 0755)
73 for file in files:
74 os.chmod(os.path.join(base, file), 0644)
75
68 return 0 76 return 0
69 77
70 if __name__ == '__main__': 78 if __name__ == '__main__':
71 sys.exit(main(sys.argv[1:])) 79 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698