- def end_config(self):
- pass
-
- def start_product(self, attrs):
- if not attrs.get('name', '').strip(): return
- if check_bool(attrs.get('disable', 'false')): return
- aProduct = Product(attrs.get('name'),
- attrs.get('type', None),
- attrs.get('version', None),
- attrs.get('install', None),
- attrs.get('supported', None),
- attrs.get('dependancies', None),
- attrs.get('installdiskspace', None),
- attrs.get('temporarydiskspace', None),
- attrs.get('script', None),
- attrs.get('pickupenv', None))
- if self.is_force_src:
- aProduct.setMode(__TAG__SOURCES__)
- self.products.append(aProduct)
+ def parse_dependencies(self):
+ # Parse 'dependencies' part of the XML file
+ depsMap = {}
+ depsElem = self.docElem.getElementsByTagName('dependencies')[0]
+ for prodElem in depsElem.getElementsByTagName('product'):
+ prodName = prodElem.getAttribute('name').strip()
+ if not prodName: continue
+ depsList = []
+ for depElem in prodElem.getElementsByTagName('dep'):
+ depsList.append(depElem.firstChild.data)
+ pass
+ depsMap[prodName] = depsList
+ pass
+ return depsMap
+
+ def parse_product(self):
+ # Parse 'products' part of the XML file
+ depsMap = self.parse_dependencies()
+ prodsElem = self.docElem.getElementsByTagName('products')[0]
+ sal_prods_list = []; req_prods_list = []
+ modules_list = []; prereqs_list = []
+ for prodElem in prodsElem.getElementsByTagName('product'):
+ prodName = prodElem.getAttribute('name').strip()
+ if not prodName: continue
+ instElems = prodElem.getElementsByTagName('installation')
+ instElem = None
+ for node in instElems:
+ if not self.pltname or self.pltname == node.getAttribute('os').strip():
+ instElem = node
+ break
+ pass
+ if not instElem: continue
+ if check_bool(str(instElem.getAttribute('disable').strip())): continue
+ depsList = []
+ if prodName in depsMap: depsList = depsMap[prodName]
+ aProduct = Product(prodName,
+ prodElem.getAttribute('type').strip(),
+ instElem.getAttribute('os').strip(),
+ instElem.getAttribute('version').strip(),
+ depsList,
+ instElem.getAttribute('woguimode').strip(),
+ instElem.getAttribute('installdiskspace').strip(),
+ instElem.getAttribute('script').strip(),
+ instElem.getAttribute('pickupenv').strip())
+ if self.is_force_src:
+ aProduct.setMode(__BUILDSRC__)
+ pass
+ if prodElem.getAttribute('type').strip() == "component":
+ sal_prods_list.append(aProduct)
+ # fill an ordered modules list -----------
+ modules_list.append(prodName)
+ modules_list.append(prodName + "_src")
+ pass
+ else: #prerequisite
+ req_prods_list.append(aProduct)
+ # fill an ordered prerequisites list -----------
+ prereqs_list.append(prodName)
+ #AKL: prerequisite sources and temp files are removed, by default.
+ # So, there is no need to make sources environment
+ #if aProduct.whattodo == __BUILDSRC__: prereqs_list.append(prodName + "_src")
+ pass
+ pass
+ self.products.extend( req_prods_list )
+ self.products.extend( sal_prods_list )
+ if len(self.products) != 0:
+ gcc_product = Product("gcc",
+ __CTX__PREREQUISITE__,
+ self.products[0].os,
+ "",
+ [],
+ None,
+ "0,0,0",
+ "gcc-common.sh",
+ "")
+ gcc_product.setMode(__PREINSTALL__)
+ self.products.insert(0, gcc_product)
+ prereqs_list.insert(0, gcc_product.name)
+ pass
+ self.full_prods_list.extend( prereqs_list )
+ self.full_prods_list.extend( modules_list )