commit:     73d70b4f433147d94d6c1e458fe2341dba1dcff7
Author:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 22 00:57:34 2020 +0000
Commit:     Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Thu Apr 30 22:56:12 2020 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=73d70b4f

catalyst: Only write out non-default paths to make.conf

Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>

 catalyst/base/stagebase.py | 11 +++++++----
 doc/catalyst-config.5.txt  | 19 +++++++++----------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 1f091829..affdabbe 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -14,7 +14,7 @@ from snakeoil.osutils import pjoin
 from DeComp.compress import CompressMap
 
 from catalyst import log
-from catalyst.defaults import (MOUNT_DEFAULTS, PORT_LOGDIR_CLEAN)
+from catalyst.defaults import (confdefaults, MOUNT_DEFAULTS, PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, file_locate, normpath,
                               cmd, read_makeconf, ismount, file_check)
 from catalyst.base.targetbase import TargetBase
@@ -1055,9 +1055,12 @@ class StageBase(TargetBase, ClearBase, GenBase):
                     myf.write(hostuseexpand + '="' +
                               ' '.join(myuseexpandvars[hostuseexpand]) + '"\n')
 
-            myf.write('PORTDIR="%s"\n' % self.settings['target_portdir'])
-            myf.write('DISTDIR="%s"\n' % self.settings['target_distdir'])
-            myf.write('PKGDIR="%s"\n' % self.settings['target_pkgdir'])
+            # Write non-default PORTDIR/DISTDIR/PKGDIR settings to make.conf
+            for x in ['target_portdir', 'target_distdir', 'target_pkgdir']:
+                if self.settings[x] != confdefaults[x]:
+                    varname = x.split('_')[1].upper()
+                    myf.write(f'{varname}="{self.settings[x]}"\n')
+
             if setup:
                 # Setup the portage overlay
                 if "portage_overlay" in self.settings:

diff --git a/doc/catalyst-config.5.txt b/doc/catalyst-config.5.txt
index b7d493eb..11b27d90 100644
--- a/doc/catalyst-config.5.txt
+++ b/doc/catalyst-config.5.txt
@@ -114,20 +114,19 @@ The name of the main repository (e.g. gentoo). The git 
repository at
 snapshot.
 
 *target_distdir*::
-This is the target distfiles directory location for the stage being created.
-This is important because this value will be stored in the stage's make.conf
-and will become the default location used if it is not edited by users.
-The default location is `/var/cache/distfiles`.
+Defines the location of the local source file repository in the
+target.  This will be written to the target's make.conf if it is not
+the default value of `/var/cache/distfiles`.
 
 *target_pkgdir*::
-This is the target packages directory for storing binpkgs in the stage being
-built.  This location is stored in the make.conf of the stage being built.
-The default location is `/var/cache/binpkgs`
+Defines the location of binary packages in the target.  This will be
+written to the target's make.conf if it is not the default value of
+`/var/cache/binpkgs`.
 
 *target_portdir*::
-Defines the location of main repository in the target stages.  This
-location is stored in make.conf of the stage being built.
-The default location is `/var/db/repos/gentoo`
+Defines the location of the main ebuild repository in the target.
+This will be written to the target's make.conf if it is not the
+default value of `/var/db/repos/gentoo`.
 
 Other settings
 ~~~~~~~~~~~~~~

Reply via email to