def download_pom(self, artifact): if artifact in self.pom_not_found_cache: return None if artifact in self.pom_cache: return self.pom_cache[artifact] if artifact.is_snapshot(): snapshot_info = self.get_snapshot_info(artifact) if snapshot_info is not None: ts, bn = snapshot_info artifact.timestamp = ts artifact.build_number = bn maven_path = self.get_artifact_uri(artifact, 'pom') try: logger.info('[Checking] pom file %s' % maven_path) data = download_string(maven_path) # # cache self.pom_cache[artifact] = data return data except DownloadException: self.pom_not_found_cache.append(artifact) logger.info('[Skipped] Pom file not found at %s' % maven_path) return None
def get_snapshot_info(self, artifact): metadata_path = self.get_metadata_path(artifact) try: data = download_string(metadata_path) eletree = ElementTree.fromstring(data) timestamp = eletree.findtext('versioning/snapshot/timestamp') build_number = eletree.findtext('versioning/snapshot/buildNumber') return (timestamp, build_number) except DownloadException: return None
def fetch_checksum(self, artifact, checksum_type='sha1'): """ return pre calculated checksum value, only avaiable for remote repos """ assert checksum_type in ['sha1', 'md5'] checksum_url = '%s/%s.%s' % (self.uri.strip('/'), artifact.maven_name(), checksum_type) try: data = download_string(checksum_url) return data except DownloadException: return None