1
2 """
3
4 @author: Fabio Erculiani <lxnay@sabayonlinux.org>
5 @contact: lxnay@sabayonlinux.org
6 @copyright: Fabio Erculiani
7 @license: GPL-2
8
9 B{Entropy Package Manager Server Main Interfaces}.
10
11 I{ServerRepositoryStatus} is a singleton containing the status of
12 server-side repositories. It is used to determine if repository has
13 been modified (tainted) or has been revision bumped already.
14 Revision bumps are automatic and happen on the very first data "commit".
15 Every repository features a revision number which is stored into the
16 "packages.db.revision" file. Only server-side (or community) repositories
17 are subject to this automation (revision file update on commit).
18
19 """
20 from entropy.core import Singleton
21
23
24 """
25 Server-side Repositories status information container.
26 """
27
29 """ Singleton "constructor" """
30 self.__data = {}
31 self.__updates_log = {}
32
34 if db not in self.__data:
35 self.__data[db] = {}
36 self.__data[db]['tainted'] = False
37 self.__data[db]['bumped'] = False
38 self.__data[db]['unlock_msg'] = False
39
41 """
42 Set bit which determines if the unlock warning has been already
43 printed to user.
44
45 @param db: database identifier
46 @type db: string
47 """
48 self.__create_if_necessary(db)
49 self.__data[db]['unlock_msg'] = True
50
52 """
53 Unset bit which determines if the unlock warning has been already
54 printed to user.
55
56 @param db: database identifier
57 @type db: string
58 """
59 self.__create_if_necessary(db)
60 self.__data[db]['unlock_msg'] = False
61
63 """
64 Set bit which determines if the repository which db points to has been
65 modified.
66
67 @param db: database identifier
68 @type db: string
69 """
70 self.__create_if_necessary(db)
71 self.__data[db]['tainted'] = True
72
74 """
75 Unset bit which determines if the repository which db points to has been
76 modified.
77
78 @param db: database identifier
79 @type db: string
80 """
81 self.__create_if_necessary(db)
82 self.__data[db]['tainted'] = False
83
85 """
86 Set bit which determines if the repository which db points to has been
87 revision bumped.
88
89 @param db: database identifier
90 @type db: string
91 """
92 self.__create_if_necessary(db)
93 self.__data[db]['bumped'] = True
94
96 """
97 Unset bit which determines if the repository which db points to has been
98 revision bumped.
99
100 @param db: database identifier
101 @type db: string
102 """
103 self.__create_if_necessary(db)
104 self.__data[db]['bumped'] = False
105
107 """
108 Return whether repository which db points to has been modified.
109
110 @param db: database identifier
111 @type db: string
112 """
113 self.__create_if_necessary(db)
114 return self.__data[db]['tainted']
115
117 """
118 Return whether repository which db points to has been revision bumped.
119
120 @param db: database identifier
121 @type db: string
122 """
123 self.__create_if_necessary(db)
124 return self.__data[db]['bumped']
125
127 """
128 Return whether repository which db points to has outputed the unlock
129 warning message.
130
131 @param db: database identifier
132 @type db: string
133 """
134 self.__create_if_necessary(db)
135 return self.__data[db]['unlock_msg']
136
138 """
139 Return dict() object containing metadata related to package
140 updates occured in a server-side repository.
141 """
142 if db not in self.__updates_log:
143 self.__updates_log[db] = {}
144 return self.__updates_log[db]
145