yum-sync: Migrate to newer tools

This commit is contained in:
Zenithal 2021-06-11 17:26:38 +08:00
parent 0bdf77b473
commit 867883dc24
No known key found for this signature in database
GPG Key ID: 1189C659F3D04C1C
2 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,10 @@
FROM centos:8
MAINTAINER Hongren Zheng <hongren.zheng@tuna.tsinghua.edu.cn>
RUN dnf makecache && \
dnf install -y 'dnf-command(reposync)' createrepo_c wget curl
RUN mkdir -p /home/tunasync-scripts
ENV HOME=/tmp
CMD /bin/bash

View File

@ -197,6 +197,7 @@ def main():
conf.write(''' conf.write('''
[main] [main]
keepcache=0 keepcache=0
cachedir={cache_dir}
''') ''')
for name, url in combination_os_comp(arch): for name, url in combination_os_comp(arch):
conf.write(f''' conf.write(f'''
@ -219,7 +220,7 @@ enabled=1
failed.append(('', arch)) failed.append(('', arch))
continue continue
cmd_args = ["reposync", "-a", arch, "-c", conf.name, "-d", "-p", str(args.working_dir.absolute()), "-e", cache_dir] cmd_args = ["dnf", "reposync", "-a", arch, "-c", conf.name, "--delete", "-p", str(args.working_dir.absolute())]
print("Launching reposync", flush=True) print("Launching reposync", flush=True)
# print(cmd_args) # print(cmd_args)
ret = sp.run(cmd_args) ret = sp.run(cmd_args)
@ -232,7 +233,7 @@ enabled=1
if args.download_repodata: if args.download_repodata:
download_repodata(url, path) download_repodata(url, path)
else: else:
cmd_args = ["createrepo", "--update", "-v", "-c", cache_dir, "-o", str(path), str(path)] cmd_args = ["createrepo_c", "--update", "-v", "-c", cache_dir, "-o", str(path), str(path)]
# print(cmd_args) # print(cmd_args)
ret = sp.run(cmd_args) ret = sp.run(cmd_args)
calc_repo_size(path) calc_repo_size(path)