]> git.ipfire.org Git - pakfire.git/blob - python/pakfire/constants.py
eb4a5529a97a2b8a65a1680aa5cc5dbb5433c306
[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
32 CONFIG_DIR = os.path.join(SYSCONFDIR, "pakfire.repos.d")
33 CONFIG_FILE = os.path.join(SYSCONFDIR, "pakfire.conf")
34
35 CACHE_DIR = "/var/cache/pakfire"
36 CCACHE_CACHE_DIR = os.path.join(CACHE_DIR, "ccache")
37 REPO_CACHE_DIR = os.path.join(CACHE_DIR, "repos")
38
39 LOCAL_BUILD_REPO_PATH = "/var/lib/pakfire/local"
40 LOCAL_TMP_PATH = "var/tmp/pakfire"
41
42 PACKAGES_DB_DIR = "var/lib/pakfire"
43 PACKAGES_DB = os.path.join(PACKAGES_DB_DIR, "packages.db")
44 REPOSITORY_DB = "index.db"
45
46 BUFFER_SIZE = 102400
47
48 MIRRORLIST_MAXSIZE = 1024**2
49
50 MACRO_FILE_DIR = "/usr/lib/pakfire/macros"
51 MACRO_FILES = \
52 (os.path.join(MACRO_FILE_DIR, f) for f in sorted(os.listdir(MACRO_FILE_DIR)) if f.endswith(".macro"))
53
54 METADATA_FORMAT = 0
55 METADATA_DOWNLOAD_LIMIT = 1024**2
56 METADATA_DOWNLOAD_PATH = "repodata"
57 METADATA_DOWNLOAD_FILE = "repomd.json"
58 METADATA_DATABASE_FILE = "packages.solv"
59
60 PACKAGE_FORMAT = 2
61 # XXX implement this properly
62 PACKAGE_FORMATS_SUPPORTED = [0, 1, 2]
63 PACKAGE_EXTENSION = "pfm"
64 MAKEFILE_EXTENSION = "nm"
65
66 DATABASE_FORMAT = 1
67 DATABASE_FORMATS_SUPPORTED = [0, 1]
68
69 PACKAGE_FILENAME_FMT = "%(name)s-%(version)s-%(release)s.%(arch)s.%(ext)s"
70
71 BUILD_PACKAGES = [
72 "@Build",
73 "pakfire-build>=%s" % PAKFIRE_LEAST_COMPATIBLE_VERSION,
74 ]
75
76 # A script that is called, when a user is dropped to a chroot shell.
77 SHELL_SCRIPT = "/usr/lib/pakfire/chroot-shell"
78 SHELL_PACKAGES = ["elinks", "less", "vim", SHELL_SCRIPT,]
79 BUILD_ROOT = "/var/lib/pakfire/build"
80
81 SOURCE_DOWNLOAD_URL = "http://source.ipfire.org/source-3.x/"
82 SOURCE_CACHE_DIR = os.path.join(CACHE_DIR, "sources")
83
84 TIME_10M = 10
85 TIME_24H = 60*24
86
87 ORPHAN_DIRECTORIES = [
88 "lib", "lib64", "usr/lib", "usr/lib64", "libexec", "usr/libexec",
89 "bin", "sbin", "usr/bin", "usr/sbin", "usr/include", "usr/share",
90 "usr/share/man", "usr/share/man/man0", "usr/share/man/man1",
91 "usr/share/man/man2", "usr/share/man/man3", "usr/share/man/man4",
92 "usr/share/man/man5", "usr/share/man/man6", "usr/share/man/man7",
93 "usr/share/man/man8", "usr/share/man/man9", "usr/lib/pkgconfig",
94 ]
95 for i in ORPHAN_DIRECTORIES:
96 i = os.path.dirname(i)
97
98 if not i or i in ORPHAN_DIRECTORIES:
99 continue
100
101 ORPHAN_DIRECTORIES.append(i)
102
103 ORPHAN_DIRECTORIES.sort(cmp=lambda x,y: cmp(len(x), len(y)), reverse=True)
104
105 PACKAGE_INFO = """\
106 # Pakfire %(pakfire_version)s
107
108 # Package information
109 package
110 name = %(name)s
111 version = %(version)s
112 release = %(release)s
113 epoch = %(epoch)s
114 arch = %(arch)s
115
116 uuid = %(uuid)s
117 groups = %(groups)s
118 maintainer = %(maintainer)s
119 url = %(url)s
120 license = %(license)s
121
122 summary = %(summary)s
123
124 def description
125 %(description)s
126 end
127
128 type = %(type)s
129 size = %(inst_size)d
130 end
131
132 # Build information
133 build
134 host = %(build_host)s
135 id = %(build_id)s
136 time = %(build_time)d
137 end
138
139 # Distribution information
140 distribution
141 name = %(distro_name)s
142 release = %(distro_release)s
143 vendor = %(distro_vendor)s
144 maintainer = %(distro_maintainer)s
145 end
146
147 # Dependency information
148 dependencies
149 def prerequires
150 %(prerequires)s
151 end
152
153 def requires
154 %(requires)s
155 end
156
157 def provides
158 %(provides)s
159 end
160
161 def conflicts
162 %(conflicts)s
163 end
164
165 def obsoletes
166 %(obsoletes)s
167 end
168 end
169
170 # EOF
171 """
172 PACKAGE_INFO_DESCRIPTION_LINE = PACKAGE_INFO_DEPENDENCY_LINE = "\t\t%s"
173
174 # XXX make this configurable in pakfire.conf
175 PAKFIRE_MULTIINSTALL = ["kernel",]
176
177 SCRIPTLET_INTERPRETER = "/bin/sh"
178 SCRIPTLET_TIMEOUT = 60 * 15
179
180 SCRIPTS = (
181 "prein",
182 "postin",
183 "preun",
184 "postun",
185 "preup",
186 "postup",
187 "posttransin",
188 "posttransun",
189 "posttransup",
190 )
191
192 LDCONFIG = "/sbin/ldconfig"