コード例 #1
0
ファイル: p4.py プロジェクト: Cray/buildbot
    def __init__(self, mode='incremental',
                 method=None, p4base=None, p4branch=None,
                 p4port=None, p4user=None,
                 p4passwd=None, p4extra_views=(), p4line_end='local',
                 p4viewspec=None, p4viewspec_suffix='...',
                 p4client=Interpolate(
                     'buildbot_%(prop:workername)s_%(prop:buildername)s'),
                 p4client_spec_options='allwrite rmdir',
                 p4extra_args=None,
                 p4bin='p4',
                 use_tickets=False,
                 **kwargs):
        self.method = method
        self.mode = mode
        self.p4branch = p4branch
        self.p4bin = p4bin
        self.p4base = p4base
        self.p4port = p4port
        self.p4user = p4user
        self.p4passwd = p4passwd
        self.p4extra_views = p4extra_views
        self.p4viewspec = p4viewspec
        self.p4viewspec_suffix = p4viewspec_suffix
        self.p4line_end = p4line_end
        self.p4client = p4client
        self.p4client_spec_options = p4client_spec_options
        self.p4extra_args = p4extra_args
        self.use_tickets = use_tickets

        Source.__init__(self, **kwargs)

        if self.mode not in self.possible_modes and not interfaces.IRenderable.providedBy(self.mode):
            config.error("mode %s is not an IRenderable, or one of %s" % (
                self.mode, self.possible_modes))

        if not p4viewspec and p4base is None:
            config.error("You must provide p4base or p4viewspec")

        if p4viewspec and (p4base or p4branch or p4extra_views):
            config.error(
                "Either provide p4viewspec or p4base and p4branch (and optionally p4extra_views")

        if p4viewspec and isinstance(p4viewspec, string_types):
            config.error(
                "p4viewspec must not be a string, and should be a sequence of 2 element sequences")

        if not interfaces.IRenderable.providedBy(p4base) and p4base and p4base.endswith('/'):
            config.error(
                'p4base should not end with a trailing / [p4base = %s]' % p4base)

        if not interfaces.IRenderable.providedBy(p4branch) and p4branch and p4branch.endswith('/'):
            config.error(
                'p4branch should not end with a trailing / [p4branch = %s]' % p4branch)

        if (p4branch or p4extra_views) and not p4base:
            config.error(
                'If you specify either p4branch or p4extra_views you must also specify p4base')

        if self.p4client_spec_options is None:
            self.p4client_spec_options = ''
コード例 #2
0
    def __init__(self, repourl=None, baseURL=None, mode='incremental',
                 method=None, defaultBranch=None, **kwargs):
        
        self.repourl = repourl
        self.baseURL = baseURL
        self.branch = defaultBranch
        self.mode = mode
        self.method = method
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(repourl=repourl,
                                 mode=mode,
                                 method=method,
                                 baseURL=baseURL,
                                 defaultBranch=defaultBranch,
                                 )
        if repourl and baseURL:
            raise ValueError("you must provide exactly one of repourl and"
                             " baseURL")

        if repourl is None and baseURL is None:
            raise ValueError("you must privide at least one of repourl and"
                             " baseURL")

        if self.repourl is None:
            self.repourl = self.baseURL + defaultBranch

        assert self.mode in ['incremental', 'full']

        if self.mode == 'full':
            assert self.method in ['clean', 'fresh', 'clobber', 'copy', None]
