SpecialistOff.NET / Вопросы / Статьи / Фрагменты кода / Резюме / Метки / Помощь / Файлы
НазадМетки: buildbot
The P4Source periodically polls a Perforce depot for changes. It accepts the following arguments:
p4portThe Perforce server to connect to (as host:port).
p4userThe Perforce user.
p4passwdThe Perforce password.
p4baseThe base depot path to watch, without the trailing ‘/…’.
p4binAn optional string parameter. Specify the location of the perforce command line binary (p4). You only need to do this if the perforce binary is not in the path of the Buildbot user. Defaults to p4.
split_fileA function that maps a pathname, without the leading p4base, to a (branch, filename) tuple. The default just returns (None, branchfile), which effectively disables branch support. You should supply a function which understands your repository structure.
pollIntervalHow often to poll, in seconds. Defaults to 600 (10 minutes).
pollRandomDelayMinMinimum delay in seconds to wait before each poll, default is 0. This is useful in case you have a lot of pollers and you want to spread the polling load over a period of time. Setting it equal to the maximum delay will effectively delay all polls by a fixed amount of time. Must be less than or equal to the maximum delay.
pollRandomDelayMaxMaximum delay in seconds to wait before each poll, default is 0. This is useful in case you have a lot of pollers and you want to spread the polling load over a period of time. Must be less than the poll interval.
projectSet the name of the project to be used for the P4Source. This will then be set in any changes generated by the P4Source, and can be used in a Change Filter for triggering particular builders.
pollAtLaunchDetermines when the first poll occurs. True = immediately on launch, False = wait for one pollInterval (default).
histmaxThe maximum number of changes to inspect at a time. If more than this number occur since the last poll, older changes will be silently ignored.
encodingThe character encoding of p4's output. This defaults to “utf8”, but if your commit messages are in another encoding, specify that here. For example, if you’re using Perforce on Windows, you may need to use “cp437” as the encoding if “utf8” generates errors in your master log.
server_tzThe timezone of the Perforce server, using the usual timezone format (e.g: "Europe/Stockholm") in case it’s not in UTC.
use_ticketsSet to True to use ticket-based authentication, instead of passwords (but you still need to specify p4passwd).
ticket_login_intervalHow often to get a new ticket, in seconds, when use_tickets is enabled. Defaults to 86400 (24 hours).
revlinkA function that maps branch and revision to a valid url (e.g. p4web), stored along with the change. This function must be a callable which takes two arguments, the branch and the revision. Defaults to lambda branch, revision: (u’’)
resolvewhoA function that resolves the Perforce ‘user@workspace’ into a more verbose form, stored as the author of the change. Useful when usernames do not match email addresses and external, client-side lookup is required. This function must be a callable which takes one argument. Defaults to lambda who: (who)
This configuration uses the P4PORT, P4USER, and P4PASSWD specified in the buildmaster’s environment. It watches a project in which the branch name is simply the next path component, and the file is all path components after.
from buildbot.plugins import changes
s = changes.P4Source(p4base='//depot/project/',
                     split_file=lambda branchfile: branchfile.split('/',1))
c['change_source'] = s
Similar to the previous example but also resolves the branch and revision into a valid revlink.
from buildbot.plugins import changes
s = changes.P4Source(
    p4base='//depot/project/',
    split_file=lambda branchfile: branchfile.split('/',1))
    revlink=lambda branch, revision: 'http://p4web:8080/@md=d&@/{}?ac=10'.format(revision)
c['change_source'] = s