Ejemplo n.º 1
0
    def execute(self, args):
        if not os.path.isdir(args.root_directory):
            message = '"%s" is not a valid directory from within %s' % (args.root_directory, os.getcwd())
            raise Exception(message)

        repository = LocalAptRepository(args.root_directory)
        repository.build_index_files()
Ejemplo n.º 2
0
    def creation_of_directory(self, fixture):
        package = fixture.package
        repository = fixture.repository

        # Case: when a repository is made the first time, it creates its root_directory
        vassert(os.path.isdir(repository.root_directory))
        repository.upload(package, [])
        vassert(repository.is_uploaded(package))

        # Case: when a repository is made a second time, it preserves the underlying directory
        repository2 = LocalAptRepository(repository.root_directory)
        vassert(repository.is_uploaded(package))
        vassert(repository2.is_uploaded(package))
Ejemplo n.º 3
0
def test_creation_of_directory(local_apt_repository_fixture):
    fixture = local_apt_repository_fixture
    package = fixture.package
    repository = fixture.repository

    # Case: when a repository is made the first time, it creates its root_directory
    assert os.path.isdir(repository.root_directory)
    repository.upload(package, [])
    assert repository.is_uploaded(package)

    # Case: when a repository is made a second time, it preserves the underlying directory
    repository2 = LocalAptRepository(repository.root_directory)
    assert repository.is_uploaded(package)
    assert repository2.is_uploaded(package)
Ejemplo n.º 4
0
    def execute(self, options, args):
        root_directory = None
        if args:
            root_directory = args[0]
        else:
            raise Exception('No root_directory specified')

        if not os.path.isdir(root_directory):
            message = '"%s" is not a valid directory from within %s' % (
                root_directory, os.getcwd())
            raise Exception(message)

        repository = LocalAptRepository(root_directory)
        repository.build_index_files()
Ejemplo n.º 5
0
 def new_repository(self):
     return LocalAptRepository(
         os.path.join(self.repository_directory.name, 'repo'))