OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This file is part of the Adblock Plus web scripts, | 3 # This file is part of the Adblock Plus web scripts, |
4 # Copyright (C) 2006-2013 Eyeo GmbH | 4 # Copyright (C) 2006-2013 Eyeo GmbH |
5 # | 5 # |
6 # Adblock Plus is free software: you can redistribute it and/or modify | 6 # Adblock Plus is free software: you can redistribute it and/or modify |
7 # it under the terms of the GNU General Public License version 3 as | 7 # it under the terms of the GNU General Public License version 3 as |
8 # published by the Free Software Foundation. | 8 # published by the Free Software Foundation. |
9 # | 9 # |
10 # Adblock Plus is distributed in the hope that it will be useful, | 10 # Adblock Plus is distributed in the hope that it will be useful, |
(...skipping 11 matching lines...) Expand all Loading... |
22 setupStderr() | 22 setupStderr() |
23 | 23 |
24 source = get_config().get('subscriptionDownloads', 'outdir') | 24 source = get_config().get('subscriptionDownloads', 'outdir') |
25 cvsroot = get_config().get('subscriptionDownloads', 'cvsroot') | 25 cvsroot = get_config().get('subscriptionDownloads', 'cvsroot') |
26 cvsdir = get_config().get('subscriptionDownloads', 'cvsdir') | 26 cvsdir = get_config().get('subscriptionDownloads', 'cvsdir') |
27 dest = tempfile.mkdtemp() | 27 dest = tempfile.mkdtemp() |
28 try: | 28 try: |
29 os.chdir(os.path.dirname(dest)) # Yes, CVS sucks | 29 os.chdir(os.path.dirname(dest)) # Yes, CVS sucks |
30 subprocess.check_call(['cvs', '-Q', '-d', cvsroot, 'checkout', '-d', os.path
.basename(dest), cvsdir]) | 30 subprocess.check_call(['cvs', '-Q', '-d', cvsroot, 'checkout', '-d', os.path
.basename(dest), cvsdir]) |
31 os.chdir(dest) | 31 os.chdir(dest) |
32 result = subprocess.check_output(['rsync', '-a', '--delete', '--out-format=%
o %n', '--exclude=CVS', source + '/', dest]) | 32 result = subprocess.check_output(['rsync', '-a', '--delete', '--out-format=%
o %n', '--exclude=CVS', source + os.path.sep, dest]) |
33 for line in result.split('\n'): | 33 for line in result.split('\n'): |
34 match = re.search(r'^(\S+)\s+(.*)', line) | 34 match = re.search(r'^(\S+)\s+(.*)', line) |
35 if match and match.group(1) == 'send': | 35 if match and match.group(1) == 'send': |
36 subprocess.check_call(['cvs', '-Q', 'add', match.group(2)]) | 36 subprocess.check_call(['cvs', '-Q', 'add', match.group(2)]) |
37 elif match and match.group(1) == 'del.': | 37 elif match and match.group(1) == 'del.': |
38 subprocess.check_call(['cvs', '-Q', 'remove', match.group(2)]) | 38 subprocess.check_call(['cvs', '-Q', 'remove', match.group(2)]) |
39 subprocess.check_call(['cvs', '-Q', 'commit', '-m', 'Uploading subscription
updates']) | 39 subprocess.check_call(['cvs', '-Q', 'commit', '-m', 'Uploading subscription
updates']) |
40 finally: | 40 finally: |
41 if os.path.exists(dest): | 41 if os.path.exists(dest): |
42 shutil.rmtree(dest, True) | 42 shutil.rmtree(dest, True) |
OLD | NEW |