From 8febe62cd4bf4167a159659379f45016dbd0364d Mon Sep 17 00:00:00 2001 From: "Marty E. Plummer" Date: Thu, 26 Apr 2018 23:37:39 -0500 Subject: [PATCH 1/3] setup.py: declare tab sizes and encoding for vim Signed-off-by: Marty E. Plummer --- setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/setup.py b/setup.py index c6b52dcf..07653807 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 From 12bd8af82b82ea083cd8c8de348e2f052b284c38 Mon Sep 17 00:00:00 2001 From: "Marty E. Plummer" Date: Thu, 26 Apr 2018 23:48:13 -0500 Subject: [PATCH 2/3] setup.py: use portage EPREFIX if available Only fixes installation paths; still needs work to run on prefix. Bug: https://bugs.gentoo.org/654128 Signed-off-by: Marty E. Plummer --- setup.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 07653807..bfcb7f3a 100755 --- a/setup.py +++ b/setup.py @@ -19,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 @@ -48,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): From af11676d88a88b8bb0e8633f6bcab77a6c50d4dc Mon Sep 17 00:00:00 2001 From: "Marty E. Plummer" Date: Fri, 27 Apr 2018 02:20:20 -0500 Subject: [PATCH 3/3] catalyst/defaults.py: use EPREFIX where apropriate Signed-off-by: Marty E. Plummer --- catalyst/defaults.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) 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'