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