コード例 #3
0
ファイル: p4.py プロジェクト: wlmgithub/buildbot
    def __init__(self, mode='incremental',
                 method=None, p4base=None, p4branch=None,
                 p4port=None, p4user=None,
                 p4passwd=None, p4extra_views=(), p4line_end='local',
                 p4viewspec=None, p4viewspec_suffix='...',
                 p4client=Interpolate(
                     'buildbot_%(prop:workername)s_%(prop:buildername)s'),
                 p4client_spec_options='allwrite rmdir',
                 p4extra_args=None,
                 p4bin='p4',
                 use_tickets=False,
                 **kwargs):
        self.method = method
        self.mode = mode
        self.p4branch = p4branch
        self.p4bin = p4bin
        self.p4base = p4base
        self.p4port = p4port
        self.p4user = p4user
        self.p4passwd = p4passwd
        self.p4extra_views = p4extra_views
        self.p4viewspec = p4viewspec
        self.p4viewspec_suffix = p4viewspec_suffix
        self.p4line_end = p4line_end
        self.p4client = p4client
        self.p4client_spec_options = p4client_spec_options
        self.p4extra_args = p4extra_args
        self.use_tickets = use_tickets

        Source.__init__(self, **kwargs)

        if self.mode not in self.possible_modes and not interfaces.IRenderable.providedBy(self.mode):
            config.error("mode %s is not an IRenderable, or one of %s" % (
                self.mode, self.possible_modes))

        if not p4viewspec and p4base is None:
            config.error("You must provide p4base or p4viewspec")

        if p4viewspec and (p4base or p4branch or p4extra_views):
            config.error(
                "Either provide p4viewspec or p4base and p4branch (and optionally p4extra_views")

        if p4viewspec and isinstance(p4viewspec, string_types):
            config.error(
                "p4viewspec must not be a string, and should be a sequence of 2 element sequences")

        if not interfaces.IRenderable.providedBy(p4base) and p4base and p4base.endswith('/'):
            config.error(
                'p4base should not end with a trailing / [p4base = %s]' % p4base)

        if not interfaces.IRenderable.providedBy(p4branch) and p4branch and p4branch.endswith('/'):
            config.error(
                'p4branch should not end with a trailing / [p4branch = %s]' % p4branch)

        if (p4branch or p4extra_views) and not p4base:
            config.error(
                'If you specify either p4branch or p4extra_views you must also specify p4base')

        if self.p4client_spec_options is None:
            self.p4client_spec_options = ''
コード例 #4
0
ファイル: bzr.py プロジェクト: Fieldbyte/buildbot
    def __init__(self, repourl=None, baseURL=None, mode='incremental',
                 method=None, defaultBranch=None, **kwargs):
        
        self.repourl = repourl
        self.baseURL = baseURL
        self.branch = defaultBranch
        self.mode = mode
        self.method = method
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(repourl=repourl,
                                 mode=mode,
                                 method=method,
                                 baseURL=baseURL,
                                 defaultBranch=defaultBranch,
                                 )
        if repourl and baseURL:
            raise ValueError("you must provide exactly one of repourl and"
                             " baseURL")

        if repourl is None and baseURL is None:
            raise ValueError("you must privide at least one of repourl and"
                             " baseURL")

        if self.repourl is None:
            self.repourl = self.baseURL + defaultBranch

        assert self.mode in ['incremental', 'full']

        if self.mode == 'full':
            assert self.method in ['clean', 'fresh', 'clobber', 'copy', None]
コード例 #5
0
 def test_dict(self):
     s = Source()
     s.build = Build()
     dict = {}
     dict['test'] = "ssh://server/testrepository"
     self.assertEquals(s.computeRepositoryURL(dict),
                       "ssh://server/testrepository")
コード例 #6
0
    def __init__(self, baseURL, branch, forceSharedRepo=True, **kwargs):
        Source.__init__(self, **kwargs)
        self.branch = branch
        self.baseURL = baseURL
        self.forceSharedRepo = forceSharedRepo

        self.addFactoryArguments(branch=branch,
                                 baseURL=baseURL,
                                 forceSharedRepo=forceSharedRepo)
コード例 #7
0
ファイル: git.py プロジェクト: rodrigc/braid
 def __init__(self, repourl, branch='trunk', **kwargs):
     self.repourl = repourl
     self.branch = branch
     kwargs['env'] = {
             'GIT_AUTHOR_EMAIL': '*****@*****.**',
             'GIT_AUTHOR_NAME': 'Twisted Buildbot',
             'GIT_COMMITTER_EMAIL': '*****@*****.**',
             'GIT_COMMITTER_NAME': 'Twisted Buildbot',
             }
     Source.__init__(self, **kwargs)
     self.addFactoryArguments(repourl=repourl, branch=branch)
コード例 #8
0
 def __init__(self, repourl, branch='trunk', **kwargs):
     self.repourl = repourl
     self.branch = branch
     kwargs['env'] = {
         'GIT_AUTHOR_EMAIL': '*****@*****.**',
         'GIT_AUTHOR_NAME': 'Twisted Buildbot',
         'GIT_COMMITTER_EMAIL': '*****@*****.**',
         'GIT_COMMITTER_NAME': 'Twisted Buildbot',
     }
     Source.__init__(self, **kwargs)
     self.addFactoryArguments(repourl=repourl, branch=branch)
