[gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/, catalyst/, targets/stage1/

2020-04-10 Thread Matt Turner
commit: ecdf556b4c00325bb299e012024f97e8af33c788
Author: Matt Turner  gentoo  org>
AuthorDate: Fri Apr 10 16:51:36 2020 +
Commit: Matt Turner  gentoo  org>
CommitDate: Fri Apr 10 21:03:34 2020 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ecdf556b

catalyst: Fix most pylint warnings

- consider-iterating-dictionary
- consider-using-enumerate
- inconsistent-return-statements
- len-as-condition
- literal-comparison
- no-else-raise
- no-else-return
- useless-return

Unfortunately there are more and they're a bit trickier.

Signed-off-by: Matt Turner  gentoo.org>

 catalyst/base/stagebase.py | 10 --
 catalyst/builder.py|  2 --
 catalyst/config.py |  2 +-
 catalyst/defaults.py   |  2 --
 catalyst/fileops.py|  2 +-
 catalyst/log.py|  3 +--
 catalyst/main.py   |  5 ++---
 catalyst/support.py| 23 +++
 catalyst/targets/stage1.py |  5 -
 targets/stage1/build.py|  6 +++---
 10 files changed, 23 insertions(+), 37 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 021f3beb..6f0a1bc3 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -474,7 +474,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
"/snapshots/" + self.settings["snapshot_name"] +
self.settings["snapshot"]),
self.accepted_extensions,
-   self.settings["source_matching"] is "strict"
+   self.settings["source_matching"] == "strict"
)
log.info('SNAPSHOT_PATH set to: %s', 
self.settings['snapshot_path'])
self.settings["snapshot_path_hash"] = \
@@ -557,7 +557,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
else:

self.settings["action_sequence"].append("remove_autoresume")
self.settings["action_sequence"].append("remove_chroot")
-   return
 
