Skip to content

Commit

Permalink
修正格式规范
Browse files Browse the repository at this point in the history
  • Loading branch information
xiong-kq committed Feb 6, 2025
1 parent fc5ec2f commit bec8de7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 41 deletions.
4 changes: 2 additions & 2 deletions easypackages/epkg_translate/translate/src/reschedule_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

if __name__ == "__main__":
parser = argparse.ArgumentParser(description="全量转换策略")
parser.add_argument("-f", required=False, help="指定repo文件更新,逗号分隔",
parser.add_argument("-f", required=False, help="指定repo文件更新,逗号分隔",
default="")
args = parser.parse_args()

Expand All @@ -16,7 +16,7 @@
repo_toml = args.f.split(",")
else:
# rpm_repos文件夹下所有toml文件转换
repo_toml = [f for f in os.listdir(repo_toml_path)
repo_toml = [f for f in os.listdir(repo_toml_path)
if os.path.isfile(os.path.join(repo_toml_path, f))]

toml_info = parse_toml(repo_toml)
Expand Down
6 changes: 3 additions & 3 deletions easypackages/epkg_translate/translate/src/schedule_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ def run(self):
command = "submit -m -c translate_job.yaml rpm_baseurl={0} \
repo_name={1} translate_strategy=all".format(baseurl,
channel)
subprocess.Popen(command, shell=True,
subprocess.Popen(command, shell=True,
text=True, capture_output=True)
else:
# 增量转换
if repos_info["repo_name"] == "update":
if repos_info["watch_update"]:
command = "submit -m -c translate_job.yaml \
rpm_baseurl={0} repo_name={1} \
translate_strategy=delta".format(baseurl,
translate_strategy=delta".format(baseurl,
channel)
subprocess.Popen(command, shell=True,
subprocess.Popen(command, shell=True,
text=True, capture_output=True)
count += 1
submit_job_count += 1
Expand Down
72 changes: 36 additions & 36 deletions easypackages/epkg_translate/translate/src/schedule_repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,20 @@ def parse_toml(repo_toml=[]):
repo_info.append(everything_repo_info_dic)
if "repos" in config and "update" in config["repos"] \
and "watch_update" in config["repos"]["update"]:
repo_update_baseurl = \
config["repos"]["update"]["baseurl"]
watch_update = \
config["repos"]["update"]["watch_update"]
update_repo_info_dic = {
"channel": channel,
"arch": arch,
"repo_name": "update",
"baseurl": repo_update_baseurl,
"watch_update": watch_update,
"os": repo_os,
"os_version": repo_os_version
}
repo_info.append(update_repo_info_dic)
repo_update_baseurl = \
config["repos"]["update"]["baseurl"]
watch_update = \
config["repos"]["update"]["watch_update"]
update_repo_info_dic = {
"channel": channel,
"arch": arch,
"repo_name": "update",
"baseurl": repo_update_baseurl,
"watch_update": watch_update,
"os": repo_os,
"os_version": repo_os_version
}
repo_info.append(update_repo_info_dic)
else:
# 增量转换策略
for root, dirs, files in os.walk(repos_dir):
Expand All @@ -76,35 +76,35 @@ def parse_toml(repo_toml=[]):
arch = config["arch"]
if "repos" in config and "update" in config["repos"] \
and "watch_update" in config["repos"]["update"]:
repo_update_baseurl = \
config["repos"]["update"]["baseurl"]
watch_update = \
config["repos"]["update"]["watch_update"]
update_repo_info_dic = {
"channel": channel,
"arch": arch,
"repo_name": "update",
"baseurl": repo_update_baseurl,
"watch_update": watch_update,
"os": repo_os,
"os_version": repo_os_version
}
repo_info.append(update_repo_info_dic)
repo_update_baseurl = \
config["repos"]["update"]["baseurl"]
watch_update = \
config["repos"]["update"]["watch_update"]
update_repo_info_dic = {
"channel": channel,
"arch": arch,
"repo_name": "update",
"baseurl": repo_update_baseurl,
"watch_update": watch_update,
"os": repo_os,
"os_version": repo_os_version
}
repo_info.append(update_repo_info_dic)
return repo_info


def main():
""""函数入口"""
rp_info = parse_toml()
if rp_info:
print("submit job...")
submitjob = SubmitJob(rp_info, strategy="delta")
ret = submitjob.run()
if ret == 0:
print("submit job success")
else:
print("submit job failed")
sys.exit(1)
print("submit job...")
submitjob = SubmitJob(rp_info, strategy="delta")
ret = submitjob.run()
if ret == 0:
print("submit job success")
else:
print("submit job failed")
sys.exit(1)
else:
print("parse yaml file failed")
sys.exit(1)
Expand Down

0 comments on commit bec8de7

Please sign in to comment.