]> git.ipfire.org Git - people/ms/pakfire.git/blob - python/pakfire/constants.py
Merge branch 'master' of ssh://git.ipfire.org/pub/git/oddments/pakfire
[people/ms/pakfire.git] / python / pakfire / constants.py
1 #!/usr/bin/python
2 ###############################################################################
3 # #
4 # Pakfire - The IPFire package management system #
5 # Copyright (C) 2011 Pakfire development team #
6 # #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
11 # #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
16 # #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
19 # #
20 ###############################################################################
21
22 import os.path
23
24 from errors import *
25
26 from __version__ import PAKFIRE_VERSION
27
28 PAKFIRE_LEAST_COMPATIBLE_VERSION = PAKFIRE_VERSION
29
30 SYSCONFDIR = "/etc"
31 SCRIPT_DIR = "/usr/lib/pakfire"
32
33 CONFIG_DIR = os.path.join(SYSCONFDIR, "pakfire.repos.d")
34 CONFIG_DIR_EXT = ".repo"
35 CONFIG_FILE = os.path.join(SYSCONFDIR, "pakfire.conf")
36
37 CACHE_DIR = "/var/cache/pakfire"
38 CCACHE_CACHE_DIR = os.path.join(CACHE_DIR, "ccache")
39 CACHE_ENVIRON_DIR = os.path.join(CACHE_DIR, "environments")
40 REPO_CACHE_DIR = os.path.join(CACHE_DIR, "repos")
41
42 LOCAL_BUILD_REPO_PATH = "/var/lib/pakfire/local"
43 LOCAL_TMP_PATH = "/var/tmp"
44
45 PACKAGES_DB_DIR = "var/lib/pakfire"
46 PACKAGES_DB = os.path.join(PACKAGES_DB_DIR, "packages.db")
47 PACKAGES_SOLV = os.path.join(PACKAGES_DB_DIR, "packages.solv")
48 REPOSITORY_DB = "index.db"
49
50 BUFFER_SIZE = 102400
51
52 # The size of the data chunks that are uploaded to the
53 # pakfire hub.
54 CHUNK_SIZE = BUFFER_SIZE
55
56 MIRRORLIST_MAXSIZE = 1024**2
57
58 MACRO_FILE_DIR = "/usr/lib/pakfire/macros"
59 MACRO_EXTENSION = ".macro"
60
61 METADATA_FORMAT = 0
62 METADATA_DOWNLOAD_LIMIT = 1024**2
63 METADATA_DOWNLOAD_PATH = "repodata"
64 METADATA_DOWNLOAD_FILE = "repomd.json"
65 METADATA_DATABASE_FILE = "packages.solv"
66
67 PACKAGE_FORMAT = 3
68 # XXX implement this properly
69 PACKAGE_FORMATS_SUPPORTED = [0, 1, 2, 3]
70 PACKAGE_EXTENSION = "pfm"
71 MAKEFILE_EXTENSION = "nm"
72
73 DATABASE_FORMAT = 3
74 DATABASE_FORMATS_SUPPORTED = [0, 1, 2, 3]
75
76 PACKAGE_FILENAME_FMT = "%(name)s-%(version)s-%(release)s.%(arch)s.%(ext)s"
77
78 BUILD_PACKAGES = [
79 "@Build",
80 "pakfire-build>=%s" % PAKFIRE_LEAST_COMPATIBLE_VERSION,
81 ]
82
83 # A script that is called, when a user is dropped to a chroot shell.
84 SHELL_SCRIPT = "/usr/lib/pakfire/chroot-shell"
85 SHELL_PACKAGES = ["elinks", "less", "vim", SHELL_SCRIPT,]
86 BUILD_ROOT = "/var/lib/pakfire/build"
87
88 SOURCE_DOWNLOAD_URL = "http://source.ipfire.org/source-3.x/"
89 SOURCE_CACHE_DIR = os.path.join(CACHE_DIR, "sources")
90
91 TIME_10M = 10
92 TIME_24H = 60*24
93
94 ORPHAN_DIRECTORIES = [
95 "lib", "lib64", "usr/lib", "usr/lib64", "libexec", "usr/libexec",
96 "bin", "sbin", "usr/bin", "usr/sbin", "usr/include", "usr/share",
97 "usr/share/man", "usr/share/man/man0", "usr/share/man/man1",
98 "usr/share/man/man2", "usr/share/man/man3", "usr/share/man/man4",
99 "usr/share/man/man5", "usr/share/man/man6", "usr/share/man/man7",
100 "usr/share/man/man8", "usr/share/man/man9", "usr/lib/pkgconfig",
101 ]
102 for i in ORPHAN_DIRECTORIES:
103 i = os.path.dirname(i)
104
105 if not i or i in ORPHAN_DIRECTORIES:
106 continue
107
108 ORPHAN_DIRECTORIES.append(i)
109
110 ORPHAN_DIRECTORIES.sort(cmp=lambda x,y: cmp(len(x), len(y)), reverse=True)
111
112 PACKAGE_INFO = """\
113 # Pakfire %(pakfire_version)s
114
115 # Package information
116 package
117 name = %(name)s
118 version = %(version)s
119 release = %(release)s
120 epoch = %(epoch)s
121 arch = %(arch)s
122
123 uuid = %(uuid)s
124 groups = %(groups)s
125 maintainer = %(maintainer)s
126 url = %(url)s
127 license = %(license)s
128
129 summary = %(summary)s
130
131 def description
132 %(description)s
133 end
134
135 type = %(type)s
136 size = %(inst_size)d
137 end
138
139 # Build information
140 build
141 host = %(build_host)s
142 id = %(build_id)s
143 time = %(build_time)d
144 end
145
146 # Distribution information
147 distribution
148 name = %(distro_name)s
149 release = %(distro_release)s
150 vendor = %(distro_vendor)s
151 maintainer = %(distro_maintainer)s
152 end
153
154 # Dependency information
155 dependencies
156 def prerequires
157 %(prerequires)s
158 end
159
160 def requires
161 %(requires)s
162 end
163
164 def provides
165 %(provides)s
166 end
167
168 def conflicts
169 %(conflicts)s
170 end
171
172 def obsoletes
173 %(obsoletes)s
174 end
175 end
176
177 # EOF
178 """
179 PACKAGE_INFO_DESCRIPTION_LINE = PACKAGE_INFO_DEPENDENCY_LINE = "\t\t%s"
180
181 # XXX make this configurable in pakfire.conf
182 PAKFIRE_MULTIINSTALL = ["kernel", "kernel-PAE",]
183
184 SCRIPTLET_INTERPRETER = "/bin/sh"
185 SCRIPTLET_TIMEOUT = 60 * 15
186
187 SCRIPTS = (
188 "prein",
189 "postin",
190 "preun",
191 "postun",
192 "preup",
193 "postup",
194 "posttransin",
195 "posttransun",
196 "posttransup",
197 )
198
199 LDCONFIG = "/sbin/ldconfig"
200
201 CONFIG_FILE_SUFFIX_NEW = ".paknew"
202 CONFIG_FILE_SUFFIX_SAVE = ".paksave"