|
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members
"""Base class for P4 source-updaters
['p4port'] (required): host:port for server to access ['p4user'] (optional): user to use for access ['p4passwd'] (optional): passwd to try for the user ['p4client'] (optional): client spec to use """
# Executes a p4 command that will give us the latest changelist number # of any file under the current (or default) client: # add '-s submitted' for bug #626 environ=self.env, timeout=self.timeout, maxTime=self.maxTime, sendStdout=True, sendRC=False, keepStdout=True, usePTY=False, logEnviron=self.logEnviron)
# 'p4 -c clien-name change -m 1 "#have"' will produce an output like: # "Change 28147 on 2008/04/07 by p4user@hostname..." # The number after "Change" is the one we want. return None
"""A P4 source-updater.
['p4port'] (required): host:port for server to access ['p4user'] (required): user to use for access ['p4passwd'] (required): passwd to try for the user ['p4client'] (required): client spec to use ['p4extra_views'] (required): additional client views to use ['p4base'] (required): view into the Perforce depot without branch name or trailing "..." ['p4line_end'] (optional): value of the LineEnd client specification property """
# sourcedata is encoded to utf-8, since otherwise unicode strings # appear with a leading "u", causing comparisons to fail. In # retrospect, comparing str() output is not the best technique! enc(x) for x in [ # Perforce server. self.p4port,
# Client spec. self.p4client,
# Depot side of view spec. self.p4base, self.p4branch, self.p4extra_views, self.p4line_end,
# Local side of view spec (srcdir is made from these). self.builder.basedir, self.mode, self.workdir ]])
# We assume our client spec is still around. # We just say we aren't updateable if the dir doesn't exist so we # don't get ENOENT checking the sourcedata. os.path.isdir(os.path.join(self.builder.basedir, self.srcdir)))
return self._doP4Sync(force=False)
command.extend(['@' + str(self.revision)]) environ=env, sendRC=False, timeout=self.timeout, maxTime=self.maxTime, usePTY=False, logEnviron=self.logEnviron)
client_spec += "LineEnd:\t%s\n\n" % self.p4line_end else:
# Setup a view for k, v in self.p4extra_views: client_spec += "\t%s/... //%s/%s%s/...\n" % (k, self.p4client, self.srcdir, v)
# from bdbaddog in github comments: # I'm pretty sure the issue is that perforce client specs can't be # non-ascii (unless you configure at initial config to be unicode). I # floated a question to perforce mailing list. From reading the # internationalization notes.. # http://www.perforce.com/perforce/doc.092/user/i18nnotes.txt # I'm 90% sure that's the case. # (http://github.com/bdbaddog/buildbot/commit/8420149b2b804efcf5f81a13e18aa62da0424d21)
# Clean client spec to plain ascii
environ=env, sendRC=False, timeout=self.timeout, maxTime=self.maxTime, initialStdin=client_spec, usePTY=False, logEnviron=self.logEnviron)
return str(self.revision) else:
|