1# This file is part of Buildbot. Buildbot is free software: you can 2# redistribute it and/or modify it under the terms of the GNU General Public 3# License as published by the Free Software Foundation, version 2. 4# 5# This program is distributed in the hope that it will be useful, but WITHOUT 6# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 8# details. 9# 10# You should have received a copy of the GNU General Public License along with 11# this program; if not, write to the Free Software Foundation, Inc., 51 12# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 13# 14# Copyright Buildbot Team Members 15 16importos 17importre 18importtextwrap 19 20fromtwisted.internetimportdefer 21 22frombuildslave.commands.baseimportSourceBaseCommand 23frombuildslaveimportrunprocess 24frombuildslave.commands.baseimportAbandonChain 25 26

45SourceBaseCommand.setup(self,args) 46self.manifest_url=args.get('manifest_url') 47self.manifest_branch=args.get('manifest_branch') 48self.manifest_file=args.get('manifest_file') 49self.manifest_override_url=args.get('manifest_override_url') 50self.tarball=args.get('tarball') 51self.repo_downloads=args.get('repo_downloads') 52# we're using string instead of an array here, because it will be transferred back 53# to the master as string anyway and using eval() could have security implications. 54self.repo_downloaded="" 55 56self.sourcedata="%s %s %s"%(self.manifest_url,self.manifest_branch,self.manifest_file) 57self.re_change=re.compile(".* refs/changes/\d\d/(\d+)/(\d+) -> FETCH_HEAD$") 58self.re_head=re.compile("^HEAD is now at ([0-9a-f]+)...")

109# on fresh init, this file may confuse repo.110ifos.path.exists(os.path.join(self._fullSrcdir(),".repo/project.list")):111os.unlink(os.path.join(self._fullSrcdir(),".repo/project.list"))112returnself._repoCmd(['init','-u',self.manifest_url,'-b',self.manifest_branch,'-m',self.manifest_file],self._didInit)

210# If we were unable to find the branch/SHA on the remote,211# clobbering the repo won't help any, so just abort the chain212ifhasattr(self.command,'stderr'):213if"Couldn't find remote ref"inself.command.stderr:214raiseAbandonChain(-1)215ifhasattr(self,'cherry_pick_failed')or"Automatic cherry-pick failed"inself.command.stderr:216raiseAbandonChain(-1)