Flutter Engine
The Flutter Engine
gen_repo.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2#
3# Copyright 2013 The Flutter Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7""" Generate a Fuchsia repo capable of serving Fuchsia archives over the
8network.
9"""
10import argparse
11import collections
12import json
13import os
14import subprocess
15import sys
16
17
18def main():
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', # Remove all previous registrations.
37 '-a', # Publish archives from an archive (mode).
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
51if __name__ == '__main__':
52 sys.exit(main())
def main()
Definition: gen_repo.py:18
Definition: main.py:1