19 parser = argparse.ArgumentParser()
20
21 parser.add_argument('--pm-bin', dest='pm_bin', action='store', required=True)
22 parser.add_argument('--repo-dir', dest='repo_dir', action='store', required=True)
23 parser.add_argument('--archive', dest='archives', action='append', required=True)
24
25 args = parser.parse_args()
26
27 assert os.path.exists(args.pm_bin)
28
29 if not os.path.exists(args.repo_dir):
30 pm_newrepo_command = [args.pm_bin, 'newrepo', '-repo', args.repo_dir]
31 subprocess.check_call(pm_newrepo_command)
32
33 pm_publish_command = [
34 args.pm_bin,
35 'publish',
36 '-C',
37 '-a',
38 '-repo',
39 args.repo_dir
40 ]
41
42 for archive in args.archives:
43 pm_publish_command.append('-f')
44 pm_publish_command.append(archive)
45
46 subprocess.check_call(pm_publish_command)
47
48 return 0
49
50