Ejemplo n.º 1
0
    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
Ejemplo n.º 2
0
 def download_check_sum(self, checksum_type, origin_file_name):
     """
     return pre calculated checksum value, only avaiable for remote repos
     """
     checksum_url = origin_file_name + "." + checksum_type
     try:
         data = download_string(checksum_url)
         return data
     except DownloadException:
         return None
Ejemplo n.º 3
0
    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