[gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/, catalyst/, targets/stage1/
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, LIST_XATTRS_OPTION
[gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/, catalyst/
commit: 75d1b6b8d2c1c28fb4914d33b7643e8e86940efa Author: Mike Frysinger gentoo org> AuthorDate: Tue Oct 6 17:15:18 2015 + Commit: Mike Frysinger gentoo org> CommitDate: Tue Oct 6 17:15:18 2015 + URL:https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=75d1b6b8 lint: use comments for comments, not inline docstrings It's uncommon to dump docstrings in the middle of code in the place of comments. Convert them all to standard comments. catalyst/base/stagebase.py | 219 ++- catalyst/fileops.py | 8 +- catalyst/targets/snapshot.py | 8 +- 3 files changed, 99 insertions(+), 136 deletions(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index fcdf729..813e5f1 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -49,29 +49,27 @@ class StageBase(TargetBase, ClearBase, GenBase): GenBase.__init__(self, myspec) ClearBase.__init__(self, myspec) - """ - The semantics of subarchmap and machinemap changed a bit in 2.0.3 to - work better with vapier's CBUILD stuff. I've removed the "monolithic" - machinemap from this file and split up its contents amongst the - various arch/foo.py files. - - When register() is called on each module in the arch/ dir, it now - returns a tuple instead of acting on the subarchmap dict that is - passed to it. The tuple contains the values that were previously - added to subarchmap as well as a new list of CHOSTs that go along - with that arch. This allows us to build machinemap on the fly based - on the keys in subarchmap and the values of the 2nd list returned - (tmpmachinemap). - - Also, after talking with vapier. I have a slightly better idea of what - certain variables are used for and what they should be set to. Neither - 'buildarch' or 'hostarch' are used directly, so their value doesn't - really matter. They are just compared to determine if we are - cross-compiling. Because of this, they are just set to the name of the - module in arch/ that the subarch is part of to make things simpler. - The entire build process is still based off of 'subarch' like it was - previously. -agaffney - """ + # The semantics of subarchmap and machinemap changed a bit in 2.0.3 to + # work better with vapier's CBUILD stuff. I've removed the "monolithic" + # machinemap from this file and split up its contents amongst the + # various arch/foo.py files. + # + # When register() is called on each module in the arch/ dir, it now + # returns a tuple instead of acting on the subarchmap dict that is + # passed to it. The tuple contains the values that were previously + # added to subarchmap as well as a new list of CHOSTs that go along + # with that arch. This allows us to build machinemap on the fly based + # on the keys in subarchmap and the values of the 2nd list returned + # (tmpmachinemap). + # + # Also, after talking with vapier. I have a slightly better idea of what + # certain variables are used for and what they should be set to. Neither + # 'buildarch' or 'hostarch' are used directly, so their value doesn't + # really matter. They are just compared to determine if we are + # cross-compiling. Because of this, they are just set to the name of the + # module in arch/ that the subarch is part of to make things simpler. + # The entire build process is still based off of 'subarch' like it was + # previously. -agaffney self.makeconf = {} self.archmap = {} @@ -81,16 +79,12 @@ class StageBase(TargetBase, ClearBase, GenBase): for x in [x[:-3] for x in os.listdir(arch_dir) if x.endswith(".py") and x != "__init__.py"]: try: fh=open(arch_dir + x + ".py") - """ - This next line loads the plugin as a module and assigns it to - archmap[x] - """ + # This next line loads the plugin as a module and assigns it to + # archmap[x] self.archmap[x]=imp.load_module(x,fh, arch_dir + x + ".py", (".py", "r", imp.PY_SOURCE)) - """ - This next line
[gentoo-commits] proj/catalyst:master commit in: catalyst/base/, catalyst/targets/, catalyst/, targets/stage1/, targets/support/
commit: 6d640c0b9681b81be13ed11c52f1f037abc0d875 Author: Brian Dolbec gentoo org> AuthorDate: Sun Feb 24 20:33:18 2013 + Commit: Brian Dolbec gentoo 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 ];