def SetTag(self): print "Current CVS Tag : \"%s\"" % self.cvs_tag print "Current CVS Date: \"%s\"" % self.cvs_date print "" print "You may enter a new tag, branch or date, to enter" print "both a branch and a date, put a @ in between." print "Example: yourbranch@2002/01/20 05:20:22" print "Note that if you are using BIFs and/or profiles" print "directly from CVS, then those files will be updated" print "using the information you enter here." print "" tag = raw_input("Enter branch, tag, date or branch@date: ") parts = string.split(tag, "@") self.cvs_tag = "" self.cvs_date = "" if len(parts) > 1: self.cvs_tag = parts[0] self.cvs_date = parts[1] elif (" " in tag) or ("/" in tag): self.cvs_date = tag else: self.cvs_tag = tag bldreg.set_value('build', 'cvs_date', self.cvs_date) bldreg.set_value('build', 'cvs_tag', self.cvs_tag) ## Update branchlist and profile_list import branchlist self.branch_list = branchlist.BranchList(self.cvs_tag, self.cvs_date) self.profile_list = None
def SetTag(self): print "Current CVS Tag : \"%s\"" % self.cvs_tag print "Current CVS Date: \"%s\"" % self.cvs_date print "" print "You may enter a new tag, branch or date, to enter" print "both a branch and a date, put a @ in between." print "Example: yourbranch@2002/01/20 05:20:22" print "Note that if you are using BIFs and/or profiles" print "directly from CVS, then those files will be updated" print "using the information you enter here." print "" tag=raw_input("Enter branch, tag, date or branch@date: ") parts = string.split(tag,"@") self.cvs_tag="" self.cvs_date="" if len(parts) > 1: self.cvs_tag=parts[0] self.cvs_date=parts[1] elif (" " in tag) or ("/" in tag): self.cvs_date=tag else: self.cvs_tag=tag bldreg.set_value('build','cvs_date',self.cvs_date) bldreg.set_value('build','cvs_tag',self.cvs_tag) ## Update branchlist and profile_list import branchlist self.branch_list = branchlist.BranchList(self.cvs_tag, self.cvs_date) self.profile_list = None
def Toggle(self, *flags): for flag in flags: if flag in self.flags: i = self.flags.index(flag) del self.flags[i] else: self.flags.append(flag) bldreg.set_value('build','arguments',self.flags)
def Toggle(self, *flags): for flag in flags: if flag in self.flags: i = self.flags.index(flag) del self.flags[i] else: self.flags.append(flag) bldreg.set_value('build', 'arguments', self.flags)
def SetTarget(self): modules = self.GetModules() toplevel=[] groups={} all=[] for m in modules: if m.get_attribute("from_shadow_only"): continue g=m.group or "other" if not groups.get(g): groups[g]=[m.id] else: groups[g].append(m.id) all.append(m.id) if m.get_attribute("primary_target"): toplevel.append(m.id) ## No point in creating menues with one choice if not toplevel and (len(all) < 20 or len(groups) <= 1): toplevel=all else: for g in groups.keys() + ["all"]: toplevel.append("List %s targets..." % g) groups["all"]=all groups[""]=toplevel group = "" while 1: selection = MultipleChoiceMenu("target", groups[group], all).get() if not selection: if group: group = "" continue print "Target not changed" return if len(selection) == 1: w=string.split(selection[0]) if len(w) > 2 and w[0] == "List" and w[-1]=="targets...": group=string.join(w[1:-1]) continue self.targets = selection bldreg.set_value('build','targets',self.targets) break
def SetTarget(self): modules = self.GetModules() toplevel = [] groups = {} all = [] for m in modules: if m.get_attribute("from_shadow_only"): continue g = m.group or "other" if not groups.get(g): groups[g] = [m.id] else: groups[g].append(m.id) all.append(m.id) if m.get_attribute("primary_target"): toplevel.append(m.id) ## No point in creating menues with one choice if not toplevel and (len(all) < 20 or len(groups) <= 1): toplevel = all else: for g in groups.keys() + ["all"]: toplevel.append("List %s targets..." % g) groups["all"] = all groups[""] = toplevel group = "" while 1: selection = MultipleChoiceMenu("target", groups[group], all).get() if not selection: if group: group = "" continue print "Target not changed" return if len(selection) == 1: w = string.split(selection[0]) if len(w) > 2 and w[0] == "List" and w[-1] == "targets...": group = string.join(w[1:-1]) continue self.targets = selection bldreg.set_value('build', 'targets', self.targets) break
def SetBIFBranch(self): branch_list = self.branch_list.get_bif_list() branch_list.sort() bif=BasicMenu("BIF",branch_list).get() if not bif: print "BIF Branch not changed" return bldreg.set_value('build', 'branch', bif) self.build_branch = bif bif_data = self.GetBIF() if bif_data.default_profile: bldreg.set_value('build','profile',bif_data.default_profile) self.profile=self.get_profile_list().file(bif_data.default_profile) if bif_data.default_target: self.targets = string.split(bif_data.default_target) bldreg.set_value('build','targets',self.targets) if bif_data.default_options: flags = string.split(bif_data.default_options) for flag in flags: flag = "-t"+flag if flag not in self.flags: self.flags.append(flag) bldreg.set_value('build','arguments',self.flags) print
def Build(self): if self.flags in self.history: i=self.history.index(self.flags) del self.history[i] self.history = [ self.flags ] + self.history if len(self.history) > 5: self.history = self.history[:5] bldreg.set_value('build','history',self.history) # print "%r" % self.history self.build(self.flags)
def SetBIFBranch(self): branch_list = self.branch_list.get_bif_list() branch_list.sort() bif = BasicMenu("BIF", branch_list).get() if not bif: print "BIF Branch not changed" return bldreg.set_value('build', 'branch', bif) self.build_branch = bif bif_data = self.GetBIF() if bif_data.default_profile: bldreg.set_value('build', 'profile', bif_data.default_profile) self.profile = self.get_profile_list().file( bif_data.default_profile) if bif_data.default_target: self.targets = string.split(bif_data.default_target) bldreg.set_value('build', 'targets', self.targets) if bif_data.default_options: flags = string.split(bif_data.default_options) for flag in flags: flag = "-t" + flag if flag not in self.flags: self.flags.append(flag) bldreg.set_value('build', 'arguments', self.flags) print
def Build(self): if self.flags in self.history: i = self.history.index(self.flags) del self.history[i] self.history = [self.flags] + self.history if len(self.history) > 5: self.history = self.history[:5] bldreg.set_value('build', 'history', self.history) # print "%r" % self.history self.build(self.flags)
def SetProfile(self): print files_scanned=0 profiles = [] for p in self.GetModules(): if p.type == p.MODULE_PROFILE: profiles.append(p.id) max_bif=len(profiles) tmp = self.get_profile_list().get_list() tmp.sort() profiles.extend(tmp) profile=BasicMenu("profile",profiles).get() if not profile: print "Profile not changed" else: bldreg.set_value('build','profile',profile) self.profile=profile
def SetProfile(self): print files_scanned = 0 profiles = [] for p in self.GetModules(): if p.type == p.MODULE_PROFILE: profiles.append(p.id) max_bif = len(profiles) tmp = self.get_profile_list().get_list() tmp.sort() profiles.extend(tmp) profile = BasicMenu("profile", profiles).get() if not profile: print "Profile not changed" else: bldreg.set_value('build', 'profile', profile) self.profile = profile
def __init__(self): self.bif_data_cache = None ## remember the working directory so the build ## system doesn't get confused by keyboard interrupts self.working_path = os.getcwd() self.cvs_tag = bldreg.get_value_default('build', 'cvs_tag', "") self.cvs_date = bldreg.get_value_default('build', 'cvs_date', "") ## default branch to build try: build_branch = os.environ["BUILD_BRANCH"] except KeyError: build_branch = "helix" self.build_branch = bldreg.get_value_default("build", "branch", build_branch) ## get a list of possible build branches update = 1 if (bldreg.get("build", "last_cvs_date", None) == self.cvs_date and bldreg.get("build", "last_cvs_tag", None) == self.cvs_tag and bldreg.get("build", "last_branch", None) == self.build_branch): update = 2 self.branch_list = branchlist.BranchList(self.cvs_tag, self.cvs_date, update) self.profile_list = None ## Default command line self.history = bldreg.get_value_default('build', 'history', []) self.flags = bldreg.get_value_default('build', 'arguments', None) self.targets = bldreg.get_value_default('build', 'targets', None) self.profile = bldreg.get_value_default('build', 'profile', None) if not self.profile or not self.targets or self.flags == None: bif_data = self.GetBIF() if not bif_data: ## An old branch self.build_branch = "RealMedia" bif_data = self.GetBIF() if not bif_data: branches = self.branch_list.get_list() if not branches: print "No BIF branches found, please configure your .buildrc!" sys.exit(1) self.build_branch = branches[0] bif_data = self.GetBIF() if not bif_data: print "No BIF files found, please configure your .buildrc!" sys.exit(1) if not self.profile: self.profile = bif_data.default_profile if not self.profile: self.profile = "default" bldreg.set_value('build', 'profile', self.profile) if not self.targets: self.targets = string.split(bif_data.default_target) if not self.targets: self.targets = ["splay"] bldreg.set_value('build', 'targets', self.targets) if self.flags == None: self.flags = [] flags = string.split(bif_data.default_options) for flag in flags: flag = "-t" + flag if flag not in self.flags: self.flags.append(flag) bldreg.set_value('build', 'arguments', self.flags) if not self.profile: self.profile = "default" self.menu = [ (self.BIFMenuOption, self.SetBIFBranch), (self.TargetMenuOption, self.SetTarget), (self.ProfileMenuOption, self.SetProfile), (self.BuildMenuOption, self.Build), ("Toggle make depend & makefiles (-e -n)", self.Toggle, "-e", "-n"), ("Toggle release (-trelease)", self.Toggle, "-trelease"), ("Toggle 'make clean' (-c)", self.Toggle, "-c"), ("Toggle clobber (Dangerous!) (-C)", self.Toggle, "-C"), ("Toggle halt-on-error (-p green)", self.Toggle, "-p", "green"), ("Toggle verbose mode (-v)", self.Toggle, "-v"), ("Toggle static build (-tnodll)", self.Toggle, "-tnodll"), ("Checkout source for selected target now", self.CheckoutSource), (self.TagMenuOption, self.SetTag), ("Help Page (full help in build/doc/index.html)", self.Help) ]
def __init__(self, bif_data, target_list): self.bif_data = bif_data if type(target_list) == types.StringType: self.target_list = [target_list] elif type(target_list) == types.ListType: self.target_list = target_list self.defines = {} ## This could potentially be a very very heavy calculation ## Luckily, the normal case only takes one or two iterations while 1: num_defines = -1 while len(self.defines) > num_defines: num_defines = len(self.defines) tmp = self.target_list[:] ## Include "always" modules for (modid, module) in self.bif_data.module_hash.items(): if module.attributes.get("always", None): tmp.append(modid) self.module_list = self.compute_dependancy_list( tmp, self.chk_platform) # # Propagate the static_build attribute to dependant modules # This could be done once and for all above really... # No error checking should be needed since all dependancies # Have already been resolved once above. -Hubbe # ## This is actual dual mark-and-sweep procedure, ## once for static propagation, and once for dynamic ## propagation statics = [] # A list containing all static modules statics_done = {} # And a hash for fast lookups for module in self.module_list: if module.build_static_flag: statics_done[module] = 1 statics.append(module) # Magic trick, we append stuff to 'statics' from inside the loop # This way no recursion is needed. -Hubbe for module in statics: for depid in module.dependancy_id_list: depmod = self.bif_data.module_hash[depid] if not statics_done.has_key(depmod) \ and not depmod.build_dynamic_only_flag: statics.append(depmod) statics_done[depmod] = 1 dynamics = [] # A list containing all dynamic modules dynamics_done = {} # And a hash for fast lookups ## All targets are built dynamically by default for modid in self.target_list: module = self.bif_data.module_hash[modid] if not module.build_static_only_flag: dynamics_done[module] = 1 dynamics.append(module) ## All dynamic_only modules are built dynamically for module in self.module_list: if module.build_dynamic_only_flag: dynamics_done[module] = 1 dynamics.append(module) # Magic trick, we append stuff to 'dynamics' from inside the loop # This way no recursion is needed. -Hubbe for module in dynamics: for depid in module.dependancy_id_list: depmod = self.bif_data.module_hash[depid] if not dynamics_done.has_key(depmod) \ and not depmod.build_static_only_flag: dynamics.append(depmod) dynamics_done[depmod] = 1 for module in self.module_list: if statics_done.get(module): if dynamics_done.get(module): module.set_build_static() else: module.set_build_static_only() ## Read all defines in these modules ## If new defines are found since last iteration, start from top ## This could be really really really slow if we're unlucky. self.defines = {} for module in self.module_list: for d in module.defines.keys(): self.defines[d] = module.defines[d] # Find any source_dependancies which are not already # in the list of modules and mark them as nobuild and # add them to the list of modules. modules_done = {} for module in self.module_list: modules_done[module] = 1 module.source_dep_only = 0 module.checkin_dep_only = 0 ## Source dependencies do *not* add defines ## Same for checkout dependencies for module in self.module_list: if module.checkin_dep_only: continue for sourcedep in module.source_dependancy_id_list: sdep_module = self.bif_data.module_hash[sourcedep] if not modules_done.has_key(sdep_module): sdep_module.source_dep_only = 1 self.module_list.append(sdep_module) modules_done[sdep_module] = 1 if module.source_dep_only: continue for cidep in module.checkin_dependancy_id_list: cidep_module = self.bif_data.module_hash[cidep] if not modules_done.has_key(cidep_module): cidep_module.checkin_dep_only = 1 cidep_module.source_dep_only = 1 self.module_list.append(cidep_module) modules_done[cidep_module] = 1 ## Check for missing SDKs, if additional ## dependencies were added, iterate again if not self.check_sdks_pass1(): break #print "SDK DEP ADDED, GO FISH!!! (%d)" % len(self.module_list) ## Now that we have figured out all dependencies ## we can do the required modifications bldreg.set_value("build", "defines", self.defines) for module in self.module_list: if module.source_dep_only: module.no_build_flag = 1 self.check_sdks_pass2() self.check_duplicates()
def __init__(self, bif_data, target_list): self.bif_data = bif_data if type(target_list) == types.StringType: self.target_list = [target_list] elif type(target_list) == types.ListType: self.target_list = target_list self.defines = {} ## This could potentially be a very very heavy calculation ## Luckily, the normal case only takes one or two iterations while 1: num_defines=-1 while len(self.defines) > num_defines: num_defines = len(self.defines) tmp=self.target_list[:] ## Include "always" modules for (modid, module) in self.bif_data.module_hash.items(): if module.attributes.get("always",None): tmp.append(modid) self.module_list = self.compute_dependancy_list(tmp, self.chk_platform) # # Propagate the static_build attribute to dependant modules # This could be done once and for all above really... # No error checking should be needed since all dependancies # Have already been resolved once above. -Hubbe # ## This is actual dual mark-and-sweep procedure, ## once for static propagation, and once for dynamic ## propagation statics = [] # A list containing all static modules statics_done = {} # And a hash for fast lookups for module in self.module_list: if module.build_static_flag: statics_done[module] = 1 statics.append(module) # Magic trick, we append stuff to 'statics' from inside the loop # This way no recursion is needed. -Hubbe for module in statics: for depid in module.dependancy_id_list: depmod = self.bif_data.module_hash[depid] if not statics_done.has_key(depmod) \ and not depmod.build_dynamic_only_flag: statics.append(depmod) statics_done[depmod] = 1 dynamics = [] # A list containing all dynamic modules dynamics_done = {} # And a hash for fast lookups ## All targets are built dynamically by default for modid in self.target_list: module=self.bif_data.module_hash[modid] if not module.build_static_only_flag: dynamics_done[module] = 1 dynamics.append(module) ## All dynamic_only modules are built dynamically for module in self.module_list: if module.build_dynamic_only_flag: dynamics_done[module] = 1 dynamics.append(module) # Magic trick, we append stuff to 'dynamics' from inside the loop # This way no recursion is needed. -Hubbe for module in dynamics: for depid in module.dependancy_id_list: depmod = self.bif_data.module_hash[depid] if not dynamics_done.has_key(depmod) \ and not depmod.build_static_only_flag: dynamics.append(depmod) dynamics_done[depmod] = 1 for module in self.module_list: if statics_done.get(module): if dynamics_done.get(module): module.set_build_static() else: module.set_build_static_only() ## Read all defines in these modules ## If new defines are found since last iteration, start from top ## This could be really really really slow if we're unlucky. self.defines = {} for module in self.module_list: for d in module.defines.keys(): self.defines[d]=module.defines[d] # Find any source_dependancies which are not already # in the list of modules and mark them as nobuild and # add them to the list of modules. modules_done = {} for module in self.module_list: modules_done[module]=1 module.source_dep_only=0 module.checkin_dep_only=0 ## Source dependencies do *not* add defines ## Same for checkout dependencies for module in self.module_list: if module.checkin_dep_only: continue for sourcedep in module.source_dependancy_id_list: sdep_module = self.bif_data.module_hash[sourcedep] if not modules_done.has_key(sdep_module): sdep_module.source_dep_only = 1 self.module_list.append(sdep_module) modules_done[sdep_module]=1 if module.source_dep_only: continue for cidep in module.checkin_dependancy_id_list: cidep_module = self.bif_data.module_hash[cidep] if not modules_done.has_key(cidep_module): cidep_module.checkin_dep_only = 1 cidep_module.source_dep_only = 1 self.module_list.append(cidep_module) modules_done[cidep_module]=1 ## Check for missing SDKs, if additional ## dependencies were added, iterate again if not self.check_sdks_pass1(): break #print "SDK DEP ADDED, GO FISH!!! (%d)" % len(self.module_list) ## Now that we have figured out all dependencies ## we can do the required modifications bldreg.set_value("build","defines",self.defines) for module in self.module_list: if module.source_dep_only: module.no_build_flag=1 self.check_sdks_pass2() self.check_duplicates()
def __init__(self): self.bif_data_cache=None ## remember the working directory so the build ## system doesn't get confused by keyboard interrupts self.working_path = os.getcwd() self.cvs_tag = bldreg.get_value_default('build','cvs_tag',"") self.cvs_date = bldreg.get_value_default('build','cvs_date',"") ## default branch to build try: build_branch = os.environ["BUILD_BRANCH"] except KeyError: build_branch = "helix" self.build_branch = bldreg.get_value_default( "build", "branch", build_branch) ## get a list of possible build branches update=1 if ( bldreg.get("build","last_cvs_date",None) == self.cvs_date and bldreg.get("build","last_cvs_tag",None) == self.cvs_tag and bldreg.get("build","last_branch",None) == self.build_branch): update=2 self.branch_list = branchlist.BranchList(self.cvs_tag, self.cvs_date, update) self.profile_list = None ## Default command line self.history = bldreg.get_value_default('build','history', []) self.flags = bldreg.get_value_default('build', 'arguments', None) self.targets = bldreg.get_value_default('build', 'targets', None) self.profile = bldreg.get_value_default('build','profile', None) if not self.profile or not self.targets or self.flags == None: bif_data = self.GetBIF() if not bif_data: ## An old branch self.build_branch = "RealMedia" bif_data = self.GetBIF() if not bif_data: branches = self.branch_list.get_list() if not branches: print "No BIF branches found, please configure your .buildrc!" sys.exit(1) self.build_branch=branches[0] bif_data = self.GetBIF() if not bif_data: print "No BIF files found, please configure your .buildrc!" sys.exit(1) if not self.profile: self.profile = bif_data.default_profile if not self.profile: self.profile = "default" bldreg.set_value('build','profile',self.profile) if not self.targets: self.targets = string.split(bif_data.default_target) if not self.targets: self.targets = [ "splay" ] bldreg.set_value('build','targets',self.targets) if self.flags == None: self.flags = [] flags = string.split(bif_data.default_options) for flag in flags: flag = "-t"+flag if flag not in self.flags: self.flags.append(flag) bldreg.set_value('build','arguments',self.flags) if not self.profile: self.profile="default" self.menu = [ (self.BIFMenuOption, self.SetBIFBranch), (self.TargetMenuOption, self.SetTarget), (self.ProfileMenuOption, self.SetProfile), (self.BuildMenuOption, self.Build), ("Toggle make depend & makefiles (-e -n)", self.Toggle, "-e","-n"), ("Toggle release (-trelease)", self.Toggle, "-trelease"), ("Toggle 'make clean' (-c)", self.Toggle, "-c"), ("Toggle clobber (Dangerous!) (-C)", self.Toggle, "-C"), ("Toggle halt-on-error (-p green)", self.Toggle, "-p","green"), ("Toggle verbose mode (-v)", self.Toggle, "-v"), ("Toggle static build (-tnodll)", self.Toggle, "-tnodll"), ("Checkout source for selected target now", self.CheckoutSource), (self.TagMenuOption, self.SetTag), ("Help Page (full help in build/doc/index.html)", self.Help)]
def SetPath(sdk_name, path): """Set the path to a named SDK""" if not os.path.isabs(path): path = os.path.join(os.getcwd(), path) bldreg.set_value("sdk", string.lower(sdk_name), path)