OLD | NEW |
1 # This file is part of the Adblock Plus web scripts, | 1 # This file is part of the Adblock Plus web scripts, |
2 # Copyright (C) 2006-2016 Eyeo GmbH | 2 # Copyright (C) 2006-2016 Eyeo GmbH |
3 # | 3 # |
4 # Adblock Plus is free software: you can redistribute it and/or modify | 4 # Adblock Plus is free software: you can redistribute it and/or modify |
5 # it under the terms of the GNU General Public License version 3 as | 5 # it under the terms of the GNU General Public License version 3 as |
6 # published by the Free Software Foundation. | 6 # published by the Free Software Foundation. |
7 # | 7 # |
8 # Adblock Plus is distributed in the hope that it will be useful, | 8 # Adblock Plus is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
(...skipping 15 matching lines...) Expand all Loading... |
26 while not os.path.isdir(os.path.join(repo, '.hg')): | 26 while not os.path.isdir(os.path.join(repo, '.hg')): |
27 if len(repo) < 4: | 27 if len(repo) < 4: |
28 raise Exception('Mercurial repository not found for path %s' % path) | 28 raise Exception('Mercurial repository not found for path %s' % path) |
29 repo = os.path.dirname(repo) | 29 repo = os.path.dirname(repo) |
30 return (repo, os.path.relpath(path, repo)) | 30 return (repo, os.path.relpath(path, repo)) |
31 | 31 |
32 | 32 |
33 def chown((uid, gid), dirname, names): | 33 def chown((uid, gid), dirname, names): |
34 for name in names: | 34 for name in names: |
35 os.chown(os.path.join(dirname, name), uid, gid) | 35 os.chown(os.path.join(dirname, name), uid, gid) |
36 if (name.endswith('.fcgi') or name.endswith('.sh') or name.endswith('.pl
')): | 36 if name.endswith('.fcgi') or name.endswith('.sh') or name.endswith('.pl'
): |
37 os.chmod(os.path.join(dirname, name), 0755) | 37 os.chmod(os.path.join(dirname, name), 0755) |
38 | 38 |
39 | 39 |
40 def syncFiles(name, settings, syncState): | 40 def syncFiles(name, settings, syncState): |
41 repo, path = splitRepositoryPath(settings['source']) | 41 repo, path = splitRepositoryPath(settings['source']) |
42 | 42 |
43 command = ['hg', 'log', '-R', repo, '-r', 'default', '--template', '{node|sh
ort}'] | 43 command = ['hg', 'log', '-R', repo, '-r', 'default', '--template', '{node|sh
ort}'] |
44 currentRevision = subprocess.check_output(command) | 44 currentRevision = subprocess.check_output(command) |
45 | 45 |
46 if not syncState.has_section(name): | 46 if not syncState.has_section(name): |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 syncStateFile = get_config().get('filesync', 'syncData') | 128 syncStateFile = get_config().get('filesync', 'syncData') |
129 if os.path.exists(syncStateFile): | 129 if os.path.exists(syncStateFile): |
130 syncState.read(syncStateFile) | 130 syncState.read(syncStateFile) |
131 | 131 |
132 settings = readSyncSettings() | 132 settings = readSyncSettings() |
133 for name, value in settings.iteritems(): | 133 for name, value in settings.iteritems(): |
134 syncFiles(name, value, syncState) | 134 syncFiles(name, value, syncState) |
135 | 135 |
136 file = open(syncStateFile, 'wb') | 136 file = open(syncStateFile, 'wb') |
137 syncState.write(file) | 137 syncState.write(file) |
OLD | NEW |