From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 48A1F139082 for ; Wed, 29 Nov 2017 17:20:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 53C38E0BEF; Wed, 29 Nov 2017 17:20:48 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 188E4E0BEF for ; Wed, 29 Nov 2017 17:20:47 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8C22C33E4AD for ; Wed, 29 Nov 2017 17:20:46 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 19547ABD3 for ; Wed, 29 Nov 2017 17:20:45 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1511313381.d5f54e2693f4277fee370927ef18265ebcc52ac1.dolsen@gentoo> Subject: [gentoo-commits] proj/catalyst:master commit in: catalyst/, catalyst/base/, etc/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py catalyst/defaults.py etc/catalyst.conf X-VCS-Directories: catalyst/base/ etc/ catalyst/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: d5f54e2693f4277fee370927ef18265ebcc52ac1 X-VCS-Branch: master Date: Wed, 29 Nov 2017 17:20:45 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: fc84c2b8-9c8e-4cdb-8200-072c53bcea52 X-Archives-Hash: 78d0b41c4bc5c266f9cb5617a1abe185 commit: d5f54e2693f4277fee370927ef18265ebcc52ac1 Author: Brian Dolbec gentoo org> AuthorDate: Thu Mar 9 09:14:04 2017 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Wed Nov 22 01:16:21 2017 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d5f54e26 base/stagebase.py: Seperate out the writing of the make.conf file By sepaerating out the writing of the make.conf file, it keeps all code to do so in one place. I also fixed the code to correctly set the target chroot directories for PORTDIR, DISTDIR, PKGDIR and PORTDIR_OVERLAY. The same code also re-writes make.conf toggling any PORTDIR_OVERLAY setting during the clean() run. Add target_distdir and target_pkgdir settings to defaults and catalyst.conf. This allows for more flexibility between host and target settings. They can be individually configured this way. Update target an source mounts from the configured settings. catalyst/base/stagebase.py | 194 ++++++++++++++++++++++++--------------------- catalyst/defaults.py | 2 + etc/catalyst.conf | 2 + 3 files changed, 106 insertions(+), 92 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 532f0997..67382b9a 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -213,8 +213,13 @@ class StageBase(TargetBase, ClearBase, GenBase): self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"] # initialize our source mounts self.mountmap = SOURCE_MOUNT_DEFAULTS.copy() - # update them from settings + # update these from settings + self.mountmap["portdir"] = self.settings["portdir"] self.mountmap["distdir"] = self.settings["distdir"] + self.target_mounts["portdir"] = normpath(self.settings["repo_basedir"] + + "/" + self.settings["repo_name"]) + self.target_mounts["distdir"] = self.settings["target_distdir"] + self.target_mounts["packagedir"] = self.settings["target_pkgdir"] if "snapcache" not in self.settings["options"]: self.mounts.remove("portdir") self.mountmap["portdir"] = None @@ -1051,96 +1056,106 @@ class StageBase(TargetBase, ClearBase, GenBase): if os.path.exists(hosts_file): os.rename(hosts_file, hosts_file + '.catalyst') shutil.copy('/etc/hosts', hosts_file) + # write out the make.conf + try: + self.write_make_conf(setup=True) + except OSError as e: + raise CatalystError('Could not write %s: %s' % ( + normpath(self.settings["chroot_path"] + + self.settings["make_conf"]), e)) + self.resume.enable("chroot_setup") - # Modify and write out make.conf (for the chroot) - makepath = normpath(self.settings["chroot_path"] + - self.settings["make_conf"]) - clear_path(makepath) - myf = open(makepath, "w") - myf.write("# These settings were set by the catalyst build script " - "that automatically\n# built this stage.\n") - myf.write("# Please consult " - "/usr/share/portage/config/make.conf.example " - "for a more\n# detailed example.\n") - - for flags in ["CFLAGS", "CXXFLAGS", "FCFLAGS", "FFLAGS", "LDFLAGS", - "ASFLAGS"]: - if not flags in self.settings: - continue - if flags in ["LDFLAGS", "ASFLAGS"]: - myf.write("# %s is unsupported. USE AT YOUR OWN RISK!\n" - % flags) - if (flags is not "CFLAGS" and - self.settings[flags] == self.settings["CFLAGS"]): - myf.write('%s="${CFLAGS}"\n' % flags) - elif isinstance(self.settings[flags], list): - myf.write('%s="%s"\n' - % (flags, ' '.join(self.settings[flags]))) - else: - myf.write('%s="%s"\n' - % (flags, self.settings[flags])) - - if "CBUILD" in self.settings: - myf.write("# This should not be changed unless you know exactly" - " what you are doing. You\n# should probably be " - "using a different stage, instead.\n") - myf.write('CBUILD="' + self.settings["CBUILD"] + '"\n') - - if "CHOST" in self.settings: - myf.write("# WARNING: Changing your CHOST is not something " - "that should be done lightly.\n# Please consult " - "https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable " - "before changing.\n") - myf.write('CHOST="' + self.settings["CHOST"] + '"\n') - - # Figure out what our USE vars are for building - myusevars = [] - if "HOSTUSE" in self.settings: - myusevars.extend(self.settings["HOSTUSE"]) - - if "use" in self.settings: - myusevars.extend(self.settings["use"]) - - if myusevars: - myf.write("# These are the USE and USE_EXPAND flags that were " - "used for\n# building in addition to what is provided " - "by the profile.\n") - myusevars = sorted(set(myusevars)) - myf.write('USE="' + ' '.join(myusevars) + '"\n') - if '-*' in myusevars: - log.warning( - 'The use of -* in %s/use will cause portage to ignore\n' - 'package.use in the profile and portage_confdir.\n' - "You've been warned!", self.settings['spec_prefix']) - - myuseexpandvars = {} - if "HOSTUSEEXPAND" in self.settings: - for hostuseexpand in self.settings["HOSTUSEEXPAND"]: - myuseexpandvars.update( - {hostuseexpand:self.settings["HOSTUSEEXPAND"][hostuseexpand]}) - - if myuseexpandvars: - for hostuseexpand in myuseexpandvars: - myf.write(hostuseexpand + '="' + - ' '.join(myuseexpandvars[hostuseexpand]) + '"\n') - - myf.write('PORTDIR="%s"\n' % self.settings['portdir']) - myf.write('DISTDIR="%s"\n' % self.settings['distdir']) - myf.write('PKGDIR="%s"\n' % self.settings['packagedir']) - + def write_make_conf(self, setup=True): + # Modify and write out make.conf (for the chroot) + makepath = normpath(self.settings["chroot_path"] + + self.settings["make_conf"]) + clear_path(makepath) + myf = open(makepath, "w") + myf.write("# These settings were set by the catalyst build script " + "that automatically\n# built this stage.\n") + myf.write("# Please consult " + "/usr/share/portage/config/make.conf.example " + "for a more\n# detailed example.\n") + + for flags in ["CFLAGS", "CXXFLAGS", "FCFLAGS", "FFLAGS", "LDFLAGS", + "ASFLAGS"]: + if not flags in self.settings: + continue + if flags in ["LDFLAGS", "ASFLAGS"]: + myf.write("# %s is unsupported. USE AT YOUR OWN RISK!\n" + % flags) + if (flags is not "CFLAGS" and + self.settings[flags] == self.settings["CFLAGS"]): + myf.write('%s="${CFLAGS}"\n' % flags) + elif isinstance(self.settings[flags], list): + myf.write('%s="%s"\n' + % (flags, ' '.join(self.settings[flags]))) + else: + myf.write('%s="%s"\n' + % (flags, self.settings[flags])) + + if "CBUILD" in self.settings: + myf.write("# This should not be changed unless you know exactly" + " what you are doing. You\n# should probably be " + "using a different stage, instead.\n") + myf.write('CBUILD="' + self.settings["CBUILD"] + '"\n') + + if "CHOST" in self.settings: + myf.write("# WARNING: Changing your CHOST is not something " + "that should be done lightly.\n# Please consult " + "https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable " + "before changing.\n") + myf.write('CHOST="' + self.settings["CHOST"] + '"\n') + + # Figure out what our USE vars are for building + myusevars = [] + if "HOSTUSE" in self.settings: + myusevars.extend(self.settings["HOSTUSE"]) + + if "use" in self.settings: + myusevars.extend(self.settings["use"]) + + if myusevars: + myf.write("# These are the USE and USE_EXPAND flags that were " + "used for\n# building in addition to what is provided " + "by the profile.\n") + myusevars = sorted(set(myusevars)) + myf.write('USE="' + ' '.join(myusevars) + '"\n') + if '-*' in myusevars: + log.warning( + 'The use of -* in %s/use will cause portage to ignore\n' + 'package.use in the profile and portage_confdir.\n' + "You've been warned!", self.settings['spec_prefix']) + + myuseexpandvars = {} + if "HOSTUSEEXPAND" in self.settings: + for hostuseexpand in self.settings["HOSTUSEEXPAND"]: + myuseexpandvars.update( + {hostuseexpand:self.settings["HOSTUSEEXPAND"][hostuseexpand]}) + + if myuseexpandvars: + for hostuseexpand in myuseexpandvars: + myf.write(hostuseexpand + '="' + + ' '.join(myuseexpandvars[hostuseexpand]) + '"\n') + # write out a shipable version + target_portdir = normpath(self.settings["repo_basedir"] + "/" + + self.settings["repo_name"]) + + myf.write('PORTDIR="%s"\n' % target_portdir) + myf.write('DISTDIR="%s"\n' % self.settings['target_distdir']) + myf.write('PKGDIR="%s"\n' % self.settings['target_pkgdir']) + if setup: # Setup the portage overlay if "portage_overlay" in self.settings: myf.write('PORTDIR_OVERLAY="%s"\n' % self.settings["local_overlay"]) - # Set default locale for system responses. #478382 - myf.write( - '\n' - '# This sets the language of build output to English.\n' - '# Please keep this setting intact when reporting bugs.\n' - 'LC_MESSAGES=C\n') - - myf.close() - self.resume.enable("chroot_setup") + # Set default locale for system responses. #478382 + myf.write( + '\n' + '# This sets the language of build output to English.\n' + '# Please keep this setting intact when reporting bugs.\n' + 'LC_MESSAGES=C\n') + myf.close() def fsscript(self): if "autoresume" in self.settings["options"] \ @@ -1183,12 +1198,7 @@ class StageBase(TargetBase, ClearBase, GenBase): make_conf = self.settings['chroot_path'] + self.settings['make_conf'] try: - with open(make_conf) as f: - data = f.readlines() - data = ''.join(x for x in data - if not x.startswith('PORTDIR_OVERLAY')) - with open(make_conf, 'w') as f: - f.write(data) + self.write_make_conf(setup=False) except OSError as e: raise CatalystError('Could not update %s: %s' % (make_conf, e)) diff --git a/catalyst/defaults.py b/catalyst/defaults.py index 0bba6f4d..84ed2822 100644 --- a/catalyst/defaults.py +++ b/catalyst/defaults.py @@ -59,6 +59,8 @@ confdefaults={ "snapshot_name": "portage-", "source_matching": "strict", "storedir": "/var/tmp/catalyst", + "target_distdir": "/var/portage/distfiles", + "target_pkgdir":"/var/portage/packages", } DEFAULT_CONFIG_FILE = '/etc/catalyst/catalyst.conf' diff --git a/etc/catalyst.conf b/etc/catalyst.conf index 2e61ea4f..b4db063c 100644 --- a/etc/catalyst.conf +++ b/etc/catalyst.conf @@ -85,6 +85,8 @@ portdir="/usr/portage" # repo_basedir="/usr" repo_name="portage" +target_distdir="/usr/portage/distfiles" +target_pkgdir="/usr/portage/packages" # sharedir specifies where all of the catalyst runtime executables # and other shared lib objects are. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 92B75139083 for ; Wed, 22 Nov 2017 15:52:48 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3472AE0EB7; Wed, 22 Nov 2017 15:52:47 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 07180E0EB5 for ; Wed, 22 Nov 2017 15:52:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id BB76C340988 for ; Wed, 22 Nov 2017 15:52:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 64E73A3CE for ; Wed, 22 Nov 2017 15:52:44 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1511313381.d5f54e2693f4277fee370927ef18265ebcc52ac1.dolsen@gentoo> Subject: [gentoo-commits] proj/catalyst:pending commit in: etc/, catalyst/base/, catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py catalyst/defaults.py etc/catalyst.conf X-VCS-Directories: catalyst/ catalyst/base/ etc/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: d5f54e2693f4277fee370927ef18265ebcc52ac1 X-VCS-Branch: pending Date: Wed, 22 Nov 2017 15:52:44 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 8d09b2a9-d460-48c2-988d-ccc23426f32f X-Archives-Hash: 8848f890b0331966a51b990cf7d94d1c Message-ID: <20171122155244.BVoQVZGfXpDOXX38FGWXJwLEkP4jC-trXIB1mwZUdQc@z> commit: d5f54e2693f4277fee370927ef18265ebcc52ac1 Author: Brian Dolbec gentoo org> AuthorDate: Thu Mar 9 09:14:04 2017 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Wed Nov 22 01:16:21 2017 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=d5f54e26 base/stagebase.py: Seperate out the writing of the make.conf file By sepaerating out the writing of the make.conf file, it keeps all code to do so in one place. I also fixed the code to correctly set the target chroot directories for PORTDIR, DISTDIR, PKGDIR and PORTDIR_OVERLAY. The same code also re-writes make.conf toggling any PORTDIR_OVERLAY setting during the clean() run. Add target_distdir and target_pkgdir settings to defaults and catalyst.conf. This allows for more flexibility between host and target settings. They can be individually configured this way. Update target an source mounts from the configured settings. catalyst/base/stagebase.py | 194 ++++++++++++++++++++++++--------------------- catalyst/defaults.py | 2 + etc/catalyst.conf | 2 + 3 files changed, 106 insertions(+), 92 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 532f0997..67382b9a 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -213,8 +213,13 @@ class StageBase(TargetBase, ClearBase, GenBase): self.mounts = ["proc", "dev", "portdir", "distdir", "port_tmpdir"] # initialize our source mounts self.mountmap = SOURCE_MOUNT_DEFAULTS.copy() - # update them from settings + # update these from settings + self.mountmap["portdir"] = self.settings["portdir"] self.mountmap["distdir"] = self.settings["distdir"] + self.target_mounts["portdir"] = normpath(self.settings["repo_basedir"] + + "/" + self.settings["repo_name"]) + self.target_mounts["distdir"] = self.settings["target_distdir"] + self.target_mounts["packagedir"] = self.settings["target_pkgdir"] if "snapcache" not in self.settings["options"]: self.mounts.remove("portdir") self.mountmap["portdir"] = None @@ -1051,96 +1056,106 @@ class StageBase(TargetBase, ClearBase, GenBase): if os.path.exists(hosts_file): os.rename(hosts_file, hosts_file + '.catalyst') shutil.copy('/etc/hosts', hosts_file) + # write out the make.conf + try: + self.write_make_conf(setup=True) + except OSError as e: + raise CatalystError('Could not write %s: %s' % ( + normpath(self.settings["chroot_path"] + + self.settings["make_conf"]), e)) + self.resume.enable("chroot_setup") - # Modify and write out make.conf (for the chroot) - makepath = normpath(self.settings["chroot_path"] + - self.settings["make_conf"]) - clear_path(makepath) - myf = open(makepath, "w") - myf.write("# These settings were set by the catalyst build script " - "that automatically\n# built this stage.\n") - myf.write("# Please consult " - "/usr/share/portage/config/make.conf.example " - "for a more\n# detailed example.\n") - - for flags in ["CFLAGS", "CXXFLAGS", "FCFLAGS", "FFLAGS", "LDFLAGS", - "ASFLAGS"]: - if not flags in self.settings: - continue - if flags in ["LDFLAGS", "ASFLAGS"]: - myf.write("# %s is unsupported. USE AT YOUR OWN RISK!\n" - % flags) - if (flags is not "CFLAGS" and - self.settings[flags] == self.settings["CFLAGS"]): - myf.write('%s="${CFLAGS}"\n' % flags) - elif isinstance(self.settings[flags], list): - myf.write('%s="%s"\n' - % (flags, ' '.join(self.settings[flags]))) - else: - myf.write('%s="%s"\n' - % (flags, self.settings[flags])) - - if "CBUILD" in self.settings: - myf.write("# This should not be changed unless you know exactly" - " what you are doing. You\n# should probably be " - "using a different stage, instead.\n") - myf.write('CBUILD="' + self.settings["CBUILD"] + '"\n') - - if "CHOST" in self.settings: - myf.write("# WARNING: Changing your CHOST is not something " - "that should be done lightly.\n# Please consult " - "https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable " - "before changing.\n") - myf.write('CHOST="' + self.settings["CHOST"] + '"\n') - - # Figure out what our USE vars are for building - myusevars = [] - if "HOSTUSE" in self.settings: - myusevars.extend(self.settings["HOSTUSE"]) - - if "use" in self.settings: - myusevars.extend(self.settings["use"]) - - if myusevars: - myf.write("# These are the USE and USE_EXPAND flags that were " - "used for\n# building in addition to what is provided " - "by the profile.\n") - myusevars = sorted(set(myusevars)) - myf.write('USE="' + ' '.join(myusevars) + '"\n') - if '-*' in myusevars: - log.warning( - 'The use of -* in %s/use will cause portage to ignore\n' - 'package.use in the profile and portage_confdir.\n' - "You've been warned!", self.settings['spec_prefix']) - - myuseexpandvars = {} - if "HOSTUSEEXPAND" in self.settings: - for hostuseexpand in self.settings["HOSTUSEEXPAND"]: - myuseexpandvars.update( - {hostuseexpand:self.settings["HOSTUSEEXPAND"][hostuseexpand]}) - - if myuseexpandvars: - for hostuseexpand in myuseexpandvars: - myf.write(hostuseexpand + '="' + - ' '.join(myuseexpandvars[hostuseexpand]) + '"\n') - - myf.write('PORTDIR="%s"\n' % self.settings['portdir']) - myf.write('DISTDIR="%s"\n' % self.settings['distdir']) - myf.write('PKGDIR="%s"\n' % self.settings['packagedir']) - + def write_make_conf(self, setup=True): + # Modify and write out make.conf (for the chroot) + makepath = normpath(self.settings["chroot_path"] + + self.settings["make_conf"]) + clear_path(makepath) + myf = open(makepath, "w") + myf.write("# These settings were set by the catalyst build script " + "that automatically\n# built this stage.\n") + myf.write("# Please consult " + "/usr/share/portage/config/make.conf.example " + "for a more\n# detailed example.\n") + + for flags in ["CFLAGS", "CXXFLAGS", "FCFLAGS", "FFLAGS", "LDFLAGS", + "ASFLAGS"]: + if not flags in self.settings: + continue + if flags in ["LDFLAGS", "ASFLAGS"]: + myf.write("# %s is unsupported. USE AT YOUR OWN RISK!\n" + % flags) + if (flags is not "CFLAGS" and + self.settings[flags] == self.settings["CFLAGS"]): + myf.write('%s="${CFLAGS}"\n' % flags) + elif isinstance(self.settings[flags], list): + myf.write('%s="%s"\n' + % (flags, ' '.join(self.settings[flags]))) + else: + myf.write('%s="%s"\n' + % (flags, self.settings[flags])) + + if "CBUILD" in self.settings: + myf.write("# This should not be changed unless you know exactly" + " what you are doing. You\n# should probably be " + "using a different stage, instead.\n") + myf.write('CBUILD="' + self.settings["CBUILD"] + '"\n') + + if "CHOST" in self.settings: + myf.write("# WARNING: Changing your CHOST is not something " + "that should be done lightly.\n# Please consult " + "https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable " + "before changing.\n") + myf.write('CHOST="' + self.settings["CHOST"] + '"\n') + + # Figure out what our USE vars are for building + myusevars = [] + if "HOSTUSE" in self.settings: + myusevars.extend(self.settings["HOSTUSE"]) + + if "use" in self.settings: + myusevars.extend(self.settings["use"]) + + if myusevars: + myf.write("# These are the USE and USE_EXPAND flags that were " + "used for\n# building in addition to what is provided " + "by the profile.\n") + myusevars = sorted(set(myusevars)) + myf.write('USE="' + ' '.join(myusevars) + '"\n') + if '-*' in myusevars: + log.warning( + 'The use of -* in %s/use will cause portage to ignore\n' + 'package.use in the profile and portage_confdir.\n' + "You've been warned!", self.settings['spec_prefix']) + + myuseexpandvars = {} + if "HOSTUSEEXPAND" in self.settings: + for hostuseexpand in self.settings["HOSTUSEEXPAND"]: + myuseexpandvars.update( + {hostuseexpand:self.settings["HOSTUSEEXPAND"][hostuseexpand]}) + + if myuseexpandvars: + for hostuseexpand in myuseexpandvars: + myf.write(hostuseexpand + '="' + + ' '.join(myuseexpandvars[hostuseexpand]) + '"\n') + # write out a shipable version + target_portdir = normpath(self.settings["repo_basedir"] + "/" + + self.settings["repo_name"]) + + myf.write('PORTDIR="%s"\n' % target_portdir) + myf.write('DISTDIR="%s"\n' % self.settings['target_distdir']) + myf.write('PKGDIR="%s"\n' % self.settings['target_pkgdir']) + if setup: # Setup the portage overlay if "portage_overlay" in self.settings: myf.write('PORTDIR_OVERLAY="%s"\n' % self.settings["local_overlay"]) - # Set default locale for system responses. #478382 - myf.write( - '\n' - '# This sets the language of build output to English.\n' - '# Please keep this setting intact when reporting bugs.\n' - 'LC_MESSAGES=C\n') - - myf.close() - self.resume.enable("chroot_setup") + # Set default locale for system responses. #478382 + myf.write( + '\n' + '# This sets the language of build output to English.\n' + '# Please keep this setting intact when reporting bugs.\n' + 'LC_MESSAGES=C\n') + myf.close() def fsscript(self): if "autoresume" in self.settings["options"] \ @@ -1183,12 +1198,7 @@ class StageBase(TargetBase, ClearBase, GenBase): make_conf = self.settings['chroot_path'] + self.settings['make_conf'] try: - with open(make_conf) as f: - data = f.readlines() - data = ''.join(x for x in data - if not x.startswith('PORTDIR_OVERLAY')) - with open(make_conf, 'w') as f: - f.write(data) + self.write_make_conf(setup=False) except OSError as e: raise CatalystError('Could not update %s: %s' % (make_conf, e)) diff --git a/catalyst/defaults.py b/catalyst/defaults.py index 0bba6f4d..84ed2822 100644 --- a/catalyst/defaults.py +++ b/catalyst/defaults.py @@ -59,6 +59,8 @@ confdefaults={ "snapshot_name": "portage-", "source_matching": "strict", "storedir": "/var/tmp/catalyst", + "target_distdir": "/var/portage/distfiles", + "target_pkgdir":"/var/portage/packages", } DEFAULT_CONFIG_FILE = '/etc/catalyst/catalyst.conf' diff --git a/etc/catalyst.conf b/etc/catalyst.conf index 2e61ea4f..b4db063c 100644 --- a/etc/catalyst.conf +++ b/etc/catalyst.conf @@ -85,6 +85,8 @@ portdir="/usr/portage" # repo_basedir="/usr" repo_name="portage" +target_distdir="/usr/portage/distfiles" +target_pkgdir="/usr/portage/packages" # sharedir specifies where all of the catalyst runtime executables # and other shared lib objects are.