first commit

This commit is contained in:
2026-09-13 22:23:14 +01:00
commit 6ccc800045
337 changed files with 63275 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os, sys
UPLOAD_SCRIPT = os.path.join(Extension.sm_root, 'tools', 'buildbot', 'upload_symbols.py')
if 'BREAKPAD_SYMBOL_SERVER' in os.environ:
symbolServer = os.environ['BREAKPAD_SYMBOL_SERVER']
builder.SetBuildFolder('breakpad-symbols')
for cxx_task in Extension.extensions:
if cxx_task.target.platform in ['windows']:
debug_entry = cxx_task.debug
else:
debug_entry = cxx_task.binary
debug_file = os.path.join(builder.buildPath, debug_entry.path)
if cxx_task.target.platform == 'linux':
argv = ['dump_syms', debug_file, os.path.dirname(debug_file)]
elif cxx_task.target.platform == 'mac':
# Required once dump_syms is updated on the slaves.
#argv = ['dump_syms', '-g', debug_file + '.dSYM', debug_file]
argv = ['dump_syms', debug_file + '.dSYM']
elif cxx_task.target.platform == 'windows':
argv = ['dump_syms.exe', debug_file]
plat_dir = os.path.dirname(debug_file)
bin_dir = os.path.split(plat_dir)[0]
symbol_file = '{}-{}-{}.breakpad'.format(
os.path.split(bin_dir)[1],
cxx_task.target.platform,
cxx_task.target.arch)
argv = [sys.executable, UPLOAD_SCRIPT, symbol_file] + argv
builder.AddCommand(
inputs = [UPLOAD_SCRIPT, debug_entry],
argv = argv,
outputs = [symbol_file]
)
+59
View File
@@ -0,0 +1,59 @@
import os
builder.SetBuildFolder('package')
def CreateFolders(folders):
folder_dict = {}
for folder in folders:
path = os.path.normpath(folder)
folder_dict[folder] = builder.AddFolder(path)
return folder_dict
def CopyFiles(src, dest):
if os.path.isfile(src):
builder.AddCopy(src, dest)
return
if os.path.isdir(src):
for root, _, files in os.walk(src):
for file in files:
file_path = os.path.join(root, file)
relative_path = os.path.relpath(file_path, src)
destination = os.path.join(dest, relative_path)
builder.AddCopy(file_path, destination)
folders = CreateFolders([
'addons/sourcemod/extensions',
'addons/sourcemod/extensions/x64',
'addons/sourcemod/gamedata',
'addons/sourcemod/scripting',
'addons/sourcemod/scripting/include'
])
pdblog = open(os.path.join(builder.buildPath, 'pdblog.txt'), 'wt')
for cxx_task in Extension.extensions:
if cxx_task.target.arch == 'x86_64':
builder.AddCopy(cxx_task.binary, folders['addons/sourcemod/extensions/x64'])
else:
builder.AddCopy(cxx_task.binary, folders['addons/sourcemod/extensions'])
pdblog.write(cxx_task.debug.path + '\n')
pdblog.close()
def distribute_package_files():
package_path = os.path.join(Extension.ext_root, "package")
if not os.path.isdir(package_path):
return
for root, _, files in os.walk(package_path):
for file in files:
file_path = os.path.join(root, file)
relative_path = os.path.relpath(file_path, package_path)
for folder in folders:
if relative_path.startswith(folder):
builder.AddCopy(file_path, folders[folder])
break
distribute_package_files()
debug_info = []
+50
View File
@@ -0,0 +1,50 @@
# vim: set ts=8 sts=2 sw=2 tw=99 et ft=python:
import os, sys
import re
builder.SetBuildFolder('/')
includes = builder.AddFolder('includes')
argv = [
sys.executable,
os.path.join(builder.sourcePath, 'buildbot', 'generate_header.py'),
os.path.join(Extension.ext_root),
os.path.join(builder.buildPath, 'includes'),
]
outputs = [
os.path.join(builder.buildFolder, 'includes', 'version_auto.h')
]
repo_head_path = os.path.join(Extension.ext_root, 'product.version')
if os.path.exists(os.path.join(Extension.ext_root, '.git')):
with open(os.path.join(Extension.ext_root, '.git', 'HEAD')) as fp:
head_contents = fp.read().strip()
if re.search('^[a-fA-F0-9]{40}$', head_contents):
repo_head_path = os.path.join(Extension.ext_root, '.git', 'HEAD')
else:
git_state = head_contents.split(':')[1].strip()
repo_head_path = os.path.join(Extension.ext_root, '.git', git_state)
if not os.path.exists(repo_head_path):
repo_head_path = os.path.join(Extension.ext_root, '.git', 'HEAD')
sources = [
os.path.join(Extension.ext_root, 'product.version'),
repo_head_path,
argv[1]
]
for source in sources:
if not os.path.exists(source):
print(source)
for source in sources:
if not os.path.exists(source):
print(source)
output_nodes = builder.AddCommand(
inputs=sources,
argv=argv,
outputs=outputs
)
rvalue = output_nodes
+63
View File
@@ -0,0 +1,63 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os, sys
import re
import subprocess
argv = sys.argv[1:]
if len(argv) < 2:
sys.stderr.write('Usage: generate_header.py <source_path> <output_folder>\n')
sys.exit(1)
SourceFolder = os.path.abspath(os.path.normpath(argv[0]))
OutputFolder = os.path.abspath(os.path.normpath(argv[1]))
def run_and_return(argv):
text = subprocess.check_output(argv)
if str != bytes:
text = str(text, 'utf-8')
return text.strip()
def GetGHVersion():
p = run_and_return(['hg', 'parent', '-R', SourceFolder])
m = re.match(r'changeset:\s+(\d+):(.+)', p.stdoutText)
if m == None:
raise Exception('Could not determine repository version')
return m.groups()
def GetGitVersion():
revision_count = run_and_return(['git', 'rev-list', '--count', 'HEAD'])
revision_hash = run_and_return(['git', 'log', '--pretty=format:%h:%H', '-n', '1'])
shorthash, longhash = revision_hash.split(':')
return revision_count, shorthash
rev = None
cset = None
rev, cset = GetGitVersion()
productFile = open(os.path.join(SourceFolder, 'product.version'), 'r')
productContents = productFile.read()
productFile.close()
m = re.match(r'(\d+)\.(\d+)\.(\d+)(.*)', productContents)
if m == None:
raise Exception('Could not determine product version')
major, minor, release, tag = m.groups()
version_auto_path = os.path.join(OutputFolder, 'version_auto.h')
incFile = open(version_auto_path, 'w')
incFile.write("""
#ifndef _AUTO_VERSION_INFORMATION_H_
#define _AUTO_VERSION_INFORMATION_H_
#define SM_BUILD_TAG \"{0}\"
#define SM_BUILD_UNIQUEID \"{1}:{2}\" SM_BUILD_TAG
#define SM_VERSION \"{3}.{4}.{5}\"
#define SM_FULL_VERSION SM_VERSION SM_BUILD_TAG
#define SM_FILE_VERSION {6},{7},{8},0
#endif /* _AUTO_VERSION_INFORMATION_H_ */
""".format(tag, rev, cset, major, minor, release, major, minor, release))
incFile.close()
filename_versioning_path = os.path.join(OutputFolder, 'filename_versioning.txt')
filename_versioning = open(filename_versioning_path, 'w')
filename_versioning.write("{0}.{1}.{2}-git{3}-{4}".format(major, minor, release, rev, cset))
filename_versioning.close()