aboutsummaryrefslogtreecommitdiff
blob: 534a1d5628675b07879a71dfb3751e781c155544 (plain)
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
# Copyright 2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

doc = """WebRSync plug-in module for portage.
Performs a http download of a portage snapshot, verifies and
unpacks it to the repo location."""
__doc__ = doc[:]


import os

from portage.sync.config_checks import CheckSyncConfig


DEFAULT_CLASS = "WebRsync"
AVAILABLE_CLASSES = ["WebRsync", "PyWebRsync"]
options = {"1": "WebRsync", "2": "PyWebRsync"}


config_class = DEFAULT_CLASS
try:
    test_param = os.environ["TESTIT"]
    if test_param in options:
        config_class = options[test_param]
except KeyError:
    pass


module_spec = {
    "name": "webrsync",
    "description": doc,
    "provides": {
        "webrsync-module": {
            "name": "webrsync",
            "sourcefile": "webrsync",
            "class": config_class,
            "description": doc,
            "functions": ["sync", "new", "exists"],
            "func_desc": {
                "sync": "Performs an archived http download of the "
                + "repository, then unpacks it.  Optionally it performs a "
                + "gpg verification of the downloaded file(s)",
                "new": "Creates the new repository at the specified location",
                "exists": "Returns a boolean of whether the specified dir "
                + "exists and is a valid repository",
            },
            "validate_config": CheckSyncConfig,
            "module_specific_options": (
                "sync-webrsync-delta",
                "sync-webrsync-keep-snapshots",
                "sync-webrsync-verify-signature",
            ),
        },
    },
}