]> git.draconx.ca Git - squashmirror.git/blob - portage/sync/modules/squashmirror/__init__.py
Fix for portage-2.3.0
[squashmirror.git] / portage / sync / modules / squashmirror / __init__.py
1 # Copyright © 2015-2016 Nick Bowler
2 #
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY of FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <https://www.gnu.org/licenses/>
15
16 from portage.sync.config_checks import CheckSyncConfig
17
18 class CheckSquashConfig(CheckSyncConfig):
19     def __init__(self, repo, logger):
20         CheckSyncConfig.__init__(self, repo, logger)
21         self.checks.append('set_defaults')
22
23     def set_defaults(self):
24         opts = self.repo.module_specific_options
25         if not 'squash-cache-location' in opts:
26             opts['squash-cache-location'] = "/var/cache/portage"
27         if not 'squash-compression' in opts:
28             opts['squash-compression'] = "gzip"
29         if not 'squash-extra-opts' in opts:
30             opts['squash-extra-opts'] = "-e distfiles -e packages -e local"
31
32 module_spec = {
33     'name': 'squashmirror',
34     'description': __doc__,
35     'provides': {
36         'squashmirror-module': {
37             'name': 'squashmirror',
38             'sourcefile': 'squashmirror',
39             'description': __doc__,
40             'class': 'SquashMirror',
41             'validate_config': CheckSquashConfig,
42             'module_specific_options': (
43                 'squash-cache-location',
44                 'squash-compression',
45                 'squash-extra-opts',
46             ),
47         }
48     }
49 }