def get_bundle_record(bundle_path, product_names, DVD_names): msb_xml = os.path.join(bundle_path, 'MSB_Summary.xml') soup = BeautifulSoup(open(msb_xml).read()) # obtain lvVersion and lvAPIVersion from buildInfo.txt of # LabVIEW distribution lv_tag = soup.find(attrs={'name': re.compile('^LabVIEW')}) lv_path = lv_tag.find('volume')['path'] lv_build_info_path = os.path.join(lv_path, 'buildInfo.txt') lv_info = get_lv_info(lv_build_info_path) # obtain toolkit installer location and # safemode from toolkit installer toolkit_tag = soup.find(attrs={'name': re.compile('Toolkit$')}) toolkit_path = toolkit_tag.find('volume')['path'] record = installer.get_installer_record(toolkit_path, product_names) record.update(lv_info) record['bundle_path'] = bundle_path # obtain actual size and dedupe size actual_size = [] idea_size = [] for name in DVD_names: abs_path = os.path.join(bundle_path, name) total_size = getdirsize(abs_path) deduped_size = get_deduped_size(abs_path) actual_size.append(str(total_size)) idea_size.append(str(total_size - deduped_size)) record['actual_size'] = '/'.join(actual_size) record['idea_size'] = '/'.join(idea_size) return record
def get_installer_record(installer_path, product_names): record = {} lv_info = get_lv_info(os.path.join(installer_path, 'buildInfo.txt')) record.update(lv_info) msi_path = os.path.join(installer_path, r'Products\NI-RIO_cRIO_Firmware_RT\cRIO_Firmware.msi') safemodes = get_versions_from_msi(msi_path, product_names) safemode_str = reduce(lambda ret_str, product_name: ret_str + r'/' + safemodes[product_name], product_names[1:], safemodes[product_names[0]]) record['safemode'] = safemode_str record['installer_path'] = installer_path return record
def construct_record_dict(stackUrl): stackRecord = {} stackRecord['stackUrl'] = stackUrl stackName = stackUrl.split('/')[-1].replace('+',' ') stackRecord['Validated Stack'] = stackName installerLocationDict = extract_installer_locations(stackUrl) # Get the LabVIEW infomation(i.e. lvVersion and lvAPIVersion) configFilePath = os.path.join(installerLocationDict['LV_Core'], 'buildInfo.txt') lvInfoDict = get_lv_info(configFilePath) stackRecord.update(lvInfoDict) # Get the myRIO/roboRIO safemode version from NIRIO msi file rioPath = installerLocationDict['cRIO'] msiPath = os.path.join(rioPath,r'Products\NI-RIO_cRIO_Firmware_RT\cRIO_Firmware.msi') productNames = ('myRIO-1900','myRIO-1950','roboRIO') safemodeVersionDict = get_versions_from_msi(msiPath,productNames) stackRecord['Safemode'] = safemodeVersionDict['myRIO-1900']+'/'+safemodeVersionDict['roboRIO'] return stackRecord