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