aboutsummaryrefslogtreecommitdiff
blob: cf1b2dd1349f28156fcd26b19413523b909048af (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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
    ebuild.py
    ~~~~~~~~~~~~~
    
    ebuild generation
    
    :copyright: (c) 2013 by Jauhien Piatlicki
    :license: GPL-2, see LICENSE for more details.
"""

import collections

from g_sorcery.ebuild import DefaultEbuildGenerator

Layout = collections.namedtuple("Layout",
    ["eapi", "vars_before_inherit", "inherit",
     "vars_after_description", "vars_after_keywords"])
  

class ElpaEbuildWithDigestGenerator(DefaultEbuildGenerator):
    """
    Implementation of ebuild generator with sources digesting.
    """
    def __init__(self, package_db):

        eapi = "7"

        vars_before_inherit = \
          ["repo_uri", "source_type", "realname", {"name" : "digest_sources", "value" : "yes"}]

        inherit = ["g-sorcery", "gs-elpa"]
        
        vars_after_description = \
          ["homepage", {"name" : "src_uri", "value" : "${REPO_URI}${REALNAME}-${PV}.${SUFFIX}"}]

        vars_after_keywords = \
          ["depend", "rdepend"]

        layout = Layout(eapi, vars_before_inherit, inherit,
                    vars_after_description, vars_after_keywords)

        super(ElpaEbuildWithDigestGenerator, self).__init__(package_db, layout)

class ElpaEbuildWithoutDigestGenerator(DefaultEbuildGenerator):
    """
    Implementation of ebuild generator without sources digesting.
    """
    def __init__(self, package_db):

        eapi = "7"

        vars_before_inherit = \
          ["repo_uri", "source_type", "realname"]

        inherit = ["g-sorcery", "gs-elpa"]
        
        vars_after_description = \
          ["homepage"]

        vars_after_keywords = \
          ["depend", "rdepend"]

        layout = Layout(eapi, vars_before_inherit, inherit,
                    vars_after_description, vars_after_keywords)

        super(ElpaEbuildWithoutDigestGenerator, self).__init__(package_db, layout)