コード例 #9
0
    def __init__(self,
                 svnurl=None,
                 baseURL=None,
                 mode='incremental',
                 method=None,
                 defaultBranch=None,
                 username=None,
                 password=None,
                 extra_args=None,
                 keep_on_purge=None,
                 depth=None,
                 **kwargs):

        self.svnurl = svnurl
        self.baseURL = baseURL
        self.branch = defaultBranch
        self.username = username
        self.password = password
        self.extra_args = extra_args
        self.keep_on_purge = keep_on_purge or []
        self.depth = depth
        self.method = method
        self.mode = mode
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(
            svnurl=svnurl,
            baseURL=baseURL,
            mode=mode,
            method=method,
            defaultBranch=defaultBranch,
            password=password,
            username=username,
            extra_args=extra_args,
            keep_on_purge=keep_on_purge,
            depth=depth,
        )

        assert self.mode in ['incremental', 'full']
        assert self.method in [
            'clean', 'fresh', 'clobber', 'copy', 'export', None
        ]

        if svnurl and baseURL:
            raise ValueError("you must provide exactly one of svnurl and"
                             " baseURL")

        if svnurl is None and baseURL is None:
            raise ValueError("you must privide at least one of svnurl and"
                             " baseURL")
コード例 #10
0
ファイル: svn.py プロジェクト: solarmist/buildbot
    def __init__(
        self,
        svnurl=None,
        baseURL=None,
        mode="incremental",
        method=None,
        defaultBranch=None,
        username=None,
        password=None,
        extra_args=None,
        keep_on_purge=None,
        depth=None,
        **kwargs
    ):

        self.svnurl = svnurl
        self.baseURL = baseURL
        self.branch = defaultBranch
        self.username = username
        self.password = password
        self.extra_args = extra_args
        self.keep_on_purge = keep_on_purge or []
        self.depth = depth
        self.method = method
        self.mode = mode
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(
            svnurl=svnurl,
            baseURL=baseURL,
            mode=mode,
            method=method,
            defaultBranch=defaultBranch,
            password=password,
            username=username,
            extra_args=extra_args,
            keep_on_purge=keep_on_purge,
            depth=depth,
        )

        assert self.mode in ["incremental", "full"]
        assert self.method in ["clean", "fresh", "clobber", "copy", "export", None]

        if svnurl and baseURL:
            raise ValueError("you must provide exactly one of svnurl and" " baseURL")

        if svnurl is None and baseURL is None:
            raise ValueError("you must privide at least one of svnurl and" " baseURL")
コード例 #11
0
ファイル: p4.py プロジェクト: 1stvamp/buildbot
    def __init__(self, mode='incremental',
                 method=None, p4base=None, p4branch=None,
                 p4port=None, p4user=None,
                 p4passwd=None, p4extra_views=(), p4line_end='local',
                 p4viewspec=None,
                 p4client=Interpolate('buildbot_%(prop:slavename)s_%(prop:buildername)s'),
                 p4bin='p4',
                 **kwargs):
        self.method = method
        self.mode = mode
        self.p4branch = p4branch
        self.p4bin = p4bin
        self.p4base = p4base
        self.p4port = p4port
        self.p4user = p4user
        self.p4passwd = p4passwd
        self.p4extra_views = p4extra_views
        self.p4viewspec = p4viewspec
        self.p4line_end = p4line_end
        self.p4client = p4client

        Source.__init__(self, **kwargs)

        errors = []
        if self.mode not in self.possible_modes:
            errors.append("mode %s is not one of %s" % (self.mode, self.possible_modes))

        if not p4viewspec and p4base is None:
            errors.append("You must provide p4base or p4viewspec")

        if p4viewspec and (p4base or p4branch or p4extra_views):
            errors.append("Either provide p4viewspec or p4base and p4branch (and optionally p4extra_views")

        if p4viewspec and type(p4viewspec) is StringType:
            errors.append("p4viewspec must not be a string, and should be a sequence of 2 element sequences")

        if not interfaces.IRenderable.providedBy(p4base) and p4base and p4base.endswith('/'):
            errors.append('p4base should not end with a trailing / [p4base = %s]' % p4base)

        if not interfaces.IRenderable.providedBy(p4branch) and p4branch and p4branch.endswith('/'):
            errors.append('p4branch should not end with a trailing / [p4branch = %s]' % p4branch)

        if (p4branch or p4extra_views) and not p4base:
            errors.append('If you specify either p4branch or p4extra_views you must also specify p4base')

        if errors:
            raise ConfigErrors(errors)
コード例 #12
0
    def test_start_alwaysUseLatest_False_no_branch(self):
        step = self.setupStep(Source())
        step.branch = 'branch'
        step.startVC = mock.Mock()

        step.startStep(mock.Mock())

        self.assertEqual(step.startVC.call_args, (('branch', None, None), {}))
