[Buildbot-commits] [SPAM] Re: [Buildbot] #821: p4base handled badly

Buildbot buildbot-devel at lists.sourceforge.net
Tue May 4 04:08:54 UTC 2010


#821: p4base handled badly
-------------------+--------------------------------------------------------
Reporter:  dustin  |       Owner:       
    Type:  defect  |      Status:  new  
Priority:  major   |   Milestone:  0.8.0
 Version:  0.8.0   |    Keywords:       
-------------------+--------------------------------------------------------
Description changed by dustin:

Old description:

> Here's the fix.
>
> So in __init__, the p4base wasn't being saved on the object, and then
> it was being referred to in setBuild(self,build)
>        self.args['p4base'] = self.computeRepositoryURL(p4base)
> So I've changed init to save self.p4base=p4base
> And then in setBuild(self,build) changed it to refer to self.p4base.
> Seems to work.
>
> -Bill
>
> class P4(Source):
>    """ P4 is a class for accessing perforce revision control"""
>    name = "p4"
>
>    def __init__(self, p4base=None, defaultBranch=None, p4port=None,
> p4user=None,
>                 p4passwd=None, p4extra_views=[],
>                 p4client='buildbot_%(slave)s_%(builder)s', **kwargs):
>        """
>        @type  p4base: string
>        @param p4base: A view into a perforce depot, typically
>                       "//depot/proj/"
>
>        @type  defaultBranch: string
>        @param defaultBranch: Identify a branch to build by default.
> Perforce
>                              is a view based branching system. So, the
> branch
>                              is normally the name after the base. For
> example,
>                              branch=1.0 is view=//depot/proj/1.0/...
>                              branch=1.1 is view=//depot/proj/1.1/...
>
>        @type  p4port: string
>        @param p4port: Specify the perforce server to connection in the
> format
>                       <host>:<port>. Example "perforce.example.com:1666"
>
>        @type  p4user: string
>        @param p4user: The perforce user to run the command as.
>
>        @type  p4passwd: string
>        @param p4passwd: The password for the perforce user.
>
>        @type  p4extra_views: list of tuples
>        @param p4extra_views: Extra views to be added to
>                              the client that is being used.
>
>        @type  p4client: string
>        @param p4client: The perforce client to use for this buildslave.
>        """
>
>        self.branch = defaultBranch
>        Source.__init__(self, **kwargs)
>        self.addFactoryArguments(p4base=p4base,
>                                 defaultBranch=defaultBranch,
>                                 p4port=p4port,
>                                 p4user=p4user,
>                                 p4passwd=p4passwd,
>                                 p4extra_views=p4extra_views,
>                                 p4client=p4client,
>                                 )
>        self.args['p4port'] = p4port
>        self.args['p4user'] = p4user
>        self.args['p4passwd'] = p4passwd
>        self.args['p4extra_views'] = p4extra_views
>        self.p4base = p4base
>        self.p4client = p4client
>
>    def setBuild(self, build):
>        Source.setBuild(self, build)
>        self.args['p4base'] = self.computeRepositoryURL(self.p4base)
>        self.args['p4client'] = self.p4client % {
>            'slave': build.slavename,
>            'builder': build.builder.name,

New description:

 Here's the fix.

 {{{
 So in __init__, the p4base wasn't being saved on the object, and then
 it was being referred to in setBuild(self,build)
        self.args['p4base'] = self.computeRepositoryURL(p4base)
 So I've changed init to save self.p4base=p4base
 And then in setBuild(self,build) changed it to refer to self.p4base.
 Seems to work.

 -Bill

 class P4(Source):
    """ P4 is a class for accessing perforce revision control"""
    name = "p4"

    def __init__(self, p4base=None, defaultBranch=None, p4port=None,
 p4user=None,
                 p4passwd=None, p4extra_views=[],
                 p4client='buildbot_%(slave)s_%(builder)s', **kwargs):
        """
        @type  p4base: string
        @param p4base: A view into a perforce depot, typically
                       "//depot/proj/"

        @type  defaultBranch: string
        @param defaultBranch: Identify a branch to build by default.
 Perforce
                              is a view based branching system. So, the
 branch
                              is normally the name after the base. For
 example,
                              branch=1.0 is view=//depot/proj/1.0/...
                              branch=1.1 is view=//depot/proj/1.1/...

        @type  p4port: string
        @param p4port: Specify the perforce server to connection in the
 format
                       <host>:<port>. Example "perforce.example.com:1666"

        @type  p4user: string
        @param p4user: The perforce user to run the command as.

        @type  p4passwd: string
        @param p4passwd: The password for the perforce user.

        @type  p4extra_views: list of tuples
        @param p4extra_views: Extra views to be added to
                              the client that is being used.

        @type  p4client: string
        @param p4client: The perforce client to use for this buildslave.
        """

        self.branch = defaultBranch
        Source.__init__(self, **kwargs)
        self.addFactoryArguments(p4base=p4base,
                                 defaultBranch=defaultBranch,
                                 p4port=p4port,
                                 p4user=p4user,
                                 p4passwd=p4passwd,
                                 p4extra_views=p4extra_views,
                                 p4client=p4client,
                                 )
        self.args['p4port'] = p4port
        self.args['p4user'] = p4user
        self.args['p4passwd'] = p4passwd
        self.args['p4extra_views'] = p4extra_views
        self.p4base = p4base
        self.p4client = p4client

    def setBuild(self, build):
        Source.setBuild(self, build)
        self.args['p4base'] = self.computeRepositoryURL(self.p4base)
        self.args['p4client'] = self.p4client % {
            'slave': build.slavename,
            'builder': build.builder.name,
 }}}

--

-- 
Ticket URL: <http://buildbot.net/trac/ticket/821#comment:1>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation


More information about the Commits mailing list