def process_packages(self, report_errors=False): """Gets a list of updates to process. Adds the name of an update to the version file if not already present. Processes all packages. Updates the version file meta-data. Then writes version file back to disk. """ if self.data_dir is None: raise PackageHandlerError('Must init first.', expected=True) pkg_manifest, patch_manifest = self._get_package_list(report_errors) patches = self._make_patches(patch_manifest) self._cleanup(patch_manifest) pkg_manifest = self._add_patches_to_packages(pkg_manifest, patches) self.json_data = self._update_version_file(self.json_data, pkg_manifest) self._write_json_to_file(self.json_data) self._write_config_to_file(self.config) self._move_packages(pkg_manifest)
def parse_platform(name): """Parses platfrom name from given string Args: name (str): Name to be parsed Returns: (str): Platform name """ log.debug('Parsing "%s" for platform info', name) try: re_str = r'-(?P<platform>arm[6]?[4]|mac|nix[6]?[4]?|win)-' data = re.compile(re_str).search(name) platform_name = data.groupdict()['platform'] log.debug('Platform name is: %s', platform_name) except AttributeError: raise PackageHandlerError('Could not parse platform from filename') return platform_name