Beispiel #1
0
    def create_repository(self, connection, repository_data, arch):
        url = utils.normalize_repository_url(repository_data['uri'])
        suite = repository_data['suite']
        component = repository_data.get('section')
        path = repository_data.get('path')
        name = repository_data.get('name')
        origin = repository_data.get('origin')

        if component is None:
            raise ValueError("The flat format does not supported.")
        if isinstance(component, list):
            if len(component) != 1:
                raise ValueError("The only single component is acceptable.")
            component = component[0]

        repository = Repository(
            name=name,
            url=url,
            architecture=arch,
            origin=origin,
            section=(suite, component),
            path=path
        )
        self._create_repository_structure(repository)
        self.logger.info("Created: %d repository.", repository.name)
        return repository
Beispiel #2
0
    def get_repository(self, connection, repository_data, arch, consumer):
        url = utils.normalize_repository_url(repository_data['uri'])
        suite = repository_data['suite']
        components = repository_data.get('section')
        path = repository_data.get('path')
        name = repository_data.get('name')

        # TODO(bgaifullin) implement support for flat repisotory format [1]
        # [1] https://wiki.debian.org/RepositoryFormat#Flat_Repository_Format
        if components is None:
            raise ValueError("The flat format does not supported.")

        for component in components:
            release = self._get_url_of_metafile(
                (url, suite, component, arch), "Release"
            )
            try:
                deb_release = deb822.Release(connection.open_stream(release))
            except connection.HTTPError as e:
                if e.code != 404:
                    raise
                # some repositories does not contain release file
                deb_release = {"origin": ""}

            consumer(Repository(
                name=name,
                architecture=arch,
                origin=deb_release["origin"],
                url=url,
                section=(suite, component),
                path=path
            ))
    def create_repository(self, connection, repository_data, arch):
        url = utils.normalize_repository_url(repository_data['uri'])
        suite = repository_data['suite']
        component = repository_data.get('section')
        path = repository_data.get('path')
        name = repository_data.get('name')
        origin = repository_data.get('origin')

        if component is None:
            raise ValueError("The flat format does not supported.")
        if isinstance(component, list):
            if len(component) != 1:
                raise ValueError("The only single component is acceptable.")
            component = component[0]

        repository = Repository(name=name,
                                url=url,
                                architecture=arch,
                                origin=origin,
                                section=(suite, component),
                                path=path,
                                priority=self.get_priority(repository_data))
        self._create_repository_structure(repository)
        self.logger.info("Created: %s repository.", repository.name)
        return repository
    def get_repository(self, connection, repository_data, arch, consumer):
        url = utils.normalize_repository_url(repository_data['uri'])
        suite = repository_data['suite']
        components = repository_data.get('section')
        path = repository_data.get('path')
        name = repository_data.get('name')

        # TODO(bgaifullin) implement support for flat repisotory format [1]
        # [1] https://wiki.debian.org/RepositoryFormat#Flat_Repository_Format
        if components is None:
            raise ValueError("The flat format does not supported.")

        for component in components:
            release = self._get_url_of_metafile((url, suite, component, arch),
                                                "Release")
            try:
                deb_release = deb822.Release(connection.open_stream(release))
            except connection.HTTPError as e:
                if e.code != 404:
                    raise
                # some repositories does not contain release file
                deb_release = {"origin": ""}

            consumer(
                Repository(name=name,
                           architecture=arch,
                           origin=deb_release["origin"],
                           url=url,
                           section=(suite, component),
                           path=path,
                           priority=self.get_priority(repository_data)))
Beispiel #5
0
 def fork_repository(self, connection, repository, destination, options):
     # TODO(download gpk)
     # TODO(sources and locales)
     new_repo = copy.copy(repository)
     new_repo.url = utils.normalize_repository_url(destination)
     self._create_repository_structure(new_repo)
     return new_repo
 def fork_repository(self, connection, repository, destination, options):
     # TODO(download gpk)
     # TODO(sources and locales)
     new_repo = copy.copy(repository)
     new_repo.url = utils.normalize_repository_url(destination)
     self._create_repository_structure(new_repo)
     return new_repo
Beispiel #7
0
 def get_repository(self, connection, repository_data, arch, consumer):
     consumer(Repository(
         name=repository_data['name'],
         url=utils.normalize_repository_url(repository_data["uri"]),
         architecture=arch,
         origin=""
     ))
Beispiel #8
0
 def get_repository(self, connection, repository_data, arch, consumer):
     consumer(
         Repository(name=repository_data['name'],
                    url=utils.normalize_repository_url(
                        repository_data["uri"]),
                    architecture=arch,
                    path=repository_data.get('path'),
                    origin=""))
Beispiel #9
0
 def fork_repository(self, connection, repository, destination, options):
     # TODO(download gpk)
     # TODO(sources and locales)
     new_repo = copy.copy(repository)
     new_repo.url = utils.normalize_repository_url(destination)
     utils.ensure_dir_exist(destination)
     groupstree = self._load_groups(connection, repository)
     self._rebuild_repository(connection, new_repo, set(), groupstree)
     return new_repo
Beispiel #10
0
 def fork_repository(self, connection, repository, destination, options):
     # TODO(download gpk)
     # TODO(sources and locales)
     new_repo = copy.copy(repository)
     new_repo.url = utils.normalize_repository_url(destination)
     utils.ensure_dir_exist(destination)
     groupstree = self._load_groups(connection, repository)
     self._rebuild_repository(connection, new_repo, set(), groupstree)
     return new_repo
Beispiel #11
0
 def get_repository(self, connection, repository_data, arch, consumer):
     consumer(Repository(
         name=repository_data['name'],
         url=utils.normalize_repository_url(repository_data["uri"]),
         architecture=arch,
         path=repository_data.get('path'),
         origin="",
         priority=self.get_priority(repository_data)
     ))
Beispiel #12
0
 def create_repository(self, repository_data, arch):
     repository = Repository(
         name=repository_data['name'],
         url=utils.normalize_repository_url(repository_data["uri"]),
         architecture=arch,
         origin=repository_data.get('origin')
     )
     utils.ensure_dir_exist(utils.get_path_from_url(repository.url))
     return repository
Beispiel #13
0
 def fork_repository(self, connection, repository, destination,
                     source=False, locale=False):
     # TODO(download gpk)
     # TODO(sources and locales)
     new_repo = copy.copy(repository)
     new_repo.url = utils.normalize_repository_url(destination)
     utils.ensure_dir_exist(destination)
     self.add_packages(connection, new_repo, set())
     return new_repo
Beispiel #14
0
 def create_repository(self, connection, repository_data, arch):
     repository = Repository(name=repository_data['name'],
                             url=utils.normalize_repository_url(
                                 repository_data["uri"]),
                             architecture=arch,
                             path=repository_data.get('path'),
                             origin=repository_data.get('origin'))
     utils.ensure_dir_exist(utils.get_path_from_url(repository.url))
     self._rebuild_repository(connection, repository, None, None)
     return repository
Beispiel #15
0
 def create_repository(self, connection, repository_data, arch):
     repository = Repository(
         name=repository_data['name'],
         url=utils.normalize_repository_url(repository_data["uri"]),
         architecture=arch,
         path=repository_data.get('path'),
         origin=repository_data.get('origin')
     )
     utils.ensure_dir_exist(utils.get_path_from_url(repository.url))
     self._rebuild_repository(connection, repository, None, None)
     return repository