|
|
@@ -14,6 +14,7 @@
|
|
|
# limitations under the License.
|
|
|
|
|
|
import os
|
|
|
+import platform
|
|
|
import re
|
|
|
import shutil
|
|
|
import sys
|
|
|
@@ -91,6 +92,11 @@ to update the working directory files.
|
|
|
dest='groups', default='default',
|
|
|
help='restrict manifest projects to ones with a specified group',
|
|
|
metavar='GROUP')
|
|
|
+ g.add_option('-p', '--platform',
|
|
|
+ dest='platform', default='auto',
|
|
|
+ help='restrict manifest projects to ones with a specified'
|
|
|
+ 'platform group [auto|all|none|linux|darwin|...]',
|
|
|
+ metavar='PLATFORM')
|
|
|
|
|
|
# Tool
|
|
|
g = p.add_option_group('repo Version options')
|
|
|
@@ -141,9 +147,24 @@ to update the working directory files.
|
|
|
r.Save()
|
|
|
|
|
|
groups = re.split('[,\s]+', opt.groups)
|
|
|
+ all_platforms = ['linux', 'darwin']
|
|
|
+ platformize = lambda x: 'platform-' + x
|
|
|
+ if opt.platform == 'auto':
|
|
|
+ if (not opt.mirror and
|
|
|
+ not m.config.GetString('repo.mirror') == 'true'):
|
|
|
+ groups.append(platformize(platform.system().lower()))
|
|
|
+ elif opt.platform == 'all':
|
|
|
+ groups.extend(map(platformize, all_platfroms))
|
|
|
+ elif opt.platform in all_platforms:
|
|
|
+ groups.extend(platformize(opt.platform))
|
|
|
+ elif opt.platform != 'none':
|
|
|
+ print >>sys.stderr, 'fatal: invalid platform flag'
|
|
|
+ sys.exit(1)
|
|
|
+
|
|
|
groups = [x for x in groups if x]
|
|
|
groupstr = ','.join(groups)
|
|
|
- if groupstr == 'default':
|
|
|
+ if opt.platform == 'auto' and
|
|
|
+ groupstr == 'default,platform-' + platform.system.lower():
|
|
|
groupstr = None
|
|
|
m.config.SetString('manifest.groups', groupstr)
|
|
|
|