コード例 #13
0
    def test_start_no_codebase(self):
        step = self.setupStep(Source())
        step.branch = 'branch'
        step.startVC = mock.Mock()
        step.build.getSourceStamp = mock.Mock()
        step.build.getSourceStamp.return_value = None

        step.startStep(mock.Mock())
        self.assertEqual(step.build.getSourceStamp.call_args[0], ('', ))
コード例 #14
0
    def test_start_alwaysUseLatest_True(self):
        step = self.setupStep(Source(alwaysUseLatest=True), {
            'branch': 'other-branch',
            'revision': 'revision',
        },
                              patch='patch')
        step.branch = 'branch'
        step.startVC = mock.Mock()

        step.startStep(mock.Mock())

        self.assertEqual(step.startVC.call_args, (('branch', None, None), {}))
コード例 #15
0
    def __init__(self, repourl=None, baseURL=None, mode='incremental',
                 method=None, defaultBranch=None, username=None,
                 password=None, extra_args=None, keep_on_purge=None,
                 depth=None, **kwargs):

        self.repourl = repourl
        self.baseURL = baseURL
        self.branch = defaultBranch
        self.username = username
        self.password = password
        self.extra_args = extra_args
        self.keep_on_purge = keep_on_purge or []
        self.depth = depth
        self.method=method
        self.mode = mode
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(repourl=repourl,
                                 baseURL=baseURL,
                                 mode=mode,
                                 method=method,
                                 defaultBranch=defaultBranch,
                                 password=password,
                                 username=username,
                                 extra_args=extra_args,
                                 keep_on_purge=keep_on_purge,
                                 depth=depth,
                                 )
        errors = []
        if self.mode not in self.possible_modes:
            errors.append("mode %s is not one of %s" % (self.mode, self.possible_modes))
        if self.method not in self.possible_methods:
            errors.append("method %s is not one of %s" % (self.method, self.possible_methods))

        if repourl and baseURL:
            errors.append("you must provide exactly one of repourl and baseURL")

        if repourl is None and baseURL is None:
            errors.append("you must privide at least one of repourl and baseURL")
        if errors:
            raise ConfigErrors(errors)
コード例 #16
0
    def test_start_alwaysUseLatest_False_binary_patch(self):
        args = {
            'branch': 'other-branch',
            'revision': 'revision',
        }
        step = self.setup_step(Source(), args, patch=(1, b'patch\xf8'))
        step.branch = 'branch'
        step.run_vc = self.setup_deferred_mock()

        step.startStep(mock.Mock())

        self.assertEqual(step.run_vc.mock.call_args,
                         (('other-branch', 'revision', (1, b'patch\xf8')), {}))
コード例 #17
0
    def __init__(self, cvsroot=None, cvsmodule='', mode='incremental',
                 method=None, branch=None, global_options=[], extra_options=[],
                 login=None, **kwargs):

        self.cvsroot = cvsroot
        self.cvsmodule = cvsmodule
        self.branch = branch
        self.global_options = global_options
        self.extra_options = extra_options
        self.login = login
        self.mode = mode
        self.method = method
        self.srcdir = 'source'
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(cvsroot=cvsroot,
                                 cvsmodule=cvsmodule,
                                 mode=mode,
                                 method=method,
                                 global_options=global_options,
                                 extra_options=extra_options,
                                 login=login,
                                 )
コード例 #18
0
    def test_start_alwaysUseLatest_False(self):
        step = self.setupStep(Source(), {
            'branch': 'other-branch',
            'revision': 'revision',
        },
                              patch='patch')
        step.branch = 'branch'
        step.run_vc = self.setup_deferred_mock()

        step.startStep(mock.Mock())

        self.assertEqual(step.run_vc.mock.call_args,
                         (('other-branch', 'revision', 'patch'), {}))
コード例 #19
0
    def test_start_no_codebase(self):
        step = self.setupStep(Source())
        step.branch = 'branch'
        step.startVC = mock.Mock()
        step.build.getSourceStamp = mock.Mock()
        step.build.getSourceStamp.return_value = None

        self.assertEqual(step.describe(), ['updating'])
        self.assertEqual(step.name, Source.name)

        step.startStep(mock.Mock())
        self.assertEqual(step.build.getSourceStamp.call_args[0], ('', ))

        self.assertEqual(step.description, ['updating'])
