Пример #1
0
 def _run(self):
     """ Build a source package on the local system. """
     util.setup_pristine_tar_branch()
     cmd = ['gbp', 'buildpackage', '--git-tag', '--git-retag', '-S',
            '-us', '-uc']
     log.info(' '.join(cmd))
     subprocess.check_call(cmd)
Пример #2
0
    def _run(self, pkg):
        """ Clone a package from dist-git. """
        if os.path.exists(pkg):
            err = '%s already exists in current working directory.' % pkg
            raise SystemExit(err)
        configp = util.config()
        try:
            user = configp.get('rhcephpkg', 'user')
            gitbaseurl = configp.get('rhcephpkg', 'gitbaseurl')
        except configparser.Error as err:
            raise SystemExit('Problem parsing .rhcephpkg.conf: %s',
                             err.message)
        # If we were given an RPM pkg name, switch to the Debian one:
        if pkg.startswith('python-'):
            pkg = pkg[7:]
        # TODO: SafeConfigParser might make the "user" interpolation here
        # unnecessary? Need to test, particularly what it does to %(module).
        pkg_url = gitbaseurl % {'user': user, 'module': pkg}
        cmd = ['git', 'clone', pkg_url]
        subprocess.check_call(cmd)

        os.chdir(pkg)

        patches_url = find_patches_url(configp, user, pkg)
        if patches_url:
            cmd = ['git', 'remote', 'add', '-f', 'patches', patches_url]
            subprocess.check_call(cmd)

        util.setup_pristine_tar_branch()
Пример #3
0
 def test_remote_and_local_branches_present(self, testpkg, monkeypatch):
     refsdir = testpkg.join('.git').join('refs')
     refsdir.mkdir('remotes').mkdir('origin').ensure('pristine-tar',
                                                     file=True)
     refsdir.join('heads').ensure('pristine-tar', file=True)
     recorder = CallRecorder()
     monkeypatch.setattr('subprocess.call', recorder)
     util.setup_pristine_tar_branch()
     assert recorder.called == 0
Пример #4
0
 def test_remote_branch_present(self, testpkg, monkeypatch):
     remotesdir = testpkg.join('.git').join('refs').mkdir('remotes')
     remotesdir.mkdir('origin').ensure('pristine-tar', file=True)
     recorder = CallRecorder()
     monkeypatch.setattr('subprocess.call', recorder)
     util.setup_pristine_tar_branch()
     expected = ['git', 'branch', '--track', 'pristine-tar',
                 'origin/pristine-tar']
     assert recorder.args == expected
Пример #5
0
 def _run(self):
     """ Build a source package on the local system. """
     util.setup_pristine_tar_branch()
     cmd = [
         'gbp', 'buildpackage', '--git-tag', '--git-retag', '-S', '-us',
         '-uc'
     ]
     log.info(' '.join(cmd))
     subprocess.check_call(cmd)
Пример #6
0
 def test_remote_and_local_branches_present(self, testpkg, monkeypatch):
     refsdir = testpkg.join('.git').join('refs')
     refsdir.mkdir('remotes').mkdir('origin').ensure('pristine-tar',
                                                     file=True)
     refsdir.join('heads').ensure('pristine-tar', file=True)
     recorder = CallRecorder()
     monkeypatch.setattr('subprocess.call', recorder)
     util.setup_pristine_tar_branch()
     assert recorder.called == 0
Пример #7
0
 def test_remote_branch_present(self, testpkg, monkeypatch):
     remotesdir = testpkg.join('.git').join('refs').mkdir('remotes')
     remotesdir.mkdir('origin').ensure('pristine-tar', file=True)
     recorder = CallRecorder()
     monkeypatch.setattr('subprocess.call', recorder)
     util.setup_pristine_tar_branch()
     expected = [
         'git', 'branch', '--track', 'pristine-tar', 'origin/pristine-tar'
     ]
     assert recorder.args == expected
Пример #8
0
    def _run(self, tarball, bugstr):
        # Ensure we're on the right branch.
        current_branch = util.current_branch()
        debian_branch = util.current_debian_branch()
        if current_branch != debian_branch:
            log.error('current branch is "%s"' % current_branch)
            log.error('debian branch is "%s"' % debian_branch)
            raise RuntimeError('Must run `new-version` on debian branch')

        util.setup_pristine_tar_branch()
        self.ensure_gbp_settings()

        self.setup_upstream_branch()
        self.import_orig(tarball)
        version = self.upstream_version()
        self.run_dch(version, bugstr)

        self.commit()
        self.show()
Пример #9
0
    def _run(self, distro):
        """ Build a package on the local system, using pbuilder. """
        pkg_name = util.package_name()

        os.environ['BUILDER'] = 'pbuilder'
        j_arg = self._get_j_arg(cpu_count())
        pbuilder_cache = '/var/cache/pbuilder/base-%s-amd64.tgz' % distro

        setup_pbuilder_cache(pbuilder_cache, distro)

        util.setup_pristine_tar_branch()

        # TODO: we should also probably check parent dir for leftovers and warn
        # the user to delete them (or delete them ourselves?)
        cmd = [
            'gbp', 'buildpackage',
            '--git-dist=%s' % distro, '--git-arch=amd64', '--git-verbose',
            '--git-pbuilder', j_arg, '-us', '-uc'
        ]

        log.info('building %s with pbuilder', pkg_name)
        subprocess.check_call(cmd)
Пример #10
0
 def test_no_remote_branch(self, testpkg):
     util.setup_pristine_tar_branch()
     assert not os.path.exists('.git/refs/heads/pristine-tar')
Пример #11
0
 def test_no_remote_branch(self, testpkg, monkeypatch):
     util.setup_pristine_tar_branch()
     assert not os.path.exists('.git/refs/heads/pristine-tar')