aboutsummaryrefslogtreecommitdiff
blob: 460ccfad3392e32f78fb9a4e43148948c5af0bd3 (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
#!/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",
    ["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):

        vars_before_inherit = \
          ["repo_uri", "source_type", "realname", ("digest_sources", "yes")]

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

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

        layout = Layout(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):

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

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

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

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

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