コード例 #20
0
    def test_start_no_codebase(self):
        step = self.setupStep(Source())
        step.branch = 'branch'
        step.run_vc = self.setup_deferred_mock()
        step.build.getSourceStamp = mock.Mock()
        step.build.getSourceStamp.return_value = None

        self.assertEqual(step.getCurrentSummary(), {'step': 'updating'})
        self.assertEqual(step.name, Source.name)

        step.startStep(mock.Mock())
        self.assertEqual(step.build.getSourceStamp.call_args[0], ('', ))

        self.assertEqual(step.getCurrentSummary(), {'step': 'updating'})
コード例 #21
0
    def test_start_with_codebase(self):
        step = self.setupStep(Source(codebase='codebase'))
        step.branch = 'branch'
        step.startVC = mock.Mock()
        step.build.getSourceStamp = mock.Mock()
        step.build.getSourceStamp.return_value = None

        self.assertEqual(step.describe(), ['updating', 'codebase'])
        self.assertEqual(step.name, Source.name + " codebase")

        step.startStep(mock.Mock())
        self.assertEqual(step.build.getSourceStamp.call_args[0], ('codebase',))        

        self.assertEqual(step.describe(True), ['update', 'codebase'])
コード例 #22
0
    def test_start_with_codebase_and_descriptionSuffix(self):
        step = self.setupStep(
            Source(codebase='my-code', descriptionSuffix='suffix'))
        step.branch = 'branch'
        step.startVC = mock.Mock()
        step.build.getSourceStamp = mock.Mock()
        step.build.getSourceStamp.return_value = None

        self.assertEqual(step.describe(), ['updating', 'suffix'])
        self.assertEqual(step.name, Source.name + "-my-code")

        step.startStep(mock.Mock())
        self.assertEqual(step.build.getSourceStamp.call_args[0], ('my-code', ))

        self.assertEqual(step.describe(True), ['update', 'suffix'])
コード例 #23
0
    def test_start_with_codebase(self):
        step = self.setupStep(Source(codebase='codebase'))
        step.branch = 'branch'
        step.run_vc = self.setup_deferred_mock()
        step.build.getSourceStamp = mock.Mock()
        step.build.getSourceStamp.return_value = None

        self.assertEqual(step.getCurrentSummary(), {'step': 'updating codebase'})
        step.name = yield step.build.render(step.name)
        self.assertEqual(step.name, Source.name + "-codebase")

        step.startStep(mock.Mock())
        self.assertEqual(step.build.getSourceStamp.call_args[0], ('codebase',))

        self.assertEqual(step.getResultSummary(),
                         {'step': 'Codebase codebase not in build codebase (failure)'})
コード例 #24
0
    def test_start_with_codebase_and_descriptionSuffix(self):
        step = self.setupStep(Source(codebase='my-code',
                                     descriptionSuffix='suffix'))
        step.branch = 'branch'
        step.run_vc = self.setup_deferred_mock()
        step.build.getSourceStamp = mock.Mock()
        step.build.getSourceStamp.return_value = None

        self.assertEqual(step.getCurrentSummary(), {'step': 'updating suffix'})
        step.name = yield step.build.render(step.name)
        self.assertEqual(step.name, Source.name + "-my-code")

        step.startStep(mock.Mock())
        self.assertEqual(step.build.getSourceStamp.call_args[0], ('my-code',))

        self.assertEqual(step.getResultSummary(),
                         {'step': 'Codebase my-code not in build suffix (failure)'})
