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 faffe85c authored by Rob Nelson's avatar Rob Nelson
Browse files

Rewrite

parent 0f28c812
Pipeline #22 skipped
......@@ -4,75 +4,38 @@ import traceback
from buildtools import cmd, log, os_utils
from buildtools.repo.git import GitRepository
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()
log.info('Git repository on branch {0}, commit {1}.'.format(self.repo.current_branch, self.repo.current_commit))
else:
log.warn('Repo has not been cloned yet.')
def isUp2Date(self):
try:
return not self.repo.CheckForUpdates(branch=self.branch, quiet=False)
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, quiet=False)
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, quiet=False)
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...?')
target_dir = os.path.join('/tmp','jenkins','sourcemod')
os_utils.ensureDirExists(os.path.dirname(target_dir), noisy=True)
scm = GitRepo('https://github.com/alliedmodders/sourcemod.git', target_dir)
scm.preload()
scm.update()
with os_utils.Chdir(target_dir):
boost_dir = os.path.join('/tmp', 'jenkins', 'boost-sourcemod-socket')
os_utils.ensureDirExists(os.path.dirname(boost_dir), noisy=True)
if os.path.isdir(boost_dir)
with os_utils.Chdir(boost_dir):
cmd(['git','pull','origin','master'], echo=True, show_output=True, critical=True)
else:
cmd(['git','clone','https://github.com/boostorg/boost.git', boost_dir], echo=True, show_output=True, critical=True)
with os_utils.Chdir(boost_dir):
bootstrap_args=[
'--with-libraries=thread,system',
'--libdir=/tmp/jenkins/lib/socket-boost' ,
'--includedir=/tmp/jenkins/include/socket-boost',
'--exec-prefix=/tmp/jenkins'
]
cmd(['bash','./bootstrap.sh']+bootstrap_args, echo=True, show_output=True, critical=True)
b2_args=[
'cflags=-m32',
'cxxflags=-m32',
'address-model=32',
'threading=multi',
'architecture=x86',
'instruction-set=i686'
]
cmd(['./b2','./bootstrap.sh', '--with-libraries=thread,system'], echo=True, show_output=True, critical=True)
sm_dir = os.path.join('/tmp','jenkins','sourcemod-socket')
os_utils.ensureDirExists(os.path.dirname(sm_dir), noisy=True)
if os.path.isdir(sm_dir)
with os_utils.Chdir(sm_dir):
cmd(['git','pull','origin','master'], echo=True, show_output=True, critical=True)
else:
cmd(['git','clone','https://github.com/alliedmodders/sourcemod.git', sm_dir], echo=True, show_output=True, critical=True)
with os_utils.Chdir(sm_dir):
os_utils.ensureDirExists('build', noisy=True)
cmd(['bash', 'tools/checkout-deps.sh'], echo=True, show_output=True)
with os_utils.Chdir('build'):
......@@ -80,5 +43,5 @@ with os_utils.Chdir(target_dir):
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)
cmd(['python', 'configure.py'], echo=True, show_output=True, critical=True env=env)
cmd(['ambuild'], echo=True, show_output=True, critical=True, env=env)
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