2023-01-29 12:39:58 +08:00
|
|
|
import os
|
|
|
|
import git
|
2023-03-15 16:20:59 +08:00
|
|
|
import subprocess
|
2023-01-29 12:39:58 +08:00
|
|
|
from release_helper import *
|
|
|
|
|
|
|
|
repo = git.Repo(REPO_PATH)
|
|
|
|
commit_head = repo.head.commit.hexsha
|
|
|
|
pkgReleases = PackageReleaseList(PACKAGE_RELEASE_PATH)
|
|
|
|
|
2023-03-15 16:20:59 +08:00
|
|
|
for folder in os.listdir(LINUX_PACKAGE_PATH):
|
|
|
|
# skip PikaStdLib
|
|
|
|
if folder == "PikaStdLib" or folder == "GTestTask" or folder == "TemplateDevice":
|
|
|
|
continue
|
|
|
|
# call `bash pkg-push $folder`
|
|
|
|
cmd = f"./pkg-push.sh {folder}"
|
|
|
|
output = subprocess.check_output(["bash", "-c", cmd])
|
2023-05-03 22:23:06 +08:00
|
|
|
print(output.decode())
|
2023-03-15 16:20:59 +08:00
|
|
|
|
2023-01-29 12:39:58 +08:00
|
|
|
# for each folder in package, run the following command
|
|
|
|
for folder in os.listdir(PACKAGE_PATH):
|
2023-02-13 19:54:16 +08:00
|
|
|
# skip PikaStdLib
|
2023-03-15 16:20:59 +08:00
|
|
|
if folder == "PikaStdLib" or folder == "GTestTask" or folder == "TemplateDevice":
|
2023-02-13 19:54:16 +08:00
|
|
|
continue
|
2023-01-29 12:39:58 +08:00
|
|
|
if os.path.isdir(PACKAGE_PATH + "/" + folder):
|
|
|
|
# check git diff
|
2023-02-13 19:54:16 +08:00
|
|
|
diff = repo.git.diff(
|
|
|
|
"HEAD",
|
|
|
|
pkgReleases.latestCommit(folder),
|
|
|
|
WORK_DIR + "/" + PACKAGE_PATH + "/" + folder
|
|
|
|
)
|
2023-01-29 12:39:58 +08:00
|
|
|
if diff != '':
|
|
|
|
newVersion = pkgReleases.versionRelease(
|
2023-02-13 19:54:16 +08:00
|
|
|
folder,
|
|
|
|
VersoinType.PATCH,
|
|
|
|
commit_head
|
|
|
|
)
|
2023-01-29 12:39:58 +08:00
|
|
|
print(f"Changes detected: {folder} --> {newVersion}")
|
|
|
|
|
|
|
|
pkgReleases.dump(PACKAGE_RELEASE_PATH)
|
|
|
|
exit()
|