summaryrefslogtreecommitdiff
path: root/config.py
blob: bd4668867154712fbd70f3da5b3e9e641eb7564e (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
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/python
# -*- coding: utf-8 -*-
from user import home
import commands
import os

time__ = commands.getoutput("date +%Y%m%d-%H:%M")

# Mirror Parameters
mirror = "mirrors.eu.kernel.org"
mirrorpath = "::mirrors/archlinux"

# Directories and files

## Optionals
path   = home + "/parabolagnulinux.org"
docs   = path + "/docs"
logdir = path + "/log"

## Must be defined
logname= logdir + "/" + time__ + "-repo-maintainer.log"
repodir= path + "/repo"
tmp    = home + "/tmp"
archdb = tmp  + "/db"

free_path= path + "/free/"

# Repo, arch, and other folders to use for repo
repo_list = ("core", "extra", "community", "testing", "community-testing", "multilib")
dir_list  = ("pool","sources")
arch_list = ("i686", "x86_64")
other     = ("any",)

# Output
output    = True
verbose   = False

# Files
blacklist = docs + "/blacklist.txt"
whitelist = docs + "/whitelist.txt"
pending   = docs + "/pending"
rsync_blacklist = docs + "/rsyncBlacklist"

# Rsync commands

rsync_list_command="rsync -a --no-motd --list-only "


# Classes and Exceptions
class NonValidFile(ValueError): pass
class NonValidDir(ValueError): pass
class NonValidCommand(ValueError): pass

class Package:
    """ An object that has information about a package. """
    package_info=dict()
    
    def __init__(self):
        self.package_info={ "name"    : False,
                            "version" : False,
                            "release" : False,
                            "arch"    : False,
                            "license" : False,
                            "location": False}
        
    def __setitem__(self, key, item):
        if key in self.package_info.keys():
            return self.package_info.__setitem__(key, item)
        else:
            raise ValueError("Package has no %s attribute" % key)

    def __getitem__(self, key):
        return self.package_info.__getitem__(key)
    
    def __unicode__(self):
        return str(self.package_info)

    def __repr__(self):
        return str(self.package_info)

    def __eq__(self,x):
        if not isinstance(x, Package):
            return False
        for key in self.package_info.keys():
                if x[key] != self[key]:
                    return False
        else:
            return True