]>
Commit | Line | Data |
---|---|---|
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 | |
22 | import os.path | |
23 | ||
53bb7960 MT |
24 | from errors import * |
25 | ||
4366c12d | 26 | from __version__ import PAKFIRE_VERSION |
14ea3228 | 27 | |
f165e102 | 28 | PAKFIRE_LEAST_COMPATIBLE_VERSION = PAKFIRE_VERSION |
c07a3ca7 | 29 | |
ad4542cf | 30 | SYSCONFDIR = "/etc" |
47a4cb89 MT |
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" | |
33f4679b | 36 | CCACHE_CACHE_DIR = os.path.join(CACHE_DIR, "ccache") |
1de8761d | 37 | REPO_CACHE_DIR = os.path.join(CACHE_DIR, "repos") |
33f4679b | 38 | |
0ec833c6 | 39 | LOCAL_BUILD_REPO_PATH = "/var/lib/pakfire/local" |
94438733 | 40 | LOCAL_TMP_PATH = "var/tmp/pakfire" |
47a4cb89 | 41 | |
66af936c MT |
42 | PACKAGES_DB_DIR = "var/lib/pakfire" |
43 | PACKAGES_DB = os.path.join(PACKAGES_DB_DIR, "packages.db") | |
fa6d335b | 44 | REPOSITORY_DB = "index.db" |
47a4cb89 | 45 | |
c1fbb0b7 | 46 | BUFFER_SIZE = 102400 |
47a4cb89 | 47 | |
a2d1644c MT |
48 | MIRRORLIST_MAXSIZE = 1024**2 |
49 | ||
c07a3ca7 MT |
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 | ||
3cf7127f MT |
54 | METADATA_FORMAT = 0 |
55 | METADATA_DOWNLOAD_LIMIT = 1024**2 | |
56 | METADATA_DOWNLOAD_PATH = "repodata" | |
2568a6d1 | 57 | METADATA_DOWNLOAD_FILE = "repomd.json" |
c605d735 | 58 | METADATA_DATABASE_FILE = "packages.solv" |
3cf7127f | 59 | |
c07a3ca7 MT |
60 | PACKAGE_FORMAT = 1 |
61 | # XXX implement this properly | |
62 | PACKAGE_FORMATS_SUPPORTED = [0, 1] | |
47a4cb89 MT |
63 | PACKAGE_EXTENSION = "pfm" |
64 | MAKEFILE_EXTENSION = "nm" | |
65 | ||
66 | PACKAGE_FILENAME_FMT = "%(name)s-%(version)s-%(release)s.%(arch)s.%(ext)s" | |
67 | ||
c07a3ca7 MT |
68 | BUILD_PACKAGES = [ |
69 | "@Build", | |
c07a3ca7 MT |
70 | "pakfire-build>=%s" % PAKFIRE_LEAST_COMPATIBLE_VERSION, |
71 | ] | |
72 | SHELL_PACKAGES = ["elinks", "less", "vim",] | |
47a4cb89 MT |
73 | BUILD_ROOT = "/var/lib/pakfire/build" |
74 | ||
75 | SOURCE_DOWNLOAD_URL = "http://source.ipfire.org/source-3.x/" | |
76 | SOURCE_CACHE_DIR = os.path.join(CACHE_DIR, "sources") | |
77 | ||
53ceed32 MT |
78 | TIME_10M = 10 |
79 | TIME_24H = 60*24 | |
1de8761d | 80 | |
8c617c20 MT |
81 | ORPHAN_DIRECTORIES = [ |
82 | "lib", "lib64", "usr/lib", "usr/lib64", "libexec", "usr/libexec", | |
83 | "bin", "sbin", "usr/bin", "usr/sbin", "usr/include", "usr/share", | |
84 | "usr/share/man", "usr/share/man/man0", "usr/share/man/man1", | |
85 | "usr/share/man/man2", "usr/share/man/man3", "usr/share/man/man4", | |
86 | "usr/share/man/man5", "usr/share/man/man6", "usr/share/man/man7", | |
87 | "usr/share/man/man8", "usr/share/man/man9", "usr/lib/pkgconfig", | |
88 | ] | |
c07a3ca7 MT |
89 | for i in ORPHAN_DIRECTORIES: |
90 | i = os.path.dirname(i) | |
8c617c20 | 91 | |
c07a3ca7 MT |
92 | if not i or i in ORPHAN_DIRECTORIES: |
93 | continue | |
47a4cb89 | 94 | |
c07a3ca7 | 95 | ORPHAN_DIRECTORIES.append(i) |
47a4cb89 | 96 | |
c07a3ca7 | 97 | ORPHAN_DIRECTORIES.sort(cmp=lambda x,y: cmp(len(x), len(y)), reverse=True) |
47a4cb89 | 98 | |
c07a3ca7 MT |
99 | PACKAGE_INFO = """\ |
100 | # Pakfire %(pakfire_version)s | |
47a4cb89 MT |
101 | |
102 | # Package information | |
c07a3ca7 MT |
103 | package |
104 | name = %(name)s | |
105 | version = %(version)s | |
106 | release = %(release)s | |
107 | epoch = %(epoch)s | |
108 | arch = %(arch)s | |
109 | ||
110 | uuid = %(uuid)s | |
111 | groups = %(groups)s | |
112 | maintainer = %(maintainer)s | |
113 | url = %(url)s | |
114 | license = %(license)s | |
115 | ||
116 | summary = %(summary)s | |
5dda54e4 | 117 | |
c07a3ca7 MT |
118 | def description |
119 | %(description)s | |
120 | end | |
121 | ||
122 | size = %(inst_size)d | |
123 | end | |
47a4cb89 | 124 | |
c07a3ca7 MT |
125 | # Build information |
126 | build | |
127 | host = %(build_host)s | |
128 | id = %(build_id)s | |
129 | time = %(build_time)d | |
130 | end | |
47a4cb89 | 131 | |
c07a3ca7 MT |
132 | # Distribution information |
133 | distribution | |
134 | name = %(distro_name)s | |
135 | release = %(distro_release)s | |
136 | vendor = %(distro_vendor)s | |
137 | maintainer = %(distro_maintainer)s | |
138 | end | |
139 | ||
140 | # Dependency information | |
141 | dependencies | |
142 | def prerequires | |
143 | %(prerequires)s | |
144 | end | |
145 | ||
146 | def requires | |
147 | %(requires)s | |
148 | end | |
149 | ||
150 | def provides | |
151 | %(provides)s | |
152 | end | |
153 | ||
154 | def conflicts | |
155 | %(conflicts)s | |
156 | end | |
157 | ||
158 | def obsoletes | |
159 | %(obsoletes)s | |
160 | end | |
161 | end | |
162 | ||
163 | # EOF | |
47a4cb89 | 164 | """ |
c07a3ca7 | 165 | PACKAGE_INFO_DESCRIPTION_LINE = PACKAGE_INFO_DEPENDENCY_LINE = "\t\t%s" |
063606f6 MT |
166 | |
167 | # XXX make this configurable in pakfire.conf | |
168 | PAKFIRE_MULTIINSTALL = ["kernel",] | |
94438733 MT |
169 | |
170 | SCRIPTLET_INTERPRETER = "/bin/sh" | |
171 | SCRIPTLET_TIMEOUT = 60 * 15 | |
172 | ||
c07a3ca7 MT |
173 | SCRIPTS = ( |
174 | "prein", | |
175 | "postin", | |
176 | "preun", | |
177 | "postun", | |
178 | "preup", | |
179 | "postup", | |
180 | "posttransin", | |
181 | "posttransun", | |
182 | "posttransup", | |
183 | ) |