chg: [Updater] change default branch origin

pull/497/head
Terrtia 2020-04-20 17:16:19 +02:00
parent ad64264ca8
commit bec7c52485
No known key found for this signature in database
GPG Key ID: 1E1B1F50D84613D0
1 changed files with 10 additions and 1 deletions

View File

@ -16,6 +16,10 @@ import argparse
import subprocess import subprocess
sys.path.append(os.path.join(os.environ['AIL_BIN'], 'packages')) # # TODO: move other functions
import git_status
UPDATER_FILENAME = os.path.join(os.environ['AIL_BIN'], 'Update.py') UPDATER_FILENAME = os.path.join(os.environ['AIL_BIN'], 'Update.py')
UPDATER_LAST_MODIFICATION = float(os.stat(UPDATER_FILENAME).st_mtime) UPDATER_LAST_MODIFICATION = float(os.stat(UPDATER_FILENAME).st_mtime)
@ -29,6 +33,7 @@ def auto_update_enabled(cfg):
# check if files are modify locally # check if files are modify locally
def check_if_files_modified(): def check_if_files_modified():
return True
process = subprocess.run(['git', 'ls-files' ,'-m'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) process = subprocess.run(['git', 'ls-files' ,'-m'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if process.returncode == 0: if process.returncode == 0:
modified_files = process.stdout modified_files = process.stdout
@ -51,6 +56,9 @@ def repo_is_fork():
if 'origin {}'.format(AIL_REPO) in res: if 'origin {}'.format(AIL_REPO) in res:
print(' This repository is a {}clone of {}{}'.format(TERMINAL_BLUE, AIL_REPO, TERMINAL_DEFAULT)) print(' This repository is a {}clone of {}{}'.format(TERMINAL_BLUE, AIL_REPO, TERMINAL_DEFAULT))
return False return False
elif 'origin {}'.format(OLD_AIL_REPO) in res:
print(' old AIL repository, Updating remote origin...')
git_status.set_default_remote(AIL_REPO, verbose=False)
else: else:
print(' This repository is a {}fork{}'.format(TERMINAL_BLUE, TERMINAL_DEFAULT)) print(' This repository is a {}fork{}'.format(TERMINAL_BLUE, TERMINAL_DEFAULT))
print() print()
@ -354,7 +362,8 @@ if __name__ == "__main__":
TERMINAL_BLINK = '\33[6m' TERMINAL_BLINK = '\33[6m'
TERMINAL_DEFAULT = '\033[0m' TERMINAL_DEFAULT = '\033[0m'
AIL_REPO = 'https://github.com/CIRCL/AIL-framework.git' AIL_REPO = 'https://github.com/ail-project/ail-framework'
OLD_AIL_REPO = 'https://github.com/CIRCL/AIL-framework.git'
configfile = os.path.join(os.environ['AIL_HOME'], 'configs/update.cfg') configfile = os.path.join(os.environ['AIL_HOME'], 'configs/update.cfg')
if not os.path.exists(configfile): if not os.path.exists(configfile):