OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 ## repo default configuration | 3 ## repo default configuration |
4 ## | 4 ## |
5 REPO_URL='https://chromium.googlesource.com/external/repo' | 5 REPO_URL='https://chromium.googlesource.com/external/repo' |
6 REPO_REV='stable' | 6 REPO_REV='stable' |
7 | 7 |
8 # Copyright (C) 2008 Google Inc. | 8 # Copyright (C) 2008 Google Inc. |
9 # | 9 # |
10 # Licensed under the Apache License, Version 2.0 (the "License"); | 10 # Licensed under the Apache License, Version 2.0 (the "License"); |
11 # you may not use this file except in compliance with the License. | 11 # you may not use this file except in compliance with the License. |
12 # You may obtain a copy of the License at | 12 # You may obtain a copy of the License at |
13 # | 13 # |
14 # http://www.apache.org/licenses/LICENSE-2.0 | 14 # http://www.apache.org/licenses/LICENSE-2.0 |
15 # | 15 # |
16 # Unless required by applicable law or agreed to in writing, software | 16 # Unless required by applicable law or agreed to in writing, software |
17 # distributed under the License is distributed on an "AS IS" BASIS, | 17 # distributed under the License is distributed on an "AS IS" BASIS, |
18 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 18 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
19 # See the License for the specific language governing permissions and | 19 # See the License for the specific language governing permissions and |
20 # limitations under the License. | 20 # limitations under the License. |
21 | 21 |
22 # increment this whenever we make important changes to this script | 22 # increment this whenever we make important changes to this script |
23 VERSION = (1, 21) | 23 VERSION = (1, 21) |
24 | 24 |
25 # increment this if the MAINTAINER_KEYS block is modified | 25 # increment this if the MAINTAINER_KEYS block is modified |
26 KEYRING_VERSION = (1, 4) | 26 KEYRING_VERSION = (1, 5) |
27 MAINTAINER_KEYS = """ | 27 MAINTAINER_KEYS = """ |
28 | 28 |
29 Repo Maintainer <repo@android.kernel.org> | 29 Repo Maintainer <repo@android.kernel.org> |
30 -----BEGIN PGP PUBLIC KEY BLOCK----- | 30 -----BEGIN PGP PUBLIC KEY BLOCK----- |
31 Version: GnuPG v1.4.2.2 (GNU/Linux) | 31 Version: GnuPG v1.4.2.2 (GNU/Linux) |
32 | 32 |
33 mQGiBEj3ugERBACrLJh/ZPyVSKeClMuznFIrsQ+hpNnmJGw1a9GXKYKk8qHPhAZf | 33 mQGiBEj3ugERBACrLJh/ZPyVSKeClMuznFIrsQ+hpNnmJGw1a9GXKYKk8qHPhAZf |
34 WKtrBqAVMNRLhL85oSlekRz98u41H5si5zcuv+IXJDF5MJYcB8f22wAy15lUqPWi | 34 WKtrBqAVMNRLhL85oSlekRz98u41H5si5zcuv+IXJDF5MJYcB8f22wAy15lUqPWi |
35 VCkk1l8qqLiuW0fo+ZkPY5qOgrvc0HW1SmdH649uNwqCbcKb6CxaTxzhOwCgj3AP | 35 VCkk1l8qqLiuW0fo+ZkPY5qOgrvc0HW1SmdH649uNwqCbcKb6CxaTxzhOwCgj3AP |
36 xI1WfzLqdJjsm1Nq98L0cLcD/iNsILCuw44PRds3J75YP0pze7YF/6WFMB6QSFGu | 36 xI1WfzLqdJjsm1Nq98L0cLcD/iNsILCuw44PRds3J75YP0pze7YF/6WFMB6QSFGu |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 a7HWaB7f0eXg5M5GTr7KP6TTGwY/500cI4fDme6bih/jXDS4vV53b1HHgvzQFXw/ | 177 a7HWaB7f0eXg5M5GTr7KP6TTGwY/500cI4fDme6bih/jXDS4vV53b1HHgvzQFXw/ |
178 XURueobmqsbQQzDGsqPzkYJM4fxXu0TWNhW8CieZMMypPq3uSgvN3jTu2JB9NAEz | 178 XURueobmqsbQQzDGsqPzkYJM4fxXu0TWNhW8CieZMMypPq3uSgvN3jTu2JB9NAEz |
179 21Pso0NzKm6wxhMzPA6KWILmR2KQn/t51NTE6u0+8e9RmQeg9Ce+IpPzPLsGuNca | 179 21Pso0NzKm6wxhMzPA6KWILmR2KQn/t51NTE6u0+8e9RmQeg9Ce+IpPzPLsGuNca |
180 u+r4LcB98D8jIUXz9PPbIHiDLJjMWOG8olZz1zcHpt86b+bf8c9TxFAE8p3G/jpQ | 180 u+r4LcB98D8jIUXz9PPbIHiDLJjMWOG8olZz1zcHpt86b+bf8c9TxFAE8p3G/jpQ |
181 qanHjtbgNmkz+JpvJ9CTEEo69tkcbmOaCNwCWQL+Doqqi7tWMYUbAw0Rk+lOSu/N | 181 qanHjtbgNmkz+JpvJ9CTEEo69tkcbmOaCNwCWQL+Doqqi7tWMYUbAw0Rk+lOSu/N |
182 4cAccd41XU/GmIs9zKkbORWubhfFndc7AXnPUU2otjqMQq0f+QCQrHPdyARf2QCm | 182 4cAccd41XU/GmIs9zKkbORWubhfFndc7AXnPUU2otjqMQq0f+QCQrHPdyARf2QCm |
183 j8zzwdwkRpt3SSvqzh3+L3Zq8xeb2M6u/QLz4aLFTR7yQJed0DJFUcISii9ccJr/ | 183 j8zzwdwkRpt3SSvqzh3+L3Zq8xeb2M6u/QLz4aLFTR7yQJed0DJFUcISii9ccJr/ |
184 IM4= | 184 IM4= |
185 =6VNc | 185 =6VNc |
186 -----END PGP PUBLIC KEY BLOCK----- | 186 -----END PGP PUBLIC KEY BLOCK----- |
187 | |
188 Mike Frysinger <vapier@chromium.org> | |
189 -----BEGIN PGP PUBLIC KEY BLOCK----- | |
190 Version: GnuPG v1 | |
191 | |
192 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 | |
227 =i88c | |
228 -----END PGP PUBLIC KEY BLOCK----- | |
187 """ | 229 """ |
188 | 230 |
189 GIT = 'git' # our git command | 231 GIT = 'git' # our git command |
190 MIN_GIT_VERSION = (1, 7, 2) # minimum supported git version | 232 MIN_GIT_VERSION = (1, 7, 2) # minimum supported git version |
191 repodir = '.repo' # name of repo's private directory | 233 repodir = '.repo' # name of repo's private directory |
192 S_repo = 'repo' # special repo repository | 234 S_repo = 'repo' # special repo repository |
193 S_manifests = 'manifests' # special manifest repository | 235 S_manifests = 'manifests' # special manifest repository |
194 REPO_MAIN = S_repo + '/main.py' # main script | 236 REPO_MAIN = S_repo + '/main.py' # main script |
195 MIN_PYTHON_VERSION = (2, 6) # minimum supported python version | 237 MIN_PYTHON_VERSION = (2, 6) # minimum supported python version |
196 | 238 |
197 | 239 |
198 import errno | 240 import errno |
199 import optparse | 241 import optparse |
200 import os | 242 import os |
201 import re | 243 import re |
244 import shutil | |
202 import stat | 245 import stat |
203 import subprocess | 246 import subprocess |
204 import sys | 247 import sys |
205 | 248 |
206 if sys.version_info[0] == 3: | 249 if sys.version_info[0] == 3: |
207 import urllib.request | 250 import urllib.request |
208 import urllib.error | 251 import urllib.error |
209 else: | 252 else: |
210 import imp | 253 import imp |
211 import urllib2 | 254 import urllib2 |
212 urllib = imp.new_module('urllib') | 255 urllib = imp.new_module('urllib') |
213 urllib.request = urllib2 | 256 urllib.request = urllib2 |
214 urllib.error = urllib2 | 257 urllib.error = urllib2 |
215 | 258 |
216 | 259 |
217 def _print(*objects, **kwargs): | 260 def _print(*objects, **kwargs): |
218 sep = kwargs.get('sep', ' ') | 261 sep = kwargs.get('sep', ' ') |
219 end = kwargs.get('end', '\n') | 262 end = kwargs.get('end', '\n') |
220 out = kwargs.get('file', sys.stdout) | 263 out = kwargs.get('file', sys.stdout) |
221 out.write(sep.join(objects) + end) | 264 out.write(sep.join(objects) + end) |
222 | 265 |
223 | 266 |
224 # Python version check | 267 # Python version check |
225 ver = sys.version_info | 268 ver = sys.version_info |
226 if ver[0] == 3: | |
227 _print('warning: Python 3 support is currently experimental. YMMV.\n' | |
228 'Please use Python 2.6 - 2.7 instead.', | |
229 file=sys.stderr) | |
230 if (ver[0], ver[1]) < MIN_PYTHON_VERSION: | 269 if (ver[0], ver[1]) < MIN_PYTHON_VERSION: |
231 _print('error: Python version %s unsupported.\n' | 270 _print('error: Python version %s unsupported.\n' |
232 'Please use Python 2.6 - 2.7 instead.' | 271 'Please use Python 2.6 - 2.7 instead.' |
233 % sys.version.split(' ')[0], file=sys.stderr) | 272 % sys.version.split(' ')[0], file=sys.stderr) |
234 sys.exit(1) | 273 sys.exit(1) |
235 | 274 |
236 home_dot_repo = os.path.expanduser(os.path.join('~','.repoconfig')) | 275 home_dot_repo = os.path.expanduser('~/.repoconfig') |
237 gpg_dir = os.path.join(home_dot_repo, 'gnupg') | 276 gpg_dir = os.path.join(home_dot_repo, 'gnupg') |
238 | 277 |
239 extra_args = [] | 278 extra_args = [] |
240 init_optparse = optparse.OptionParser(usage="repo init -u url [options]") | 279 init_optparse = optparse.OptionParser(usage="repo init -u url [options]") |
241 | 280 |
242 # Logging | 281 # Logging |
243 group = init_optparse.add_option_group('Logging options') | 282 group = init_optparse.add_option_group('Logging options') |
244 group.add_option('-q', '--quiet', | 283 group.add_option('-q', '--quiet', |
245 dest="quiet", action="store_true", default=False, | 284 dest="quiet", action="store_true", default=False, |
246 help="be quiet") | 285 help="be quiet") |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
819 if cmd == 'help': | 858 if cmd == 'help': |
820 _Help(args) | 859 _Help(args) |
821 if not cmd: | 860 if not cmd: |
822 _NotInstalled() | 861 _NotInstalled() |
823 if cmd == 'init': | 862 if cmd == 'init': |
824 if my_git: | 863 if my_git: |
825 _SetDefaultsTo(my_git) | 864 _SetDefaultsTo(my_git) |
826 try: | 865 try: |
827 _Init(args) | 866 _Init(args) |
828 except CloneFailure: | 867 except CloneFailure: |
829 for root, dirs, files in os.walk(repodir, topdown=False): | 868 shutil.rmtree(os.path.join(repodir, S_repo), ignore_errors=True) |
dnj
2016/09/14 23:02:48
The previous one actually removed "repodir" too.
vapier
2016/09/14 23:04:09
just to be clear, i didn't "make" these changes ..
| |
830 for name in files: | |
831 os.remove(os.path.join(root, name)) | |
832 for name in dirs: | |
833 os.rmdir(os.path.join(root, name)) | |
834 os.rmdir(repodir) | |
835 sys.exit(1) | 869 sys.exit(1) |
836 repo_main, rel_repo_dir = _FindRepo() | 870 repo_main, rel_repo_dir = _FindRepo() |
837 else: | 871 else: |
838 _NoCommands(cmd) | 872 _NoCommands(cmd) |
839 | 873 |
840 if cmd == 'sync' and NeedSetupGnuPG(): | 874 if cmd == 'sync' and NeedSetupGnuPG(): |
841 SetupGnuPG(False) | 875 SetupGnuPG(False) |
842 | 876 |
843 if my_main: | 877 if my_main: |
844 repo_main = my_main | 878 repo_main = my_main |
845 | 879 |
846 ver_str = '.'.join(map(str, VERSION)) | 880 ver_str = '.'.join(map(str, VERSION)) |
847 me = [sys.executable, repo_main, | 881 me = [sys.executable, repo_main, |
848 '--repo-dir=%s' % rel_repo_dir, | 882 '--repo-dir=%s' % rel_repo_dir, |
849 '--wrapper-version=%s' % ver_str, | 883 '--wrapper-version=%s' % ver_str, |
850 '--wrapper-path=%s' % wrapper_path, | 884 '--wrapper-path=%s' % wrapper_path, |
851 '--'] | 885 '--'] |
852 me.extend(orig_args) | 886 me.extend(orig_args) |
853 me.extend(extra_args) | 887 me.extend(extra_args) |
854 try: | 888 try: |
855 os.execv(sys.executable, me) | 889 os.execv(sys.executable, me) |
856 except OSError as e: | 890 except OSError as e: |
857 _print("fatal: unable to start %s" % repo_main, file=sys.stderr) | 891 _print("fatal: unable to start %s" % repo_main, file=sys.stderr) |
858 _print("fatal: %s" % e, file=sys.stderr) | 892 _print("fatal: %s" % e, file=sys.stderr) |
859 sys.exit(148) | 893 sys.exit(148) |
860 | 894 |
861 | 895 |
862 if __name__ == '__main__': | 896 if __name__ == '__main__': |
897 if ver[0] == 3: | |
898 _print('warning: Python 3 support is currently experimental. YMMV.\n' | |
899 'Please use Python 2.6 - 2.7 instead.', | |
900 file=sys.stderr) | |
863 main(sys.argv[1:]) | 901 main(sys.argv[1:]) |
OLD | NEW |