def _loadArtifactSources(self, artifactSources, filePath):
     for source in artifactSources:
         if not 'type' in source:
             logging.error("Source doesn't have type.\n %s", str(source))
             sys.exit(1)
         if source['type'] == 'mead-tag':
             source[
                 'included-gav-patterns'] = self._loadFlatFileBySourceParameter(
                     source, 'included-gav-patterns-ref', filePath)
         elif source['type'] == 'dependency-list':
             if 'recursive' in source:
                 source['recursive'] = maven_repo_util.str2bool(
                     source['recursive'])
             if 'skip-missing' in source:
                 source['skip-missing'] = maven_repo_util.str2bool(
                     source['skip-missing'])
             source['repo-url'] = self._getRepoUrl(source)
             source['top-level-gavs'] = self._loadFlatFileBySourceParameter(
                 source, 'top-level-gavs-ref', filePath)
         elif source['type'] == 'repository':
             source['repo-url'] = self._getRepoUrl(source)
             source[
                 'included-gav-patterns'] = self._loadFlatFileBySourceParameter(
                     source, 'included-gav-patterns-ref', filePath)
         self.artifactSources.append(source)
    def _loadArtifactSources(self, artifactSources, filePath):
        for source in artifactSources:
            if not 'type' in source:
                logging.error("Source doesn't have type.\n %s", str(source))
                sys.exit(1)

            if source['type'] == 'mead-tag':
                source['included-gav-patterns'] = self._loadFlatFileBySourceParameter(source,
                        'included-gav-patterns-ref', filePath)

            elif source['type'] == 'dependency-list':
                if 'recursive' in source:
                    source['recursive'] = maven_repo_util.str2bool(source['recursive'])
                if 'skip-missing' in source:
                    source['skip-missing'] = maven_repo_util.str2bool(source['skip-missing'])
                source['repo-url'] = self._getRepoUrl(source)
                source['top-level-gavs'] = self._loadFlatFileBySourceParameter(source, 'top-level-gavs-ref',
                        filePath)

            elif source['type'] == 'dependency-graph':
                source['top-level-gavs'] = self._loadFlatFileBySourceParameter(source, 'top-level-gavs-ref',
                        filePath)

            elif source['type'] == 'repository':
                source['repo-url'] = self._getRepoUrl(source)
                source['included-gav-patterns'] = self._loadFlatFileBySourceParameter(source,
                        'included-gav-patterns-ref', filePath)

            self.artifactSources.append(source)