コード例 #25
0
    def __init__(self,
                 repourl=None,
                 baseURL=None,
                 mode='incremental',
                 method=None,
                 defaultBranch=None,
                 branchType='dirname',
                 clobberOnBranchChange=True,
                 **kwargs):
        """
        @type  repourl: string
        @param repourl: the URL which points at the Mercurial repository.
                        This uses the 'default' branch unless defaultBranch is
                        specified below and the C{branchType} is set to
                        'inrepo'.  It is an error to specify a branch without
                        setting the C{branchType} to 'inrepo'.

        @param baseURL: if 'dirname' branches are enabled, this is the base URL
                        to which a branch name will be appended. It should
                        probably end in a slash.  Use exactly one of C{repourl}
                        and C{baseURL}.

        @param defaultBranch: if branches are enabled, this is the branch
                              to use if the Build does not specify one
                              explicitly.
                              For 'dirname' branches, It will simply be
                              appended to C{baseURL} and the result handed to
                              the 'hg update' command.
                              For 'inrepo' branches, this specifies the named
                              revision to which the tree will update after a
                              clone.

        @param branchType: either 'dirname' or 'inrepo' depending on whether
                           the branch name should be appended to the C{baseURL}
                           or the branch is a mercurial named branch and can be
                           found within the C{repourl}

        @param clobberOnBranchChange: boolean, defaults to True. If set and
                                      using inrepos branches, clobber the tree
                                      at each branch change. Otherwise, just
                                      update to the branch.
        """

        self.repourl = repourl
        self.baseURL = baseURL
        self.defaultBranch = self.branch = defaultBranch
        self.branchType = branchType
        self.method = method
        self.clobberOnBranchChange = clobberOnBranchChange
        self.mode = mode
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(
            repourl=repourl,
            baseURL=baseURL,
            mode=mode,
            method=method,
            defaultBranch=defaultBranch,
            branchType=branchType,
            clobberOnBranchChange=clobberOnBranchChange,
        )

        assert self.mode in ['incremental', 'full']

        if repourl and baseURL:
            raise ValueError("you must provide exactly one of repourl and"
                             " baseURL")

        if repourl is None and baseURL is None:
            raise ValueError("you must privide at least one of repourl and"
                             " baseURL")
コード例 #26
0
    def __init__(self, repourl=None, mode='incremental',
                 method=None, defaultBranch=None, branchType='dirname',
                 clobberOnBranchChange=True, **kwargs):

        """
        @type  repourl: string
        @param repourl: the URL which points at the Mercurial repository.
                        if 'dirname' branches are enabled, this is the base URL
                        to which a branch name will be appended. It should
                        probably end in a slash.

        @param defaultBranch: if branches are enabled, this is the branch
                              to use if the Build does not specify one
                              explicitly.
                              For 'dirname' branches, It will simply be
                              appended to C{repourl} and the result handed to
                              the 'hg update' command.
                              For 'inrepo' branches, this specifies the named
                              revision to which the tree will update after a
                              clone.

        @param branchType: either 'dirname' or 'inrepo' depending on whether
                           the branch name should be appended to the C{repourl}
                           or the branch is a mercurial named branch and can be
                           found within the C{repourl}

        @param clobberOnBranchChange: boolean, defaults to True. If set and
                                      using inrepos branches, clobber the tree
                                      at each branch change. Otherwise, just
                                      update to the branch.
        """
        
        self.repourl = repourl
        self.defaultBranch = self.branch = defaultBranch
        self.branchType = branchType
        self.method = method
        self.clobberOnBranchChange = clobberOnBranchChange
        self.mode = mode
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(repourl=repourl,
                                 mode=mode,
                                 method=method,
                                 defaultBranch=defaultBranch,
                                 branchType=branchType,
                                 clobberOnBranchChange=
                                 clobberOnBranchChange,
                                 )

        errors = []
        if self.mode not in self.possible_modes:
            errors.append("mode %s is not one of %s" %
                            (self.mode, self.possible_modes))
        if self.method not in self.possible_methods:
            errors.append("method %s is not one of %s" %
                            (self.method, self.possible_methods))
        if self.branchType not in self.possible_branchTypes:
            errors.append("branchType %s is not one of %s" %
                            (self.branchType, self.possible_branchTypes))

        if repourl is None:
            errors.append("you must privide a repourl")
        
        if errors:
            raise ConfigErrors(errors)
コード例 #27
0
 def test_callable_render(self):
     s = Source()
     s.build = Build()
     func = lambda x: WithProperties(x+"%(foo)s")
     self.assertEquals(s.computeRepositoryURL(func), "testbar")
