#!/usr/bin/python import sys,os if len(sys.argv) < 2: print 'usage: %s group-name=context' % sys.argv[0] sys.exit(1) # group is not group-dist groupList = ( [ x.split('=') for x in sys.argv[1:] if '=' in x ] + # group is unspecified and thus we default to group-dist [ x for x in sys.argv[1:] if '=' not in x ] ) toCook = '' for arch in ('x86', 'x86_64'): # build domu, vmware, and "normal" for flavor in ('xen,domU,!dom0,!vmware', '!xen,!domU,!dom0,!vmware', '!xen,!domU,!dom0,vmware'): if arch == 'x86' and flavor.startswith('xen'): paeness = ('kernel.pae','!kernel.pae') for pae in paeness: toCook += " group-dist'[%s,%s is: %s]' " % (flavor, pae, arch) else: toCook += " group-dist'[%s is: %s]' " % (flavor,arch) for group in groupList: if isinstance(group, list): # someone passed in something like "group-foo=" or "group=foo=bar" if len(group) != 2 or not group[1]: raise RuntimeError, 'berk? you probably passed a bad arg' cookme = toCook.replace('group-dist', group[0]) context = group[1] groupname = group[0] else: cookme = toCook context = group groupname = 'group-dist' # this is so that groups whose versions are keyed off of another trove's # version get updated preiodically os.system('foo="`mktemp -d /tmp/groupcook-XXXXXX`" ; cd $foo;' 'cvc co --context %s %s && cd %s && cvc ci -m "sync group version"' % (context, groupname, groupname) ) mailCmd = '' if os.getenv('MAIL_OUTPUT') == 'yes' or os.path.basename(sys.argv[0]) == 'groupcook-and-notify': mailCmd = '|| echo | mail -r "%s@rpath.com" -s "cooking %s=%s failed" "smithj@rpath.com"' % ( os.getenv('USER'), groupname, context) # we don't use util.execute() here since we want the rest of the cooks to # still happen os.system('/usr/bin/cvc cook --allow-flavor-change --context %s %s %s' % (context, cookme, mailCmd))