Exemple #3
0
    def _loadArtifactSources(self, artifactSources, filePath):
        for source in artifactSources:
            if not 'type' in source:
                logging.error("Source doesn't have type.\n %s", str(source))
                sys.exit(1)

            if source['type'] == 'mead-tag':
                source[
                    'included-gav-patterns'] = self._loadFlatFileBySourceParameter(
                        source, 'included-gav-patterns-ref', filePath)

            elif source['type'] == 'dependency-list':
                if 'recursive' in source:
                    source['recursive'] = maven_repo_util.str2bool(
                        source['recursive'])
                if 'skip-missing' in source:
                    source['skip-missing'] = maven_repo_util.str2bool(
                        source['skip-missing'])
                source['repo-url'] = self._getRepoUrl(source)
                source['top-level-gavs'] = self._loadFlatFileBySourceParameter(
                    source, 'top-level-gavs-ref', filePath)

            elif source['type'] == 'dependency-graph':
                source['top-level-gavs'] = self._loadFlatFileBySourceParameter(
                    source, 'top-level-gavs-ref', filePath)
                excluded_subgraphs = self._loadFlatFileBySourceParameter(
                    source, 'excluded-subgraphs-ref', filePath)
                if 'excluded-subgraphs' in source:
                    if isinstance(source['excluded-subgraphs'], basestring):
                        excluded_subgraphs.append(source['excluded-subgraphs'])
                    else:
                        excluded_subgraphs.extend(source['excluded-subgraphs'])
                source['excluded-subgraphs'] = excluded_subgraphs

            elif source['type'] == 'repository':
                source['repo-url'] = self._getRepoUrl(source)
                source[
                    'included-gav-patterns'] = self._loadFlatFileBySourceParameter(
                        source, 'included-gav-patterns-ref', filePath)
                source[
                    'included-gatcvs'] = self._loadArtifactFileBySourceParameter(
                        source, 'included-gatcvs-ref', filePath)

            source["excludedGAVs"] = []
            if 'excluded-gav-patterns-ref' in source:
                for filename in source['excluded-gav-patterns-ref']:
                    relFilename = self._getRelativeFilename(filename, filePath)
                    source["excludedGAVs"].extend(
                        maven_repo_util.loadFlatFile(relFilename))

            self.artifactSources.append(source)
    def _loadFromFile(self, filename, rewrite=True):
        """ Load confiugration from json config file. """
        logging.debug("Loading configuration file %s", filename)
        data = json.load(open(filename))

        if 'include-high-priority' in data and data['include-high-priority']:
            self._loadFromFile(data['include-high-priority'], True)

        if (rewrite or self.resultRepoName is None) and 'result-repo-name' in data:
            self.resultRepoName = data['result-repo-name']

        if (rewrite or self.singleVersion is None) and 'single-version' in data:
            self.singleVersion = maven_repo_util.str2bool(data['single-version'])

        if 'artifact-sources' in data:
            self._loadArtifactSources(data['artifact-sources'])

        if 'excluded-gav-patterns-ref' in data:
            for filename in data['excluded-gav-patterns-ref']:
                self.excludedGAVs.extend(self._loadFlatFile(filename))

        if 'excluded-repositories' in data:
            self.excludedRepositories.extend(data['excluded-repositories'])

        if 'multi-version-ga-patterns-ref' in data:
            for filename in data['multi-version-ga-patterns-ref']:
                self.multiVersionGAs.extend(self._loadFlatFile(filename))

        if 'multi-version-ga-patterns' in data:
            self.multiVersionGAs.extend(data['multi-version-ga-patterns'])

        if 'include-low-priority' in data and data['include-low-priority']:
            self._loadFromFile(data['include-low-priority'], False)
    def _loadArtifactSources(self, artifactSources, filePath):
        for source in artifactSources:
            if not 'type' in source:
                logging.error("Source doesn't have type.\n %s", str(source))
                sys.exit(1)

            if source['type'] == 'mead-tag':
                source['included-gav-patterns'] = self._loadFlatFileBySourceParameter(source,
                        'included-gav-patterns-ref', filePath)

            elif source['type'] == 'dependency-list':
                if 'recursive' in source:
                    source['recursive'] = maven_repo_util.str2bool(source['recursive'])
                if 'skip-missing' in source:
                    source['skip-missing'] = maven_repo_util.str2bool(source['skip-missing'])
                source['repo-url'] = self._getRepoUrl(source)
                source['top-level-gavs'] = self._loadFlatFileBySourceParameter(source, 'top-level-gavs-ref',
                                                                               filePath)

            elif source['type'] == 'dependency-graph':
                source['top-level-gavs'] = self._loadFlatFileBySourceParameter(source, 'top-level-gavs-ref',
                                                                               filePath)
                excluded_subgraphs = self._loadFlatFileBySourceParameter(source, 'excluded-subgraphs-ref',
                                                                         filePath)
                if 'excluded-subgraphs' in source:
                    if isinstance(source['excluded-subgraphs'], basestring):
                        excluded_subgraphs.append(source['excluded-subgraphs'])
                    else:
                        excluded_subgraphs.extend(source['excluded-subgraphs'])
                source['excluded-subgraphs'] = excluded_subgraphs

            elif source['type'] == 'repository':
                source['repo-url'] = self._getRepoUrl(source)
                source['included-gav-patterns'] = self._loadFlatFileBySourceParameter(source,
                                                                                      'included-gav-patterns-ref',
                                                                                      filePath)
                source['included-gatcvs'] = self._loadArtifactFileBySourceParameter(source, 'included-gatcvs-ref',
                                                                                    filePath)

            source["excludedGAVs"] = []
            if 'excluded-gav-patterns-ref' in source:
                for filename in source['excluded-gav-patterns-ref']:
                    relFilename = self._getRelativeFilename(filename, filePath)
                    source["excludedGAVs"].extend(maven_repo_util.loadFlatFile(relFilename))

            self.artifactSources.append(source)
 def _loadArtifactSources(self, artifactSources, filePath):
     for source in artifactSources:
         if not "type" in source:
             logging.error("Source doesn't have type.\n %s", str(source))
             sys.exit(1)
         if source["type"] == "mead-tag":
             source["included-gav-patterns"] = self._loadFlatFileBySourceParameter(
                 source, "included-gav-patterns-ref", filePath
             )
         elif source["type"] == "dependency-list":
             if "recursive" in source:
                 source["recursive"] = maven_repo_util.str2bool(source["recursive"])
             if "skip-missing" in source:
                 source["skip-missing"] = maven_repo_util.str2bool(source["skip-missing"])
             source["repo-url"] = self._getRepoUrl(source)
             source["top-level-gavs"] = self._loadFlatFileBySourceParameter(source, "top-level-gavs-ref", filePath)
         elif source["type"] == "repository":
             source["repo-url"] = self._getRepoUrl(source)
             source["included-gav-patterns"] = self._loadFlatFileBySourceParameter(
                 source, "included-gav-patterns-ref", filePath
             )
         self.artifactSources.append(source)
