Ejemplo n.º 1
0
 def source_build(self, basedir, sourcedir):
     dbuild.docker_build(build_dir=basedir,
                         build_type='source',
                         source_dir=sourcedir,
                         build_owner=os.getuid(),
                         proxy=self.proxy,
                         no_default_sources=True,
                         include_timestamps=False)
Ejemplo n.º 2
0
 def source_build(self, basedir, sourcedir):
     dbuild.docker_build(build_dir=basedir,
                         build_type='source',
                         source_dir=sourcedir,
                         build_owner=os.getuid(),
                         proxy=self.proxy,
                         no_default_sources=True,
                         include_timestamps=False)
Ejemplo n.º 3
0
 def source_build(self, basedir, sourcedir):
     dbuild.docker_build(build_dir=basedir,
                         build_type='source',
                         source_dir=sourcedir,
                         build_owner=os.getuid(),
                         proxy=getattr(
                             settings,
                             'AASEMBLE_BUILDSVC_BUILDER_HTTP_PROXY',
                         ))
Ejemplo n.º 4
0
 def binary_build(self, basedir, parallel=1):
     dbuild.docker_build(build_dir=basedir,
                         build_type='binary',
                         build_owner=os.getuid(),
                         parallel=parallel,
                         proxy=getattr(
                             settings,
                             'AASEMBLE_BUILDSVC_BUILDER_HTTP_PROXY',
                         ))
Ejemplo n.º 5
0
 def docker_build_binary_package(self):
     """Build binary packages in docker"""
     with open(self.build_record.buildlog(), 'a+') as fp:
         try:
             stdout_orig = sys.stdout
             sys.stdout = fp
             dbuild.docker_build(build_dir=self.basedir,
                                 build_type='binary',
                                 build_owner=os.getuid())
         finally:
             sys.stdout = stdout_orig
Ejemplo n.º 6
0
    def binary_build(self, basedir, parallel=None):
        if parallel is None:
            parallel = self.parallel

        dbuild.docker_build(build_dir=basedir,
                            build_type='binary',
                            build_owner=os.getuid(),
                            parallel=parallel,
                            proxy=self.proxy,
                            no_default_sources=True,
                            include_timestamps=False)
Ejemplo n.º 7
0
 def docker_build_binary_package(self):
     """Build binary packages in docker"""
     with open(self.build_record.buildlog(), 'a+') as fp:
         try:
             stdout_orig = sys.stdout
             sys.stdout = fp
             dbuild.docker_build(build_dir=self.basedir,
                                 build_type='binary',
                                 build_owner=os.getuid())
         finally:
             sys.stdout = stdout_orig
Ejemplo n.º 8
0
    def binary_build(self, basedir, parallel=None):
        if parallel is None:
            parallel = self.parallel

        dbuild.docker_build(build_dir=basedir,
                            build_type='binary',
                            build_owner=os.getuid(),
                            parallel=parallel,
                            proxy=self.proxy,
                            no_default_sources=True,
                            include_timestamps=False)
Ejemplo n.º 9
0
 def test_build_failed_binary_build(self):
     tmpdir = tempfile.mkdtemp()
     try:
         shutil.copytree(os.path.join(os.path.dirname(__file__), 'test_data', 'pkg3'),
                         os.path.join(tmpdir, 'source'))
         dbuild.docker_build(tmpdir, build_type='source', build_owner=os.getuid())
         self.assertRaises(dbuild.exceptions.DbuildBinaryBuildFailedException,
                           dbuild.docker_build, tmpdir, build_type='binary',
                           force_rm=True, build_owner=os.getuid())
     finally:
         shutil.rmtree(tmpdir)
Ejemplo n.º 10
0
 def test_build_failed_binary_build(self):
     tmpdir = tempfile.mkdtemp()
     try:
         shutil.copytree(os.path.join(os.path.dirname(__file__), 'test_data', 'pkg3'),
                         os.path.join(tmpdir, 'source'))
         dbuild.docker_build(tmpdir, build_type='source', build_owner=os.getuid())
         self.assertRaises(dbuild.exceptions.DbuildBinaryBuildFailedException,
                           dbuild.docker_build, tmpdir, build_type='binary',
                           force_rm=True, build_owner=os.getuid())
     finally:
         shutil.rmtree(tmpdir)
Ejemplo n.º 11
0
 def test_build(self):
     tmpdir = tempfile.mkdtemp()
     try:
         shutil.copytree(os.path.join(os.path.dirname(__file__), 'test_data', 'pkg1'),
                         os.path.join(tmpdir, 'source'))
         dbuild.docker_build(tmpdir, build_type='source', build_owner=os.getuid())
         dbuild.docker_build(tmpdir, build_type='binary', build_owner=os.getuid())
         for f in ['buildsvctest_0.1.dsc', 'buildsvctest_0.1.tar.gz',
                   'buildsvctest_0.1_amd64.changes', 'buildsvctest_0.1_amd64.deb',
                   'buildsvctest_0.1_source.changes']:
             assert os.path.exists(os.path.join(tmpdir, f)), '{} was missing'.format(f)
     finally:
         shutil.rmtree(tmpdir)
