Just deleted about 400 bot accounts and a bunch of spam. To mitigate this in the future, we've enabled reCaptcha on signup. Let me know if someone got caught in the crossfire.

Commit 9805967d authored by Rob Nelson's avatar Rob Nelson
Browse files

Initial commit

parents
Pipeline #7 skipped
from buildtools import cmd, log, os_utils
from buildtools.repo import GitRepository
import traceback, os, sys
class GitRepo(object):
'''Addon stored in a git repository.'''
#: Control directory.
EXCLUDE_DIRS = ['.git']
def __init__(self, source, dest, branch='master):
self.remote = source
self.branch = branch
self.destination=dest
self._initRepo()
def _initRepo(self):
self.repo = GitRepository(self.destination, self.remote, noisy_clone=True, quiet=False)
def getRepoLocation(self):
return self.destination
def preload(self):
if not os.path.isdir(self.destination):
self.repo.GetRepoState()
self.log.info('Git repository on branch {0}, commit {1}.'.format(self.repo.current_branch, self.repo.current_commit))
else:
self.log.warn('Repo has not been cloned yet.')
def isUp2Date(self):
try:
return not self.repo.CheckForUpdates(branch=self.branch)
except Exception as e:
log.error(traceback.format_exc())
return False
def update(self):
with log.info('Updating from a git repository...'):
cleanup = True
try:
self.repo.CheckForUpdates(branch=self.branch)
except Exception as e:
log.error('An issue occurred while checking the remote repository for updates.')
log.error(traceback.format_exc())
log.error('We will now attempt to re-clone.')
self.remove()
if os.path.isdir(self.destination):
log.critical('UNABLE TO REMOVE %s!', self.destination)
sys.exit(-1)
self._initRepo()
old_commit = self.repo.current_commit
cloned = not os.path.isdir(self.destination)
self.repo.Pull(branch=self.branch, cleanup=cleanup)
if cloned or old_commit != self.repo.remote_commit:
log.info('Updated!')
return True
return False
def remove(self):
if os.path.isdir(self.destination):
with os_utils.TimeExecution('Removed ' + self.destination):
os_utils.safe_rmtree(self.destination)
os.rmdir(self.destination)
else:
log.warn('Directory removal already done...?')
scm = GitRepo('https://github.com/alliedmodders/sourcemod.git','/tmp/jenkins/sourcemod')
scm.preload()
if not scm.isUp2Date():
scm.update()
with os_utils.Chdir('/tmp/jenkins/sourcemod'):
os_utils.ensureDirExists('build',quiet=False)
with os_utils.Chdir('build'):
#CFLAGS="${CFLAGS} -Wno-sign-compare" CXXFLAGS="${CXXFLAGS} -Wno-sign-compare" python ../configure.py
env = os_utils.BuildEnv()
env.appendTo('CFLAGS', '-Wno-sign-compare',delim=' ')
env.appendTo('CXXFLAGS', '-Wno-sign-compare',delim=' ')
cmd(['python','/tmp/jenkins/sourcemod/configure.py'],echo=True, show_output=True, env=env)
cmd(['ambuild'],echo=True, show_output=True, env=env)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment