diff --git a/catalyst/defaults.py b/catalyst/defaults.py index f2fe29df..1398e0c7 100644 --- a/catalyst/defaults.py +++ b/catalyst/defaults.py @@ -11,6 +11,12 @@ else: TAR = 'bsd' +# establish the eprefix, initially set so eprefixify can +# set it on install +EPREFIX = "@GENTOO_PORTAGE_EPREFIX@".lstrip(os.sep) +# check and set it if it wasn't +if "GENTOO_PORTAGE_EPREFIX" in EPREFIX: + EPREFIX = '' # these should never be touched required_build_targets = ["targetbase", "generic_stage_target"] @@ -33,7 +39,7 @@ # set our base defaults here to keep # them in one location. -BASE_GENTOO_DIR = "/var/gentoo" +BASE_GENTOO_DIR = os.path.join(os.sep, EPREFIX, "var/gentoo") REPODIR = BASE_GENTOO_DIR + "/repos" DISTDIR = BASE_GENTOO_DIR + "/distfiles" PKGDIR = BASE_GENTOO_DIR + "/packages" @@ -50,7 +56,7 @@ "decompressor_search_order": DECOMPRESSOR_SEARCH_ORDER, "distdir": DISTDIR[:], "hash_function": "crc32", - "icecream": "/var/cache/icecream", + "icecream": os.path.join(os.sep, EPREFIX, "var/cache/icecream"), 'list_xattrs_opt': LIST_XATTRS_OPTIONS[TAR], "local_overlay": REPODIR[:] + "/local", "port_conf": "/etc/portage", @@ -58,22 +64,22 @@ "options": set(), "packagedir": PKGDIR[:], "portdir": PORTDIR[:], - "port_tmpdir": "/var/tmp/portage", + "port_tmpdir": os.path.join(os.sep, EPREFIX, "var/tmp/portage"), "PythonDir": "./catalyst", "repo_basedir": REPODIR[:], "repo_name": MAINREPO[:], "sed": "sed", - "sharedir": "/usr/share/catalyst", - "shdir": "/usr/share/catalyst/targets/", - "snapshot_cache": "/var/tmp/catalyst/snapshot_cache", + "sharedir": os.path.join(os.sep, EPREFIX, "usr/share/catalyst"), + "shdir": os.path.join(os.sep, EPREFIX, "usr/share/catalyst/targets/"), + "snapshot_cache": os.path.join(os.sep, EPREFIX, "var/tmp/catalyst/snapshot_cache"), "snapshot_name": "%(repo_name)s-", "source_matching": "strict", - "storedir": "/var/tmp/catalyst", + "storedir": os.path.join(os.sep, EPREFIX, "var/tmp/catalyst"), "target_distdir": DISTDIR[:], "target_pkgdir": PKGDIR[:], } -DEFAULT_CONFIG_FILE = '/etc/catalyst/catalyst.conf' +DEFAULT_CONFIG_FILE = os.path.join(os.sep, EPREFIX, 'etc/catalyst/catalyst.conf') PORT_LOGDIR_CLEAN = \ 'find "${PORT_LOGDIR}" -type f ! -name "summary.log*" -mtime +30 -delete' diff --git a/setup.py b/setup.py index c6b52dcf..bfcb7f3a 100755 --- a/setup.py +++ b/setup.py @@ -1,4 +1,6 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- +# vim: tabstop=4 noexpandtab shiftwidth=4 """Catalyst is a release building tool used by Gentoo Linux""" from __future__ import print_function @@ -17,6 +19,12 @@ _package_name = 'catalyst' _maintainer_name, _maintainer_email = _parseaddr(__maintainer__) +# establish the eprefix, initially set so eprefixify can +# set it on install +EPREFIX = "@GENTOO_PORTAGE_EPREFIX@".lstrip(_os.sep) +# check and set it if it wasn't +if "GENTOO_PORTAGE_EPREFIX" in EPREFIX: + EPREFIX = '' def _posix_path(path): """Convert a native path to a POSIX path @@ -46,12 +54,18 @@ def _files(prefix, root): yield (install_directory, file_source_paths) -_data_files = [('/etc/catalyst', ['etc/catalyst.conf','etc/catalystrc']), - ('/usr/share/man/man1', ['files/catalyst.1']), - ('/usr/share/man/man5', ['files/catalyst-config.5', 'files/catalyst-spec.5']) +_data_files = [ + (_os.path.join(_os.sep, EPREFIX, 'etc/catalyst'), + ['etc/catalyst.conf','etc/catalystrc']), + (_os.path.join(_os.sep, EPREFIX, 'usr/share/man/man1'), + ['files/catalyst.1']), + (_os.path.join(_os.sep, EPREFIX, 'usr/share/man/man5'), + ['files/catalyst-config.5', 'files/catalyst-spec.5']) ] -_data_files.extend(_files('share/catalyst/livecd', 'livecd')) -_data_files.extend(_files('share/catalyst/targets', 'targets')) +_data_files.extend(_files(_os.path.join(_os.sep, EPREFIX, + 'usr/share/catalyst/livecd'), 'livecd')) +_data_files.extend(_files(_os.path.join(_os.sep, EPREFIX, + 'usr/share/catalyst/targets'), 'targets')) class set_version(_Command):