Ejemplo n.º 12
0
 def docker_build_source_package(self):
     """Build source package in docker"""
     source_dir = os.path.basename(self.builddir)
     with open(self.build_record.buildlog(), 'a+') as fp:
         try:
             stdout_orig = sys.stdout
             sys.stdout = fp
             dbuild.docker_build(build_dir=self.basedir,
                                 build_type='source',
                                 source_dir=source_dir,
                                 build_owner=os.getuid())
         finally:
             sys.stdout = stdout_orig
Ejemplo n.º 13
0
 def docker_build_source_package(self):
     """Build source package in docker"""
     source_dir = os.path.basename(self.builddir)
     with open(self.build_record.buildlog(), 'a+') as fp:
         try:
             stdout_orig = sys.stdout
             sys.stdout = fp
             dbuild.docker_build(build_dir=self.basedir,
                                 build_type='source',
                                 source_dir=source_dir,
                                 build_owner=os.getuid())
         finally:
             sys.stdout = stdout_orig
Ejemplo n.º 14
0
 def docker_build_source_package(self):
     """Build source package in docker"""
     source_dir = os.path.basename(self.builddir)
     with open(self.build_record.buildlog(), 'a+') as fp:
         try:
             stdout_orig = sys.stdout
             sys.stdout = fp
             dbuild.docker_build(build_dir=self.basedir,
                                 build_type='source',
                                 source_dir=source_dir,
                                 build_owner=os.getuid(),
                                 proxy=settings.AASEMBLE_BUILDSVC_BUILDER_HTTP_PROXY)
         finally:
             sys.stdout = stdout_orig
Ejemplo n.º 15
0
 def docker_build_binary_package(self):
     """Build binary packages in docker"""
     parallel = self.get_build_config().get('parallel',
                                            getattr(settings, 'AASEMBLE_BUILDSVC_DEFAULT_PARALLEL', 1))
     with open(self.build_record.buildlog(), 'a+') as fp:
         try:
             stdout_orig = sys.stdout
             sys.stdout = fp
             dbuild.docker_build(build_dir=self.basedir,
                                 build_type='binary',
                                 build_owner=os.getuid(),
                                 parallel=parallel,
                                 proxy=settings.AASEMBLE_BUILDSVC_BUILDER_HTTP_PROXY)
         finally:
             sys.stdout = stdout_orig
Ejemplo n.º 16
0
    def test_discards_dot_git_dir(self):
        tmpdir = tempfile.mkdtemp()
        try:
            shutil.copytree(os.path.join(os.path.dirname(__file__), 'test_data', 'pkg4'),
                            os.path.join(tmpdir, 'source'))

            os.mkdir(os.path.join(tmpdir, 'source', '.git'))

            with open(os.path.join(tmpdir, 'source', '.git', 'somefile'), 'w') as fp:
                fp.write('this should be discarded')

            dbuild.docker_build(tmpdir, build_type='source', build_owner=os.getuid())

            tf = tarfile.open(os.path.join(tmpdir, 'pkg4_1.0-1.tar.gz'), 'r:*')
            self.assertFalse(list(filter(lambda ti: '/.git/' in ti.name, tf.getmembers())),
                             'Tarball contained .git dir' + repr(tf.getmembers()))
        finally:
            shutil.rmtree(tmpdir)
Ejemplo n.º 17
0
    def test_build(self):
        tmpdir = tempfile.mkdtemp()
        try:
            shutil.copytree(os.path.join(os.path.dirname(__file__), 'test_data', 'pkg1'),
                            os.path.join(tmpdir, 'source'))
            dbuild.docker_build(tmpdir, build_type='source', build_owner=os.getuid())

            create_container_real = dbuild.create_container

            # Spy on the calls to create_container
            with mock.patch('dbuild.create_container') as create_container:
                create_container.side_effect = lambda *args, **kwargs: create_container_real(*args, **kwargs)

                dbuild.docker_build(tmpdir, build_type='binary', build_owner=os.getuid(), parallel=7)
                self.assertIn('-j7', create_container.call_args[1]['command'][2])

            for f in ['buildsvctest_0.1.dsc', 'buildsvctest_0.1.tar.gz',
                      'buildsvctest_0.1_amd64.changes', 'buildsvctest_0.1_amd64.deb',
                      'buildsvctest_0.1_source.changes']:
                assert os.path.exists(os.path.join(tmpdir, f)), '{} was missing'.format(f)
        finally:
            shutil.rmtree(tmpdir)
 def binary_build(self, basedir, parallel=1):
     dbuild.docker_build(build_dir=basedir,
                         build_type='binary',
                         build_owner=os.getuid(),
                         parallel=parallel,
                         proxy=getattr(settings, 'AASEMBLE_BUILDSVC_BUILDER_HTTP_PROXY', ))
 def source_build(self, basedir, sourcedir):
     dbuild.docker_build(build_dir=basedir,
                         build_type='source',
                         source_dir=sourcedir,
                         build_owner=os.getuid(),
                         proxy=getattr(settings, 'AASEMBLE_BUILDSVC_BUILDER_HTTP_PROXY', ))