コード例 #28
0
ファイル: mercurial.py プロジェクト: sffjunkie/buildbot
    def __init__(self, repourl=None, baseURL=None, mode='incremental',
                 method=None, defaultBranch=None, branchType='dirname',
                 clobberOnBranchChange=True, **kwargs):

        """
        @type  repourl: string
        @param repourl: the URL which points at the Mercurial repository.
                        This uses the 'default' branch unless defaultBranch is
                        specified below and the C{branchType} is set to
                        'inrepo'.  It is an error to specify a branch without
                        setting the C{branchType} to 'inrepo'.

        @param baseURL: if 'dirname' branches are enabled, this is the base URL
                        to which a branch name will be appended. It should
                        probably end in a slash.  Use exactly one of C{repourl}
                        and C{baseURL}.

        @param defaultBranch: if branches are enabled, this is the branch
                              to use if the Build does not specify one
                              explicitly.
                              For 'dirname' branches, It will simply be
                              appended to C{baseURL} and the result handed to
                              the 'hg update' command.
                              For 'inrepo' branches, this specifies the named
                              revision to which the tree will update after a
                              clone.

        @param branchType: either 'dirname' or 'inrepo' depending on whether
                           the branch name should be appended to the C{baseURL}
                           or the branch is a mercurial named branch and can be
                           found within the C{repourl}

        @param clobberOnBranchChange: boolean, defaults to True. If set and
                                      using inrepos branches, clobber the tree
                                      at each branch change. Otherwise, just
                                      update to the branch.
        """
        
        self.repourl = repourl
        self.baseURL = baseURL
        self.defaultBranch = self.branch = defaultBranch
        self.branchType = branchType
        self.method = method
        self.clobberOnBranchChange = clobberOnBranchChange
        self.mode = mode
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(repourl=repourl,
                                 baseURL=baseURL,
                                 mode=mode,
                                 method=method,
                                 defaultBranch=defaultBranch,
                                 branchType=branchType,
                                 clobberOnBranchChange=
                                 clobberOnBranchChange,
                                 )

        assert self.mode in ['incremental', 'full']

        if repourl and baseURL:
            raise ValueError("you must provide exactly one of repourl and"
                             " baseURL")

        if repourl is None and baseURL is None:
            raise ValueError("you must privide at least one of repourl and"
                             " baseURL")
コード例 #29
0
ファイル: p4.py プロジェクト: thuanbk2010/katana
    def __init__(self,
                 mode='incremental',
                 method=None,
                 p4base=None,
                 p4branch=None,
                 p4port=None,
                 p4user=None,
                 p4passwd=None,
                 p4extra_views=(),
                 p4line_end='local',
                 p4viewspec=None,
                 p4client=Interpolate(
                     'buildbot_%(prop:slavename)s_%(prop:buildername)s'),
                 p4bin='p4',
                 **kwargs):
        self.method = method
        self.mode = mode
        self.p4branch = p4branch
        self.p4bin = p4bin
        self.p4base = p4base
        self.p4port = p4port
        self.p4user = p4user
        self.p4passwd = p4passwd
        self.p4extra_views = p4extra_views
        self.p4viewspec = p4viewspec
        self.p4line_end = p4line_end
        self.p4client = p4client

        Source.__init__(self, **kwargs)

        errors = []
        if self.mode not in self.possible_modes:
            errors.append("mode %s is not one of %s" %
                          (self.mode, self.possible_modes))

        if not p4viewspec and p4base is None:
            errors.append("You must provide p4base or p4viewspec")

        if p4viewspec and (p4base or p4branch or p4extra_views):
            errors.append(
                "Either provide p4viewspec or p4base and p4branch (and optionally p4extra_views"
            )

        if p4viewspec and type(p4viewspec) is StringType:
            errors.append(
                "p4viewspec must not be a string, and should be a sequence of 2 element sequences"
            )

        if not interfaces.IRenderable.providedBy(
                p4base) and p4base and p4base.endswith('/'):
            errors.append(
                'p4base should not end with a trailing / [p4base = %s]' %
                p4base)

        if not interfaces.IRenderable.providedBy(
                p4branch) and p4branch and p4branch.endswith('/'):
            errors.append(
                'p4branch should not end with a trailing / [p4branch = %s]' %
                p4branch)

        if (p4branch or p4extra_views) and not p4base:
            errors.append(
                'If you specify either p4branch or p4extra_views you must also specify p4base'
            )

        if errors:
            raise ConfigErrors(errors)
コード例 #30
0
ファイル: git.py プロジェクト: rodrigc/braid
 def finished(self, results):
     if results == SUCCESS:
         self.step_status.setText(['merge', 'forward'])
     else:
         self.step_status.setText(['merge', 'forward', 'failed'])
     return Source.finished(self, results)
コード例 #31
0
 def test_dict_render(self):
     s = Source()
     s.build = Build()
     d = dict(test=WithProperties("repourl%(foo)s"))
     self.assertEquals(s.computeRepositoryURL(d), "repourlbar")
コード例 #32
0
 def test_callable(self):
     s = Source()
     s.build = Build()
     func = lambda x: x[::-1]
     self.assertEquals(s.computeRepositoryURL(func), "tset")
コード例 #33
0
ファイル: test_source_repourl.py プロジェクト: Almad/buildbot
 def test_dict(self):
     s = Source()
     s.build = Build()
     dict = {}
     dict['test'] = "ssh://server/testrepository"
     self.assertEquals(s.computeRepositoryURL(dict), "ssh://server/testrepository")
