2019-11-24 01:05:25 +01:00
|
|
|
#!/usr/bin/env python
|
2020-08-08 20:08:27 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2021-04-15 11:52:32 +02:00
|
|
|
# Copyright (c) 2019-2021 Péter Magyar
|
2019-12-22 19:20:38 +01:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
# of this software and associated documentation files (the "Software"), to deal
|
|
|
|
# in the Software without restriction, including without limitation the rights
|
|
|
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
# copies of the Software, and to permit persons to whom the Software is
|
|
|
|
# furnished to do so, subject to the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be included in all
|
|
|
|
# copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
# SOFTWARE.
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import json
|
|
|
|
|
2021-09-06 18:46:51 +02:00
|
|
|
import module_config
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
target_commits = {}
|
|
|
|
|
2020-02-11 17:06:06 +01:00
|
|
|
def setup_repository(data, clone_path, branch = 'master'):
|
2019-11-24 01:05:25 +01:00
|
|
|
cwd = os.getcwd()
|
|
|
|
|
|
|
|
full_path = cwd + clone_path + data[1] + '/'
|
|
|
|
|
|
|
|
if not os.path.isdir(full_path):
|
2020-03-24 16:58:37 +01:00
|
|
|
os.chdir(cwd + clone_path)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2019-12-01 23:32:36 +01:00
|
|
|
subprocess.call(clone_command.format(data[0][repository_index], data[1]), shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
os.chdir(full_path)
|
|
|
|
|
2020-03-24 16:58:37 +01:00
|
|
|
subprocess.call('git reset', shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
subprocess.call('git reset --hard', shell=True)
|
2020-04-09 15:15:22 +02:00
|
|
|
subprocess.call('git clean -f -d', shell=True)
|
2020-02-11 17:45:58 +01:00
|
|
|
subprocess.call('git checkout -B ' + branch + ' origin/' + branch, shell=True)
|
2020-06-18 11:35:05 +02:00
|
|
|
subprocess.call('git pull origin ' + branch, shell=True)
|
|
|
|
subprocess.call('git reset', shell=True)
|
|
|
|
subprocess.call('git reset --hard', shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2022-06-11 00:46:00 +02:00
|
|
|
target = ""
|
|
|
|
|
2019-11-24 01:05:25 +01:00
|
|
|
if data[1] in target_commits:
|
2020-02-11 17:06:06 +01:00
|
|
|
target = target_commits[data[1]][branch]
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2020-02-11 17:45:58 +01:00
|
|
|
subprocess.call('git checkout -B ' + branch + ' ' + target, shell=True)
|
2020-04-09 15:15:22 +02:00
|
|
|
subprocess.call('git clean -f -d', shell=True)
|
2020-03-24 16:58:37 +01:00
|
|
|
subprocess.call('git reset', shell=True)
|
2019-11-24 01:05:25 +01:00
|
|
|
subprocess.call('git reset --hard', shell=True)
|
|
|
|
|
|
|
|
os.chdir(cwd)
|
|
|
|
|
2022-06-11 00:46:00 +02:00
|
|
|
engine_abspath = os.path.abspath(module_config.engine_repository[1])
|
2020-01-06 16:59:54 +01:00
|
|
|
|
2022-06-11 00:46:00 +02:00
|
|
|
if not os.path.isdir(engine_abspath):
|
|
|
|
if not os.path.isfile('./HEADS'):
|
|
|
|
print("Error! HEADS file doesn't exists! Exiting.")
|
2020-01-06 22:37:24 +01:00
|
|
|
exit()
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2022-06-11 00:46:00 +02:00
|
|
|
with open('./HEADS', 'r') as infile:
|
|
|
|
target_commits = json.load(infile)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2022-06-11 00:46:00 +02:00
|
|
|
setup_repository(module_config.engine_repository, '/', module_config.pandemonium_branch)
|
2019-11-24 01:05:25 +01:00
|
|
|
|
|
|
|
|
2022-06-11 00:46:00 +02:00
|
|
|
SConscript("pandemonium_engine/misc/scripts_app/SConstruct")
|
2019-11-24 01:05:25 +01:00
|
|
|
|
2020-02-11 17:06:06 +01:00
|
|
|
|