Exemple #7
0
    def _loadFromFile(self, filename, rewrite=True):
        """ Load configuration from json config file. """
        logging.debug("Loading configuration file %s", filename)
        if filename in self._configFiles:
            raise Exception(
                "Config file '%s' is already included." % filename +
                " Check your config files for circular inclusions.")
        self._configFiles.add(filename)
        data = json.load(open(filename))

        filePath = os.path.dirname(filename)
        if filePath:
            filePath += '/'

        if 'include-high-priority' in data and data['include-high-priority']:
            inclFile = self._getRelativeFilename(data['include-high-priority'],
                                                 filePath)
            self._loadFromFile(inclFile, True)

        if (rewrite
                or self.singleVersion is None) and 'single-version' in data:
            self.singleVersion = maven_repo_util.str2bool(
                data['single-version'])

        if 'artifact-sources' in data:
            self._loadArtifactSources(data['artifact-sources'], filePath)

        if 'excluded-gav-patterns-ref' in data:
            for filename in data['excluded-gav-patterns-ref']:
                relFilename = self._getRelativeFilename(filename, filePath)
                self.excludedGAVs.extend(
                    maven_repo_util.loadFlatFile(relFilename))

        if 'excluded-repositories' in data:
            self.excludedRepositories.extend(data['excluded-repositories'])

        if 'multi-version-ga-patterns-ref' in data:
            for filename in data['multi-version-ga-patterns-ref']:
                relFilename = self._getRelativeFilename(filename, filePath)
                self.multiVersionGAs.extend(
                    maven_repo_util.loadFlatFile(relFilename))

        if 'multi-version-ga-patterns' in data:
            self.multiVersionGAs.extend(data['multi-version-ga-patterns'])

        if 'include-low-priority' in data and data['include-low-priority']:
            inclFile = self._getRelativeFilename(data['include-low-priority'],
                                                 filePath)
            self._loadFromFile(inclFile, False)
    def _loadFromFile(self, filename, rewrite=True):
        """ Load confiugration from json config file. """
        logging.debug("Loading configuration file %s", filename)
        if filename in self._configFiles:
            raise Exception(
                "Config file '%s' is already included." % filename + " Check your config files for circular inclusions."
            )
        self._configFiles.add(filename)
        data = json.load(open(filename))

        filePath = os.path.dirname(filename)
        if filePath:
            filePath += "/"

        if "include-high-priority" in data and data["include-high-priority"]:
            inclFile = self._getRelativeFilename(data["include-high-priority"], filePath)
            self._loadFromFile(inclFile, True)

        if (rewrite or self.singleVersion is None) and "single-version" in data:
            self.singleVersion = maven_repo_util.str2bool(data["single-version"])

        if "artifact-sources" in data:
            self._loadArtifactSources(data["artifact-sources"], filePath)

        if "excluded-gav-patterns-ref" in data:
            for filename in data["excluded-gav-patterns-ref"]:
                relFilename = self._getRelativeFilename(filename, filePath)
                self.excludedGAVs.extend(self._loadFlatFile(relFilename))

        if "excluded-repositories" in data:
            self.excludedRepositories.extend(data["excluded-repositories"])

        if "multi-version-ga-patterns-ref" in data:
            for filename in data["multi-version-ga-patterns-ref"]:
                relFilename = self._getRelativeFilename(filename, filePath)
                self.multiVersionGAs.extend(self._loadFlatFile(relFilename))

        if "multi-version-ga-patterns" in data:
            self.multiVersionGAs.extend(data["multi-version-ga-patterns"])

        if "include-low-priority" in data and data["include-low-priority"]:
            inclFile = self._getRelativeFilename(data["include-low-priority"], filePath)
            self._loadFromFile(inclFile, False)