コード例 #34
0
 def test_format_string(self):
     s = Source()
     s.build = Build()
     self.assertEquals(s.computeRepositoryURL("http://server/%s"), "http://server/test")
コード例 #35
0
 def test_backward_compatibility(self):
     s = Source()
     s.build = Build()
     self.assertEqual(s.computeRepositoryURL("repourl"), "repourl")
コード例 #36
0
 def test_backward_compatibility_render(self):
     s = Source()
     s.build = Build()
     self.assertEquals(s.computeRepositoryURL("repourl%(foo)s"),
                       "repourlbar")
コード例 #37
0
 def test_dict_render(self):
     s = Source()
     s.build = Build()
     d = dict(test="repourl%(foo)s")
     self.assertEquals(s.computeRepositoryURL(d), "repourlbar")
コード例 #38
0
 def test_constructor_args_strings(self):
     step = Source(workdir='build',
                   description='svn update (running)',
                   descriptionDone='svn update')
     self.assertEqual(step.description, ['svn update (running)'])
     self.assertEqual(step.descriptionDone, ['svn update'])
コード例 #39
0
 def test_constructor_args_lists(self):
     step = Source(workdir='build',
                   description=['svn', 'update', '(running)'],
                   descriptionDone=['svn', 'update'])
     self.assertEqual(step.description, ['svn', 'update', '(running)'])
     self.assertEqual(step.descriptionDone, ['svn', 'update'])
コード例 #40
0
ファイル: tarsource.py プロジェクト: azizur77/xapian
 def __init__(self, rooturl, archives, **kwargs):
     self.branch = None
     Source.__init__(self, **kwargs)
     self.rooturl = rooturl
     self.archives = archives
     self.working = False
コード例 #41
0
 def test_backward_compatibility_render(self):
     s = Source()
     s.build = Build()
     self.assertEquals(s.computeRepositoryURL(WithProperties("repourl%(foo)s")), "repourlbar")
コード例 #42
0
 def finished(self, results):
     if results == SUCCESS:
         self.step_status.setText(['merge', 'forward'])
     else:
         self.step_status.setText(['merge', 'forward', 'failed'])
     return Source.finished(self, results)
コード例 #43
0
 def test_callable_render(self):
     s = Source()
     s.build = Build()
     func = lambda x: x + "%(foo)s"
     self.assertEquals(s.computeRepositoryURL(func), "testbar")
コード例 #44
0
ファイル: git.py プロジェクト: abompard/buildbot
    def __init__(self, repourl=None, branch='master', mode='incremental',
                 method=None, submodule=False, shallow=False, progress=False,
                 retryFetch=False, clobberOnFailure=False, **kwargs):
        """
        @type  repourl: string
        @param repourl: the URL which points at the git repository

        @type  branch: string
        @param branch: The branch or tag to check out by default. If
                       a build specifies a different branch, it will
                       be used instead of this.

        @type  submodules: boolean
        @param submodules: Whether or not to update (and initialize)
                       git submodules.

        @type  mode: string
        @param mode: Type of checkout. Described in docs.

        @type  method: string
        @param method: Full builds can be done is different ways. This parameter
                       specifies which method to use.

        @type  progress: boolean
        @param progress: Pass the --progress option when fetching. This
                         can solve long fetches getting killed due to
                         lack of output, but requires Git 1.7.2+.
        @type  shallow: boolean
        @param shallow: Use a shallow or clone, if possible

        @type  retryFetch: boolean
        @param retryFetch: Retry fetching before failing source checkout.
        """

        self.branch    = branch
        self.method    = method
        self.prog  = progress
        self.repourl   = repourl
        self.retryFetch = retryFetch
        self.submodule = submodule
        self.shallow   = shallow
        self.fetchcount = 0
        self.clobberOnFailure = clobberOnFailure
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(branch=branch,
                                 mode=mode,
                                 method=method,
                                 progress=progress,
                                 repourl=repourl,
                                 submodule=submodule,
                                 shallow=shallow,
                                 retryFetch=retryFetch,
                                 clobberOnFailure=
                                 clobberOnFailure,
                                 )

        self.mode = mode
        assert self.mode in ['incremental', 'full']
        assert self.repourl is not None
        if self.mode == 'full':
            assert self.method in ['clean', 'fresh', 'clobber', 'copy', None]
        self.repourl = self.repourl and _ComputeRepositoryURL(self.repourl)