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

Side by Side Diff: scripts/slave/recipe_modules/sync_submodules/resources/deps2submodules.py

Issue 2185333002: Exclude nested submodules properly. This never worked. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Created 4 years, 4 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/python 1 #!/usr/bin/python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 """Read DEPS and use the information to update git submodules""" 6 """Read DEPS and use the information to update git submodules"""
7 7
8 import argparse 8 import argparse
9 import logging 9 import logging
10 import os 10 import os
(...skipping 18 matching lines...) Expand all
29 for name, value in submods.iteritems(): 29 for name, value in submods.iteritems():
30 if not name.startswith(path_prefix): 30 if not name.startswith(path_prefix):
31 logging.warning('Dropping submodule "%s", because it is outside the ' 31 logging.warning('Dropping submodule "%s", because it is outside the '
32 'working directory "%s"', name, path_prefix) 32 'working directory "%s"', name, path_prefix)
33 continue 33 continue
34 # Strip the prefix from the submodule name. 34 # Strip the prefix from the submodule name.
35 name = name[len(path_prefix):] 35 name = name[len(path_prefix):]
36 36
37 parts = name.split('/')[:-1] 37 parts = name.split('/')[:-1]
38 while parts: 38 while parts:
39 may_conflict = '/'.join(parts) 39 may_conflict = path_prefix + '/'.join(parts)
40 if may_conflict in submods: 40 if may_conflict in submods:
41 logging.warning('Dropping submodule "%s", because it is nested in ' 41 logging.warning('Dropping submodule "%s", because it is nested in '
42 'submodule "%s"', name, may_conflict) 42 'submodule "%s"', name, may_conflict)
43 break 43 break
44 parts.pop() 44 parts.pop()
45 45 else:
46 ret[name] = value 46 ret[name] = value
47 return ret 47 return ret
48 48
49 49
50 def CollateDeps(deps_content): 50 def CollateDeps(deps_content):
51 """ 51 """
52 Take the output of deps_utils.GetDepsContent and return a hash of: 52 Take the output of deps_utils.GetDepsContent and return a hash of:
53 53
54 { submod_name : [ [ submod_os, ... ], submod_url, submod_sha1 ], ... } 54 { submod_name : [ [ submod_os, ... ], submod_url, submod_sha1 ], ... }
55 """ 55 """
56 spliturl = lambda x: list(x.partition('@')[0::2]) if x else [None, None] 56 spliturl = lambda x: list(x.partition('@')[0::2]) if x else [None, None]
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 options.path_prefix)) 148 options.path_prefix))
149 RemoveObsoleteSubmodules() 149 RemoveObsoleteSubmodules()
150 for submod_path, submod_sha1 in adds.iteritems(): 150 for submod_path, submod_sha1 in adds.iteritems():
151 subprocess.check_call(['git', 'update-index', '--add', 151 subprocess.check_call(['git', 'update-index', '--add',
152 '--cacheinfo', '160000', submod_sha1, submod_path]) 152 '--cacheinfo', '160000', submod_sha1, submod_path])
153 return 0 153 return 0
154 154
155 155
156 if __name__ == '__main__': 156 if __name__ == '__main__':
157 sys.exit(main()) 157 sys.exit(main())
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