llvm/update-git.py: Automatically commit the changes
This commit is contained in:
parent
0f157df1a3
commit
680c2e60c9
|
@ -79,8 +79,14 @@ hash = nix_prefetch_url(f'https://github.com/llvm/llvm-project/archive/{commit["
|
|||
print('Updating default.nix...')
|
||||
with fileinput.FileInput(DEFAULT_NIX, inplace=True) as f:
|
||||
for line in f:
|
||||
if match := re.search(r'^ rev-version = "unstable-(.+)";', line):
|
||||
old_date = match.group(1)
|
||||
result = re.sub(r'^ release_version = ".+";', f' release_version = "{release_version}";', line)
|
||||
result = re.sub(r'^ rev = ".*";', f' rev = "{commit["sha"]}";', result)
|
||||
result = re.sub(r'^ rev-version = ".+";', f' rev-version = "{version}";', result)
|
||||
result = re.sub(r'^ sha256 = ".+";', f' sha256 = "{hash}";', result)
|
||||
print(result, end='')
|
||||
# Commit the result:
|
||||
commit_message = f"llvmPackages_git: {old_date} -> {date}"
|
||||
subprocess.run(['git', 'add', DEFAULT_NIX], check=True)
|
||||
subprocess.run(['git', 'commit', '--file=-'], input=commit_message.encode(), check=True)
|
||||
|
|
Loading…
Reference in a new issue