summaryrefslogtreecommitdiffstats
path: root/modules/packagesource.py
blob: bfead67d39c7517d8bf51bfe8f790a7106d2947f (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
70
71
72
73
74
75
76
# Fedora Developer Shell
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Library General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Authors: Yaakov M. Nemoy <ynemoy@redhat.com>
#
from __future__ import with_statement

from os import makedirs
from os.path import join

from base.util import pwd

from modules.directory import Directory

class PackageSource(Directory):

    def make_dir(self, dir):
        super(PackageSource, self).make_dir(dir)
        with pwd(dir):
            makedirs(self.pkg_src)
            makedirs(self.branch)

    @property
    def pkg_src(self):
        return '.pkg_src'
    
    @property
    def pkg_src_dir(self):
        return join(self.dir, self.pkg_src)

    @property
    def branch(self):
        return join(self.pkg_src, 'branches')

    @property
    def branch_dir(self):
        return join(self.dir, self.branch)

    @property
    def sourceball(self):
        return self.cfg['sourceball']
    
    @property
    def sourceball_loc(self):
        return join(self.pkg_src_dir, self.sourceball)

    def setup_sourceball(self):
        raise NotImplementedError

    def setup_sourceball_w_patches(self):
        raise NotImplementedError

    @property
    def source(self):
        '''the name of the directory where the source is being kept currently
        '''
        return self.cfg['source']

    @property
    def source_dir(self):
        '''the absolute pathname of the directory where the source is being kept currently
        '''
        return join(self.dir, self.source)