This repository has been archived by the owner on Apr 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsync
executable file
·61 lines (53 loc) · 1.97 KB
/
sync
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
#
# This file is part of Liri.
#
# Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
#
# $BEGIN_LICENSE:GPL3+$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# $END_LICENSE$
#
import os
import argparse
import yaml
from builder import command, prepare
URL = 'liri@liri.io:/srv/www/repo.liri.io/flatpak'
def copy_flatpakref(metadata):
"""
Copy flatpakref files to the Liri site.
:param metadata: App metadata.
"""
for ver in ('stable', 'unstable'):
filename = 'flatpakref/{}-{}.flatpakref'.format(metadata['name'], ver)
if os.path.exists(filename):
print('Copy: {}'.format(filename))
command(['scp', filename, URL])
if __name__ == '__main__':
import copy
# Parse command line arguments
parser = argparse.ArgumentParser()
parser.add_argument('--repo', help='OSTree repository',
action='store', default='repo')
args = parser.parse_args()
# Copy flatpakref files and rsync OSTree repository
with open('.metadata.yml', 'r') as f:
metadata = yaml.load(f)
for app in metadata['apps']:
app_metadata = copy.deepcopy(app)
app_metadata.update({'sdk-version': metadata['sdk-version']})
copy_flatpakref(app_metadata)
command(['./rsync-repos', '--src', args.repo + '/', '--dest', os.path.join(URL, 'apps/')], output=True)