def set_use(self):
use = self.settings["spec_prefix"] + "/use"
@@ -716,8 +715,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.unbind()
if ismount(target):
raise 
CatalystError("Auto-unbind failed for " + target)
-   else:
-   log.notice('Auto-unbind 
successful...')
+   log.notice('Auto-unbind successful...')
except CatalystError:
raise CatalystError("Unable to 
auto-unbind " + target)
 
@@ -1105,7 +1103,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
continue
myf.write("# %s is unsupported.  USE AT 
YOUR OWN RISK!\n"
% flags)
-   if flags not in self.settings or (flags is not 
"COMMON_FLAGS" and
+   if flags not in self.settings or (flags != 
"COMMON_FLAGS" and
self.settings[flags] == 
self.settings["COMMON_FLAGS"]):
myf.write('%s="${COMMON_FLAGS}"\n' % 
flags)
elif isinstance(self.settings[flags], list):
@@ -1442,7 +1440,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 
if "purgetmponly" in self.settings["options"]:
self.purge()
-   return
+   return True
 
if "purgeonly" in self.settings["options"]:
log.info('StageBase: run() purgeonly')

diff --git a/catalyst/builder.py b/catalyst/builder.py
index e9f468d7..64e14c8d 100644
--- a/catalyst/builder.py
+++ b/catalyst/builder.py
@@ -1,5 +1,3 @@
-import os
-
 class generic():
def __init__(self,myspec):
self.settings=myspec

diff --git a/catalyst/config.py b/catalyst/config.py
index 5e70de41..1571db9d 100644
--- a/catalyst/config.py
+++ b/catalyst/config.py
@@ -22,7 +22,7 @@ class ParserBase():
 
def dump(self):
dump = ""
-   for x in self.values.keys():
+   for x in self.values:
dump += x + " = " + repr(self.values[x]) + "\n"
return dump
 

diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index bcb59796..349f16f6 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -1,6 +1,4 @@
 
-import os
-
 from DeComp.definitions import DECOMPRESSOR_SEARCH_ORDER
 from DeComp.definitions import COMPRESSOR_PROGRAM_OPTIONS, XATTRS_OPTIONS
 from DeComp.definitions import DECOMPRESSOR_PROGRAM_OPTIONS, 

[gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/, catalyst/, targets/stage1/, targets/support/

2015-08-29 Thread Brian Dolbec
commit: 6d640c0b9681b81be13ed11c52f1f037abc0d875
Author: Brian Dolbec dolsen AT gentoo DOT org
AuthorDate: Sun Feb 24 20:33:18 2013 +
Commit: Brian Dolbec dolsen AT gentoo DOT org
CommitDate: Sun Aug 30 02:09:05 2015 +
URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=6d640c0b

Migrate hardcoded /etc/portage paths

Create port_conf default.
Migrate all references to /etc/portage to the config's default.
Migrate all make.conf paths to the config'd default.

 catalyst/base/stagebase.py  | 15 +--
 catalyst/defaults.py|  3 ++-
 catalyst/targets/stage1.py  |  2 +-
 targets/stage1/stage1-chroot.sh | 18 +-
 targets/stage1/stage1-controller.sh |  6 +++---
 targets/support/chroot-functions.sh | 16 
 targets/support/kmerge.sh   | 10 +-
 targets/support/livecdfs-update.sh  | 12 ++--
 8 files changed, 43 insertions(+), 39 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 644bd7c..4c7f029 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -875,12 +875,15 @@ class StageBase(TargetBase, ClearBase, GenBase):
# TODO: zmedico and I discussed making this a directory 
and pushing
# in a parent file, as well as other user-specified 
configuration.
print Configuring profile link...
-   cmd(rm -f 
+self.settings[chroot_path]+/etc/portage/make.profile,\
-   Error zapping profile 
link,env=self.env)
-   cmd(mkdir -p 
+self.settings[chroot_path]+/etc/portage/)
-   cmd(ln -sf ../.. + self.settings[portdir] + 
/profiles/ + \
-   self.settings[target_profile]+ +\
-   
self.settings[chroot_path]+/etc/portage/make.profile,\
+   cmd(rm -f  + self.settings[chroot_path] +
+   self.settings[port_conf] + /make.profile,
+   Error zapping profile link,env=self.env)
+   cmd(mkdir -p  + self.settings[chroot_path] +
+   self.settings[port_conf])
+   cmd(ln -sf ../.. + self.settings[portdir] + 
/profiles/ +
+   self.settings[target_profile] +   +
+   self.settings[chroot_path] +
+   self.settings[port_conf] + /make.profile,
Error creating profile link,env=self.env)
self.resume.enable(config_profile_link)
 

diff --git a/catalyst/defaults.py b/catalyst/defaults.py
index 5cb5e3f..975e55b 100644
--- a/catalyst/defaults.py
+++ b/catalyst/defaults.py
@@ -26,7 +26,8 @@ confdefaults={
hash_function: crc32,
icecream: /var/cache/icecream,
local_overlay: /usr/local/portage,
-   make_conf: /etc/portage/make.conf,
+   port_conf: /etc/portage,
+   make_conf: %(port_conf)s/make.conf,
options: set(),
packagedir: /usr/portage/packages,
portdir: /usr/portage,

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 3d3b9e9..d5cc298 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -32,7 +32,7 @@ class stage1(StageBase):
def set_cleanables(self):
StageBase.set_cleanables(self)
self.settings[cleanables].extend([\
-   /usr/share/zoneinfo, /etc/portage/package*])
+   /usr/share/zoneinfo, self.settings[port_conf] + 
/package*])
 
# XXX: How do these override_foo() functions differ from the ones in 
StageBase and why aren't they in stage3_target?
 

diff --git a/targets/stage1/stage1-chroot.sh b/targets/stage1/stage1-chroot.sh
index 63aa563..4afc8fe 100755
--- a/targets/stage1/stage1-chroot.sh
+++ b/targets/stage1/stage1-chroot.sh
@@ -16,7 +16,7 @@ if [ -z ${clst_buildpkgs} ]
 then
echo Your profile seems to be broken.
echo Could not build a list of build packages.
-   echo Double check your /etc/portage/make.profile link and the 
'packages' files.
+   echo Double check your ${clst_port_conf}/make.profile link and the 
'packages' files.
exit 1
 fi
 
@@ -47,27 +47,27 @@ make_destpath /tmp/stage1root
 
 ## START BUILD
 # First, we drop in a known-good baselayout
-[ -e /etc/portage/make.conf ]  \
-   echo 'USE=${USE} -build'  /etc/portage/make.conf
+[ -e ${clst_make_conf} ]  \
+   echo 'USE=${USE} -build'  ${clst_make_conf}
 run_merge --oneshot --nodeps sys-apps/baselayout
 
-sed -i '/USE=${USE} -build/d' /etc/portage/make.conf
+sed -i '/USE=${USE} -build/d' ${clst_make_conf}
 
 # Now, we install our packages
-if [ -e /etc/portage/make.conf ]; then
+if [ -e ${clst_make_conf} ]  \
echo USE=\-* build ${BOOTSTRAP_USE} ${clst_HOSTUSE}\ \
-