Commit local changes from server made by Brecht
Never, ever, ever such situation should happen. From reading the change it seems it's related on making it possible to build releases from the buildbot.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
# <pep8 compliant>
|
||||
|
||||
# List of the branches being built automatically overnight
|
||||
NIGHT_SCHEDULE_BRANCHES = ["master"]
|
||||
NIGHT_SCHEDULE_BRANCHES = ["master", "blender-v2.81-release"]
|
||||
|
||||
# Dictionary that the buildmaster pays attention to.
|
||||
c = BuildmasterConfig = {}
|
||||
@@ -76,7 +76,7 @@ def schedule_force_build(name):
|
||||
name="branch",
|
||||
label="Branch:",
|
||||
default="master",
|
||||
regex=r'^[a-zA-Z0-9][A-Za-z0-9_-]*$'),
|
||||
regex=r'^[a-zA-Z0-9][A-Za-z0-9\._-]*$'),
|
||||
# Hide revision. We don't want to allow anyone to overwrite the
|
||||
# master build with an older version. Could be added back once we
|
||||
# have authentication.
|
||||
|
@@ -37,6 +37,7 @@ class Package:
|
||||
self.filename = os.path.basename(zipname)
|
||||
self.platform = self._get_platform(self.filename)
|
||||
self.branch = self._get_branch(self.filename)
|
||||
self.version = self._get_version(self.filename)
|
||||
|
||||
# extension stripping
|
||||
def _strip_extension(self, filename):
|
||||
@@ -76,6 +77,18 @@ class Package:
|
||||
return '-'.join(platform_tokens)
|
||||
|
||||
|
||||
def _get_version(self, filename):
|
||||
tokens = filename.split("-")
|
||||
|
||||
use_next_token = False
|
||||
for token in tokens:
|
||||
if use_next_token:
|
||||
return token
|
||||
elif token == "blender":
|
||||
use_next_token = True
|
||||
|
||||
return ""
|
||||
|
||||
def _get_branch(self, filename):
|
||||
tokens = filename.split("-")
|
||||
branch = ""
|
||||
@@ -128,6 +141,7 @@ def get_branch_platform(packages):
|
||||
# Extract branch and platform names
|
||||
branch = packages[0].branch
|
||||
platform = packages[0].platform
|
||||
version = packages[0].version
|
||||
|
||||
if platform == '':
|
||||
sys.stderr.write('Failed to detect platform ' +
|
||||
@@ -135,11 +149,11 @@ def get_branch_platform(packages):
|
||||
sys.exit(1)
|
||||
|
||||
for package in packages:
|
||||
if package.branch != branch or package.platform != platform:
|
||||
if package.branch != branch or package.platform != platform or package.version != version:
|
||||
sys.stderr.write('All packages in the zip file must have the same branch and platform\n')
|
||||
sys.exit(1)
|
||||
|
||||
return branch, platform
|
||||
return branch, platform, version
|
||||
|
||||
def extract_zipfile_packages(zipfile, packages, branch):
|
||||
# Extract packages from zip file
|
||||
@@ -160,14 +174,14 @@ def extract_zipfile_packages(zipfile, packages, branch):
|
||||
sys.stderr.write('Failed to unzip package: %s\n' % str(ex))
|
||||
sys.exit(1)
|
||||
|
||||
def remove_replaced_packages(branch, platform, new_packages):
|
||||
def remove_replaced_packages(branch, platform, version, new_packages):
|
||||
# Remove other files from the same platform and branch that are replaced
|
||||
# by the new packages.
|
||||
directory = get_download_dir(branch)
|
||||
|
||||
for filename in os.listdir(directory):
|
||||
package = Package(filename)
|
||||
if package.platform == platform and package.branch == branch:
|
||||
if package.platform == platform and package.branch == branch and package.version == version:
|
||||
is_new_package = False
|
||||
for new_package in new_packages:
|
||||
if package.filename == new_package.filename:
|
||||
@@ -175,6 +189,7 @@ def remove_replaced_packages(branch, platform, new_packages):
|
||||
|
||||
if not is_new_package:
|
||||
try:
|
||||
print("Removing older package version", filename)
|
||||
os.remove(os.path.join(directory, filename))
|
||||
except Exception as ex:
|
||||
sys.stderr.write('Failed to remove replaced package: %s\n' % str(ex))
|
||||
@@ -196,6 +211,7 @@ def remove_old_packages():
|
||||
file_mtime = os.stat(filepath).st_mtime
|
||||
if file_mtime < cutoff_time:
|
||||
try:
|
||||
print("Removing old branch build", filename)
|
||||
os.remove(filepath)
|
||||
except Exception as ex:
|
||||
sys.stderr.write('Failed to remove old package: %s\n' % str(ex))
|
||||
@@ -207,8 +223,8 @@ if __name__ == "__main__":
|
||||
|
||||
with open_zipfile(args.filename) as zipfile:
|
||||
packages = get_zipfile_packages(zipfile)
|
||||
branch, platform = get_branch_platform(packages)
|
||||
branch, platform, version = get_branch_platform(packages)
|
||||
extract_zipfile_packages(zipfile, packages, branch)
|
||||
remove_replaced_packages(branch, platform, version, packages)
|
||||
|
||||
remove_replaced_packages(branch, platform, packages)
|
||||
remove_old_packages()
|
||||
|
Reference in New Issue
Block a user