2 # Copyright 1998-2013 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
5 from __future__ import unicode_literals
9 # ===========================================================================
10 # START OF CONSTANTS -- START OF CONSTANTS -- START OF CONSTANTS -- START OF
11 # ===========================================================================
13 # There are two types of variables here which can easily be confused,
14 # resulting in arbitrary bugs, mainly exposed with an offset
15 # installation (Prefix). The two types relate to the usage of
16 # config_root or target_root.
17 # The first, config_root (PORTAGE_CONFIGROOT), can be a path somewhere,
18 # from which all derived paths need to be relative (e.g.
19 # USER_CONFIG_PATH) without EPREFIX prepended in Prefix. This means
20 # config_root can for instance be set to "$HOME/my/config". Obviously,
21 # in such case it is not appropriate to prepend EPREFIX to derived
22 # constants. The default value of config_root is EPREFIX (in non-Prefix
23 # the empty string) -- overriding the value loses the EPREFIX as one
25 # Second there is target_root (ROOT) which is used to install somewhere
26 # completely else, in Prefix of limited use. Because this is an offset
27 # always given, the EPREFIX should always be applied in it, hence the
28 # code always prefixes them with EROOT.
29 # The variables in this file are grouped by config_root, target_root.
31 # variables used with config_root (these need to be relative)
32 USER_CONFIG_PATH = "etc/portage"
33 MAKE_CONF_FILE = USER_CONFIG_PATH + "/make.conf"
34 MODULES_FILE_PATH = USER_CONFIG_PATH + "/modules"
35 CUSTOM_PROFILE_PATH = USER_CONFIG_PATH + "/profile"
36 USER_VIRTUALS_FILE = USER_CONFIG_PATH + "/virtuals"
37 EBUILD_SH_ENV_FILE = USER_CONFIG_PATH + "/bashrc"
38 EBUILD_SH_ENV_DIR = USER_CONFIG_PATH + "/env"
39 CUSTOM_MIRRORS_FILE = USER_CONFIG_PATH + "/mirrors"
40 COLOR_MAP_FILE = USER_CONFIG_PATH + "/color.map"
41 PROFILE_PATH = USER_CONFIG_PATH + "/make.profile"
42 MAKE_DEFAULTS_FILE = PROFILE_PATH + "/make.defaults" # FIXME: not used
43 DEPRECATED_PROFILE_FILE = PROFILE_PATH + "/deprecated"
45 # variables used with targetroot (these need to be absolute, but not
46 # have a leading '/' since they are used directly with os.path.join on EROOT)
47 VDB_PATH = "var/db/pkg"
48 CACHE_PATH = "var/cache/edb"
49 PRIVATE_PATH = "var/lib/portage"
50 WORLD_FILE = PRIVATE_PATH + "/world"
51 WORLD_SETS_FILE = PRIVATE_PATH + "/world_sets"
52 CONFIG_MEMORY_FILE = PRIVATE_PATH + "/config"
53 NEWS_LIB_PATH = "var/lib/gentoo"
55 # these variables get EPREFIX prepended automagically when they are
56 # translated into their lowercase variants
57 DEPCACHE_PATH = "/var/cache/edb/dep"
58 GLOBAL_CONFIG_PATH = "/usr/share/portage/config"
60 # these variables are not used with target_root or config_root
61 # NOTE: Use realpath(__file__) so that python module symlinks in site-packages
62 # are followed back to the real location of the whole portage installation.
63 PORTAGE_BASE_PATH = os.path.join(os.sep, os.sep.join(os.path.realpath(__file__.rstrip("co")).split(os.sep)[:-3]))
64 PORTAGE_BIN_PATH = PORTAGE_BASE_PATH + "/bin"
65 PORTAGE_PYM_PATH = PORTAGE_BASE_PATH + "/pym"
66 LOCALE_DATA_PATH = PORTAGE_BASE_PATH + "/locale" # FIXME: not used
67 EBUILD_SH_BINARY = PORTAGE_BIN_PATH + "/ebuild.sh"
68 MISC_SH_BINARY = PORTAGE_BIN_PATH + "/misc-functions.sh"
69 SANDBOX_BINARY = "/usr/bin/sandbox"
70 FAKEROOT_BINARY = "/usr/bin/fakeroot"
71 BASH_BINARY = "/bin/bash"
72 MOVE_BINARY = "/bin/mv"
73 PRELINK_BINARY = "/usr/sbin/prelink"
75 INVALID_ENV_FILE = "/etc/spork/is/not/valid/profile.env"
76 REPO_NAME_FILE = "repo_name"
77 REPO_NAME_LOC = "profiles" + "/" + REPO_NAME_FILE
79 PORTAGE_PACKAGE_ATOM = "sys-apps/portage"
80 LIBC_PACKAGE_ATOM = "virtual/libc"
81 OS_HEADERS_PACKAGE_ATOM = "virtual/os-headers"
82 CVS_PACKAGE_ATOM = "dev-vcs/cvs"
83 GIT_PACKAGE_ATOM = "dev-vcs/git"
84 RSYNC_PACKAGE_ATOM = "net-misc/rsync"
86 INCREMENTALS = ("USE", "USE_EXPAND", "USE_EXPAND_HIDDEN",
87 "FEATURES", "ACCEPT_KEYWORDS",
88 "CONFIG_PROTECT_MASK", "CONFIG_PROTECT",
90 "PRELINK_PATH", "PRELINK_PATH_MASK",
91 "PROFILE_ONLY_VARIABLES",
92 "USE_EXPAND_IMPLICIT", "USE_EXPAND_UNPREFIXED")
93 EBUILD_PHASES = ("pretend", "setup", "unpack", "prepare", "configure",
94 "compile", "test", "install",
95 "package", "preinst", "postinst","prerm", "postrm",
96 "nofetch", "config", "info", "other")
97 SUPPORTED_FEATURES = frozenset([
98 "assume-digests", "binpkg-logs", "buildpkg", "buildsyspkg", "candy",
99 "ccache", "chflags", "clean-logs",
100 "collision-protect", "compress-build-logs", "compressdebug",
101 "compress-index", "config-protect-if-modified",
102 "digest", "distcc", "distcc-pump", "distlocks",
103 "downgrade-backup", "ebuild-locks", "fakeroot",
104 "fail-clean", "force-mirror", "force-prefix", "getbinpkg",
105 "installsources", "keeptemp", "keepwork", "fixlafiles", "lmirror",
107 "metadata-transfer", "mirror", "multilib-strict", "news",
108 "noauto", "noclean", "nodoc", "noinfo", "noman",
109 "nostrip", "notitles", "parallel-fetch", "parallel-install",
110 "prelink-checksums", "preserve-libs",
111 "protect-owned", "python-trace", "sandbox",
112 "selinux", "sesandbox", "sfperms",
113 "sign", "skiprocheck", "split-elog", "split-log", "splitdebug",
114 "strict", "stricter", "suidctl", "test", "test-fail-continue",
115 "unknown-features-filter", "unknown-features-warn",
117 "unmerge-logs", "unmerge-orphans", "userfetch", "userpriv",
118 "usersandbox", "usersync", "webrsync-gpg", "xattr"])
122 HASHING_BLOCKSIZE = 32768
123 MANIFEST1_HASH_FUNCTIONS = ("MD5", "SHA256", "RMD160")
124 MANIFEST1_REQUIRED_HASH = "MD5"
128 # 20120704 - After WHIRLPOOL is supported in stable portage:
129 # - Set manifest-hashes in gentoo-x86/metadata/layout.conf as follows:
130 # manifest-hashes = SHA256 SHA512 WHIRLPOOL
131 # - Add SHA512 and WHIRLPOOL to MANIFEST2_HASH_DEFAULTS.
132 # - Remove SHA1 and RMD160 from MANIFEST2_HASH_*.
136 # After WHIRLPOOL is supported in stable portage for at least 1 year:
137 # - Change MANIFEST2_REQUIRED_HASH to WHIRLPOOL.
138 # - Remove SHA256 from MANIFEST2_HASH_*.
139 # - Set manifest-hashes in gentoo-x86/metadata/layout.conf as follows:
140 # manifest-hashes = SHA512 WHIRLPOOL
142 # After SHA-3 is approved:
143 # - Add new hashes to MANIFEST2_HASH_*.
145 # After SHA-3 is supported in stable portage:
146 # - Set manifest-hashes in gentoo-x86/metadata/layout.conf as follows:
147 # manifest-hashes = SHA3 SHA512 WHIRLPOOL
149 # After layout.conf settings correspond to defaults in stable portage:
150 # - Remove redundant settings from gentoo-x86/metadata/layout.conf.
152 MANIFEST2_HASH_FUNCTIONS = ("SHA256", "SHA512", "WHIRLPOOL")
153 MANIFEST2_HASH_DEFAULTS = frozenset(["SHA256", "SHA512", "WHIRLPOOL"])
154 MANIFEST2_REQUIRED_HASH = "SHA256"
156 MANIFEST2_IDENTIFIERS = ("AUX", "MISC", "DIST", "EBUILD")
158 # The EPREFIX for the current install is hardcoded here, but access to this
159 # constant should be minimal, in favor of access via the EPREFIX setting of
160 # a config instance (since it's possible to contruct a config instance with
161 # a different EPREFIX). Therefore, the EPREFIX constant should *NOT* be used
162 # in the definition of any other constants within this file.
165 # pick up EPREFIX from the environment if set
166 if "PORTAGE_OVERRIDE_EPREFIX" in os.environ:
167 EPREFIX = os.environ["PORTAGE_OVERRIDE_EPREFIX"]
169 EPREFIX = os.path.normpath(EPREFIX)
170 if EPREFIX == os.sep:
173 VCS_DIRS = ("CVS", "RCS", "SCCS", ".bzr", ".git", ".hg", ".svn")
175 # ===========================================================================
176 # END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANTS -- END OF CONSTANT
177 # ===========================================================================
179 # Private constants for use in conditional code in order to minimize the diff
181 _DEPCLEAN_LIB_CHECK_DEFAULT = True
182 _ENABLE_REPO_NAME_WARN = True
183 _ENABLE_SET_CONFIG = True
184 _ENABLE_INHERIT_CHECK = True