public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import
@ 2015-10-06 15:05 Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 02/13] lint: unwrap multiple statements Mike Frysinger
                   ` (11 more replies)
  0 siblings, 12 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

This module is already imported at the top, so no point in doing it again.
---
 catalyst/lock.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/catalyst/lock.py b/catalyst/lock.py
index 25d2aa2..71918d6 100644
--- a/catalyst/lock.py
+++ b/catalyst/lock.py
@@ -176,7 +176,6 @@ class LockDir(object):
 			#writemsg("Lockfile obtained\n")
 
 	def fcntl_unlock(self):
-		import fcntl
 		unlinkfile = 1
 		if not os.path.exists(self.lockfile):
 			print "lockfile does not exist '%s'" % self.lockfile
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 02/13] lint: unwrap multiple statements
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 03/13] lint: fix bad indentation Mike Frysinger
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

It's hard to read code that packs multiple statements in one line, so
unwrap the few places in the codebase where we do that.
---
 catalyst/config.py      | 3 ++-
 targets/stage1/build.py | 6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/catalyst/config.py b/catalyst/config.py
index 48d9c12..ffad9b3 100644
--- a/catalyst/config.py
+++ b/catalyst/config.py
@@ -53,7 +53,8 @@ class ParserBase(object):
 			myline = trailing_comment.sub("", myline)
 
 			# Skip any blank lines
-			if not myline: continue
+			if not myline:
+				continue
 
 			if self.key_value_separator in myline:
 				# Split on the first occurence of the separator creating two strings in the array mobjs
diff --git a/targets/stage1/build.py b/targets/stage1/build.py
index 6495ee3..be1bc4d 100755
--- a/targets/stage1/build.py
+++ b/targets/stage1/build.py
@@ -33,6 +33,8 @@ for idx in range(0, len(pkgs)):
 		buildpkgs[bidx] = pkgs[idx]
 		if buildpkgs[bidx][0:1] == "*":
 			buildpkgs[bidx] = buildpkgs[bidx][1:]
-	except: pass
+	except:
+		pass
 
-for b in buildpkgs: sys.stdout.write(b+" ")
+for b in buildpkgs:
+	sys.stdout.write(b + " ")
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 03/13] lint: fix bad indentation
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 02/13] lint: unwrap multiple statements Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 04/13] lint: convert funcs to @staticmethod where it makes sense Mike Frysinger
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

Fix code that has excessive indentation relative to previous levels.
---
 catalyst/arch/x86.py              |  4 ++--
 catalyst/base/stagebase.py        |  6 +++---
 catalyst/targets/livecd_stage1.py |  2 +-
 catalyst/targets/livecd_stage2.py |  2 +-
 catalyst/targets/netboot2.py      |  4 ++--
 catalyst/targets/stage2.py        | 12 ++++++------
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/catalyst/arch/x86.py b/catalyst/arch/x86.py
index 49500b9..33b29c0 100644
--- a/catalyst/arch/x86.py
+++ b/catalyst/arch/x86.py
@@ -10,8 +10,8 @@ class generic_x86(builder.generic):
 		builder.generic.__init__(self,myspec)
 		if self.settings["buildarch"]=="amd64":
 			if not os.path.exists("/bin/linux32") and not os.path.exists("/usr/bin/linux32"):
-					raise CatalystError("required executable linux32 not found "
-						"(\"emerge setarch\" to fix.)", print_traceback=True)
+				raise CatalystError("required executable linux32 not found "
+					"(\"emerge setarch\" to fix.)", print_traceback=True)
 			self.settings["CHROOT"]="linux32 chroot"
 			self.settings["crosscompile"] = False
 		else:
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index a9e7848..b9dd1d5 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -853,9 +853,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
 				and os.path.exists(target_portdir) \
 				and self.resume.is_enabled("unpack_portage") \
 				and self.settings["snapshot_path_hash"] == snapshot_hash:
-					print \
-						"Valid Resume point detected, skipping unpack of portage tree..."
-					unpack=False
+				print \
+					"Valid Resume point detected, skipping unpack of portage tree..."
+				unpack = False
 
 		if unpack:
 			if "snapcache" in self.settings["options"]:
diff --git a/catalyst/targets/livecd_stage1.py b/catalyst/targets/livecd_stage1.py
index ff320c0..262db70 100644
--- a/catalyst/targets/livecd_stage1.py
+++ b/catalyst/targets/livecd_stage1.py
@@ -34,7 +34,7 @@ class livecd_stage1(StageBase):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
 		if "autoresume" in self.settings["options"] \
 			and self.resume.is_enabled("setup_target_path"):
-				print "Resume point detected, skipping target path setup operation..."
+			print "Resume point detected, skipping target path setup operation..."
 		else:
 			# first clean up any existing target stuff
 			if os.path.exists(self.settings["target_path"]):
diff --git a/catalyst/targets/livecd_stage2.py b/catalyst/targets/livecd_stage2.py
index 870dcf9..b54f2f0 100644
--- a/catalyst/targets/livecd_stage2.py
+++ b/catalyst/targets/livecd_stage2.py
@@ -55,7 +55,7 @@ class livecd_stage2(StageBase):
 		self.settings["target_path"]=normpath(self.settings["storedir"]+"/builds/"+self.settings["target_subpath"])
 		if "autoresume" in self.settings["options"] \
 			and self.resume.is_enabled("setup_target_path"):
-				print "Resume point detected, skipping target path setup operation..."
+			print "Resume point detected, skipping target path setup operation..."
 		else:
 			# first clean up any existing target stuff
 			if os.path.isdir(self.settings["target_path"]):
diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
index e509cf9..f2d039c 100644
--- a/catalyst/targets/netboot2.py
+++ b/catalyst/targets/netboot2.py
@@ -54,7 +54,7 @@ class netboot2(StageBase):
 			self.settings["target_subpath"])
 		if "autoresume" in self.settings["options"] \
 			and self.resume.is_enabled("setup_target_path"):
-				print "Resume point detected, skipping target path setup operation..."
+			print "Resume point detected, skipping target path setup operation..."
 		else:
 			# first clean up any existing target stuff
 			if os.path.isfile(self.settings["target_path"]):
@@ -70,7 +70,7 @@ class netboot2(StageBase):
 		# check for autoresume point
 		if "autoresume" in self.settings["options"] \
 			and self.resume.is_enabled("copy_files_to_image"):
-				print "Resume point detected, skipping target path setup operation..."
+			print "Resume point detected, skipping target path setup operation..."
 		else:
 			if "netboot2/packages" in self.settings:
 				if type(self.settings["netboot2/packages"]) == types.StringType:
diff --git a/catalyst/targets/stage2.py b/catalyst/targets/stage2.py
index 40dc938..affa2cb 100644
--- a/catalyst/targets/stage2.py
+++ b/catalyst/targets/stage2.py
@@ -56,9 +56,9 @@ class stage2(StageBase):
 			self.settings["LDFLAGS"]=list_to_string(self.settings["ldflags"])
 
 	def set_portage_overlay(self):
-			StageBase.set_portage_overlay(self)
-			if "portage_overlay" in self.settings:
-				print "\nWARNING !!!!!"
-				print "\tUsing an portage overlay for earlier stages could cause build issues."
-				print "\tIf you break it, you buy it. Don't complain to us about it."
-				print "\tDont say we did not warn you\n"
+		StageBase.set_portage_overlay(self)
+		if "portage_overlay" in self.settings:
+			print "\nWARNING !!!!!"
+			print "\tUsing an portage overlay for earlier stages could cause build issues."
+			print "\tIf you break it, you buy it. Don't complain to us about it."
+			print "\tDont say we did not warn you\n"
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 04/13] lint: convert funcs to @staticmethod where it makes sense
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 02/13] lint: unwrap multiple statements Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 03/13] lint: fix bad indentation Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 05/13] lint: clean up bare exception handling Mike Frysinger
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

These functions don't actually utilize |self|, so make them into
@staticmethod's to quiet down the linter.
---
 catalyst/base/stagebase.py   | 3 ++-
 catalyst/lock.py             | 9 ++++++---
 catalyst/targets/snapshot.py | 3 ++-
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index b9dd1d5..409fcab 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1695,7 +1695,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
 				self.unbind()
 				raise CatalystError("build aborting due to livecd_update error.")
 
-	def _debug_pause_(self):
+	@staticmethod
+	def _debug_pause_():
 		py_input("press any key to continue: ")
 
 # vim: ts=4 sw=4 sta et sts=4 ai
diff --git a/catalyst/lock.py b/catalyst/lock.py
index 71918d6..01b1aa8 100644
--- a/catalyst/lock.py
+++ b/catalyst/lock.py
@@ -320,7 +320,8 @@ class LockDir(object):
 			del self.hardlock_paths[self.lockdir]
 			print self.hardlock_paths
 
-	def hardlock_name(self, path):
+	@staticmethod
+	def hardlock_name(path):
 		mypath=path+"/.hardlock-"+os.uname()[1]+"-"+str(os.getpid())
 		newpath = os.path.normpath(mypath)
 		if len(newpath) > 1:
@@ -328,7 +329,8 @@ class LockDir(object):
 				newpath = "/"+newpath.lstrip("/")
 		return newpath
 
-	def hardlink_is_mine(self,link,lock):
+	@staticmethod
+	def hardlink_is_mine(link, lock):
 		import stat
 		try:
 			myhls = os.stat(link)
@@ -347,7 +349,8 @@ class LockDir(object):
 				return True
 		return False
 
-	def hardlink_active(self, lock):
+	@staticmethod
+	def hardlink_active(lock):
 		if not os.path.exists(lock):
 			return False
 
diff --git a/catalyst/targets/snapshot.py b/catalyst/targets/snapshot.py
index 87340b7..a117a21 100644
--- a/catalyst/targets/snapshot.py
+++ b/catalyst/targets/snapshot.py
@@ -90,7 +90,8 @@ class snapshot(TargetBase, GenBase):
 	def kill_chroot_pids(self):
 		pass
 
-	def cleanup(self):
+	@staticmethod
+	def cleanup():
 		print "Cleaning up..."
 
 	def purge(self):
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 05/13] lint: clean up bare exception handling
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (2 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 04/13] lint: convert funcs to @staticmethod where it makes sense Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 06/13] lint: avoid relative imports Mike Frysinger
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

It's a bad idea to use a bare except clause as you end up including
things like SystemExit, KeyboardInterrupt, and GeneratorExit, none
of which we actually want to catch.  Some of the cases in the code
were explicitly catching & passing SystemExit back up which proves
this point.
---
 catalyst/base/stagebase.py |  2 +-
 catalyst/lock.py           | 26 ++++----------------------
 catalyst/main.py           |  2 +-
 catalyst/support.py        | 15 +++++----------
 targets/stage1/build.py    |  2 +-
 5 files changed, 12 insertions(+), 35 deletions(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 409fcab..e393c5b 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1015,7 +1015,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 					target is fully initialized
 					"""
 					self.snapshot_lock_object.unlock()
-				except:
+				except Exception:
 					pass
 		if ouch:
 			"""
diff --git a/catalyst/lock.py b/catalyst/lock.py
index 01b1aa8..d6653f7 100644
--- a/catalyst/lock.py
+++ b/catalyst/lock.py
@@ -130,8 +130,6 @@ class LockDir(object):
 				try:
 					if os.stat(self.lockfile).st_gid != self.gid:
 						os.chown(self.lockfile,os.getuid(),self.gid)
-				except SystemExit, e:
-					raise
 				except OSError, e:
 					if e[0] == 2: #XXX: No such file or directory
 						return self.fcntl_locking(locktype)
@@ -185,7 +183,7 @@ class LockDir(object):
 				try:
 					os.close(self.myfd)
 					self.myfd=None
-				except:
+				except Exception:
 					pass
 				return False
 
@@ -194,8 +192,6 @@ class LockDir(object):
 					self.myfd = os.open(self.lockfile, os.O_WRONLY,0660)
 					unlinkfile = 1
 					self.locking_method(self.myfd,fcntl.LOCK_UN)
-			except SystemExit, e:
-				raise e
 			except Exception, e:
 				#if self.myfd is not None:
 					#print "fcntl_unlock() trying to close", self.myfd
@@ -213,7 +209,7 @@ class LockDir(object):
 						InUse=False
 						try:
 							self.locking_method(self.myfd,fcntl.LOCK_EX|fcntl.LOCK_NB)
-						except:
+						except Exception:
 							print "Read lock may be in effect. skipping lockfile delete..."
 							InUse=True
 							# We won the lock, so there isn't competition for it.
@@ -227,8 +223,6 @@ class LockDir(object):
 						self.myfd=None
 #						if "DEBUG" in self.settings:
 #							print "Unlinked lockfile..."
-				except SystemExit, e:
-					raise e
 				except Exception, e:
 					# We really don't care... Someone else has the lock.
 					# So it is their problem now.
@@ -273,8 +267,6 @@ class LockDir(object):
 					print_traceback=True)
 			try:
 				os.link(self.myhardlock, self.lockfile)
-			except SystemExit:
-				raise
 			except Exception:
 #				if "DEBUG" in self.settings:
 #					print "lockfile(): Hardlink: Link failed."
@@ -305,9 +297,7 @@ class LockDir(object):
 				os.unlink(self.myhardlock)
 			if os.path.exists(self.lockfile):
 				os.unlink(self.lockfile)
-		except SystemExit:
-			raise
-		except:
+		except Exception:
 			writemsg("Something strange happened to our hardlink locks.\n")
 
 	def add_hardlock_file_to_cleanup(self):
@@ -335,9 +325,7 @@ class LockDir(object):
 		try:
 			myhls = os.stat(link)
 			mylfs = os.stat(lock)
-		except SystemExit:
-			raise
-		except:
+		except Exception:
 			myhls = None
 			mylfs = None
 
@@ -406,8 +394,6 @@ class LockDir(object):
 								# We're sweeping through, unlinking everyone's locks.
 								os.unlink(filename)
 								results.append("Unlinked: " + filename)
-							except SystemExit:
-								raise
 							except Exception:
 								pass
 					try:
@@ -415,16 +401,12 @@ class LockDir(object):
 						results.append("Unlinked: " + x)
 						os.unlink(mylockname)
 						results.append("Unlinked: " + mylockname)
-					except SystemExit:
-						raise
 					except Exception:
 						pass
 				else:
 					try:
 						os.unlink(mylockname)
 						results.append("Unlinked: " + mylockname)
-					except SystemExit:
-						raise
 					except Exception:
 						pass
 		return results
diff --git a/catalyst/main.py b/catalyst/main.py
index 04f689e..4e83414 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -95,7 +95,7 @@ def parse_config(myconfig):
 		myconfig = catalyst.config.ConfigParser(config_file)
 		myconf.update(myconfig.get_values())
 
-	except:
+	except Exception:
 		print "!!! catalyst: Unable to parse configuration file, "+myconfig
 		sys.exit(1)
 
diff --git a/catalyst/support.py b/catalyst/support.py
index 90c59eb..f184ed7 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -22,9 +22,7 @@ DESIRED_RLIMIT = 0
 try:
 	import resource
 	max_fd_limit=resource.getrlimit(resource.RLIMIT_NOFILE)[DESIRED_RLIMIT]
-except SystemExit, e:
-	raise
-except:
+except Exception:
 	# hokay, no resource module.
 	max_fd_limit=256
 
@@ -48,7 +46,7 @@ def read_from_clst(path):
 	myline = ''
 	try:
 		myf = open(path, "r")
-	except:
+	except Exception:
 		return -1
 		#raise CatalystError("Could not open file " + path)
 	for line in myf.readlines():
@@ -136,10 +134,7 @@ def cmd(mycmd, myexc="", env=None, debug=False, fail_func=None):
 
 	if debug:
 		print "***** cmd(); args =", args
-	try:
-		proc = Popen(args, env=env)
-	except:
-		raise
+	proc = Popen(args, env=env)
 	if proc.wait() != 0:
 		if fail_func:
 			print "CMD(), NON-Zero command return.  Running fail_func()"
@@ -243,7 +238,7 @@ def read_makeconf(mymakeconffile):
 				try:
 					import portage.util
 					return portage.util.getconfig(mymakeconffile, tolerant=1, allow_sourcing=True)
-				except:
+				except Exception:
 					try:
 						import portage_util
 						return portage_util.getconfig(mymakeconffile, tolerant=1, allow_sourcing=True)
@@ -252,7 +247,7 @@ def read_makeconf(mymakeconffile):
 						mylines=myf.readlines()
 						myf.close()
 						return parse_makeconf(mylines)
-		except:
+		except Exception:
 			raise CatalystError("Could not parse make.conf file " +
 				mymakeconffile, print_traceback=True)
 	else:
diff --git a/targets/stage1/build.py b/targets/stage1/build.py
index be1bc4d..fa4fd13 100755
--- a/targets/stage1/build.py
+++ b/targets/stage1/build.py
@@ -33,7 +33,7 @@ for idx in range(0, len(pkgs)):
 		buildpkgs[bidx] = pkgs[idx]
 		if buildpkgs[bidx][0:1] == "*":
 			buildpkgs[bidx] = buildpkgs[bidx][1:]
-	except:
+	except Exception:
 		pass
 
 for b in buildpkgs:
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 06/13] lint: avoid relative imports
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (3 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 05/13] lint: clean up bare exception handling Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 07/13] fileops: fix passing of gid/uid/minimal args Mike Frysinger
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

We import from catalyst.xxx elsewhere, so be consistent.
---
 catalyst/contents.py   | 2 +-
 catalyst/hash_utils.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/catalyst/contents.py b/catalyst/contents.py
index a06b2db..73eda61 100644
--- a/catalyst/contents.py
+++ b/catalyst/contents.py
@@ -2,7 +2,7 @@
 from collections import namedtuple
 from subprocess import Popen, PIPE
 
-from support import CatalystError, warn
+from catalyst.support import CatalystError, warn
 
 
 # use ContentsMap.fields for the value legend
diff --git a/catalyst/hash_utils.py b/catalyst/hash_utils.py
index 39f489b..0262422 100644
--- a/catalyst/hash_utils.py
+++ b/catalyst/hash_utils.py
@@ -3,7 +3,7 @@ import os
 from collections import namedtuple
 from subprocess import Popen, PIPE
 
-from support import CatalystError
+from catalyst.support import CatalystError
 
 
 # Use HashMap.fields for the value legend
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 07/13] fileops: fix passing of gid/uid/minimal args
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (4 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 06/13] lint: avoid relative imports Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 08/13] lint: revise wildcard import Mike Frysinger
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

This func accepted these kwargs but forgot to pass them along to the
snakeoil layer.
---
 catalyst/fileops.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/fileops.py b/catalyst/fileops.py
index 8a05985..5a1d0f3 100644
--- a/catalyst/fileops.py
+++ b/catalyst/fileops.py
@@ -42,7 +42,7 @@ def ensure_dirs(path, gid=-1, uid=-1, mode=0o755, minimal=True,
 	:return: True if the directory could be created/ensured to have those
 		permissions, False if not.
 	'''
-	succeeded = snakeoil_ensure_dirs(path, gid=-1, uid=-1, mode=mode, minimal=True)
+	succeeded = snakeoil_ensure_dirs(path, gid=gid, uid=uid, mode=mode, minimal=minimal)
 	if not succeeded:
 		if failback:
 			failback()
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 08/13] lint: revise wildcard import
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (5 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 07/13] fileops: fix passing of gid/uid/minimal args Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 09/13] lint: mark unused func args Mike Frysinger
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

We only need one function, so import it directly.
---
 catalyst/base/targetbase.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/base/targetbase.py b/catalyst/base/targetbase.py
index e0c03df..4dcd88b 100644
--- a/catalyst/base/targetbase.py
+++ b/catalyst/base/targetbase.py
@@ -1,6 +1,6 @@
 import os
 
-from catalyst.support import *
+from catalyst.support import addl_arg_parse
 
 class TargetBase(object):
 	"""
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 09/13] lint: mark unused func args
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (6 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 08/13] lint: revise wildcard import Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 10/13] lint: init all members in __init__ Mike Frysinger
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

Since these aren't used, the linter will warn, but these are callbacks
that expect a certain API, so add a _ prefix to quiet it down.
---
 bin/catalyst             | 2 +-
 doc/make_target_table.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/catalyst b/bin/catalyst
index 19f5289..d0bc153 100755
--- a/bin/catalyst
+++ b/bin/catalyst
@@ -16,7 +16,7 @@ import sys
 try:
 	import signal
 
-	def exithandler(signum,frame):
+	def exithandler(_signum, _frame):
 		signal.signal(signal.SIGINT, signal.SIG_IGN)
 		signal.signal(signal.SIGTERM, signal.SIG_IGN)
 		print()
diff --git a/doc/make_target_table.py b/doc/make_target_table.py
index 9e7ebe8..f127c37 100755
--- a/doc/make_target_table.py
+++ b/doc/make_target_table.py
@@ -16,7 +16,7 @@ import glob
 import re
 
 
-def key_netboot_before_netboot2((target_name, module)):
+def key_netboot_before_netboot2((target_name, _module)):
 	return target_name + '1'
 
 
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 10/13] lint: init all members in __init__
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (7 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 09/13] lint: mark unused func args Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 11/13] version: use the passed in value Mike Frysinger
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

A few class members were being set outside of __init__.  Usually this is
an oversight, so having the linter complain is helpful.  Set up the few
places in the code that don't do this.
---
 catalyst/base/stagebase.py | 2 ++
 catalyst/lock.py           | 1 +
 2 files changed, 3 insertions(+)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index e393c5b..7bc7522 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -73,6 +73,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		previously. -agaffney
 		"""
 
+		self.makeconf = {}
 		self.archmap = {}
 		self.subarchmap = {}
 		machinemap = {}
@@ -156,6 +157,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 		self.set_source_subpath()
 
 		""" Set paths """
+		self.snapshot_lock_object = None
 		self.set_snapshot_path()
 		self.set_root_path()
 		self.set_source_path()
diff --git a/catalyst/lock.py b/catalyst/lock.py
index d6653f7..d079b2d 100644
--- a/catalyst/lock.py
+++ b/catalyst/lock.py
@@ -54,6 +54,7 @@ class LockDir(object):
 		else:
 			LockDir.lock_dirs_in_use.append(lockdir)
 
+		self.myhardlock = None
 		self.hardlock_paths={}
 
 	def delete_lock_from_path_list(self):
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 11/13] version: use the passed in value
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (8 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 10/13] lint: init all members in __init__ Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 12/13] targets: fix bad set_build_kernel_vars call Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 13/13] lint: clean up superfluous parens Mike Frysinger
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

The get_git_version function takes a |version| argument, but doesn't
actually use it, which makes calls to the function with a version do
nothing.  Tweak the function to use the arg in the way it looks like
it intended.
---
 catalyst/version.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/version.py b/catalyst/version.py
index 5deb4d7..3b82988 100644
--- a/catalyst/version.py
+++ b/catalyst/version.py
@@ -31,7 +31,7 @@ def get_git_version(version=__version__):
 		s = ('vcs version %s, date %s' %
 			 (version_info['rev'], version_info['date']))
 
-	_ver = 'Catalyst %s\n%s' % (__version__, s)
+	_ver = 'Catalyst %s\n%s' % (version, s)
 
 	return _ver
 
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 12/13] targets: fix bad set_build_kernel_vars call
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (9 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 11/13] version: use the passed in value Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 13/13] lint: clean up superfluous parens Mike Frysinger
  11 siblings, 0 replies; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

These modules were calling set_build_kernel_vars with an argument that
the func didn't accept.  Plus, it's redundant as the super class init
(which these guys call) already handles the call.  So delete it.
---
 catalyst/targets/embedded.py | 1 -
 catalyst/targets/netboot.py  | 1 -
 catalyst/targets/netboot2.py | 1 -
 3 files changed, 3 deletions(-)

diff --git a/catalyst/targets/embedded.py b/catalyst/targets/embedded.py
index 3309278..6044e17 100644
--- a/catalyst/targets/embedded.py
+++ b/catalyst/targets/embedded.py
@@ -28,7 +28,6 @@ class embedded(StageBase):
 			self.valid_values.append("embedded/fs-ops")
 
 		StageBase.__init__(self,spec,addlargs)
-		self.set_build_kernel_vars(addlargs)
 
 	def set_action_sequence(self):
 		self.settings["action_sequence"]=["dir_setup","unpack","unpack_snapshot",\
diff --git a/catalyst/targets/netboot.py b/catalyst/targets/netboot.py
index b0e322c..46ec4eb 100644
--- a/catalyst/targets/netboot.py
+++ b/catalyst/targets/netboot.py
@@ -44,7 +44,6 @@ class netboot(StageBase):
 			raise CatalystError("configuration error in netboot/packages.")
 
 		StageBase.__init__(self,spec,addlargs)
-		self.set_build_kernel_vars(addlargs)
 		if "netboot/busybox_config" in addlargs:
 			file_locate(self.settings, ["netboot/busybox_config"])
 
diff --git a/catalyst/targets/netboot2.py b/catalyst/targets/netboot2.py
index f2d039c..5508367 100644
--- a/catalyst/targets/netboot2.py
+++ b/catalyst/targets/netboot2.py
@@ -46,7 +46,6 @@ class netboot2(StageBase):
 			raise CatalystError("configuration error in netboot2/packages.")
 
 		StageBase.__init__(self,spec,addlargs)
-		self.set_build_kernel_vars()
 		self.settings["merge_path"]=normpath("/tmp/image/")
 
 	def set_target_path(self):
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [gentoo-catalyst] [PATCH 13/13] lint: clean up superfluous parens
  2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
                   ` (10 preceding siblings ...)
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 12/13] targets: fix bad set_build_kernel_vars call Mike Frysinger
@ 2015-10-06 15:05 ` Mike Frysinger
  2015-10-06 15:27   ` Brian Dolbec
  11 siblings, 1 reply; 14+ messages in thread
From: Mike Frysinger @ 2015-10-06 15:05 UTC (permalink / raw
  To: gentoo-catalyst

These don't need the parens, so omit them.

In the case of setup.py, we were expecting a print function, not a
keyword, so make sure to import that module.
---
 catalyst/lock.py                   | 6 +++---
 doc/make_subarch_table_guidexml.py | 6 +++---
 setup.py                           | 1 +
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/catalyst/lock.py b/catalyst/lock.py
index d079b2d..3d50c06 100644
--- a/catalyst/lock.py
+++ b/catalyst/lock.py
@@ -179,7 +179,7 @@ class LockDir(object):
 		if not os.path.exists(self.lockfile):
 			print "lockfile does not exist '%s'" % self.lockfile
 			#print "fcntl_unlock() , self.myfd:", self.myfd, type(self.myfd)
-			if (self.myfd != None):
+			if self.myfd != None:
 				#print "fcntl_unlock() trying to close it "
 				try:
 					os.close(self.myfd)
@@ -236,7 +236,7 @@ class LockDir(object):
 					#if type(lockfilename) == types.StringType:
 					#        os.close(myfd)
 		#print "fcntl_unlock() trying a last ditch close", self.myfd
-		if (self.myfd != None):
+		if self.myfd != None:
 			os.close(self.myfd)
 			self.myfd=None
 			self.locked=False
@@ -256,7 +256,7 @@ class LockDir(object):
 		start_time = time.time()
 		reported_waiting = False
 
-		while(time.time() < (start_time + max_wait)):
+		while time.time() < (start_time + max_wait):
 			# We only need it to exist.
 			self.myfd = os.open(self.myhardlock, os.O_CREAT|os.O_RDWR,0660)
 			os.close(self.myfd)
diff --git a/doc/make_subarch_table_guidexml.py b/doc/make_subarch_table_guidexml.py
index 54e0a4a..a6a9022 100755
--- a/doc/make_subarch_table_guidexml.py
+++ b/doc/make_subarch_table_guidexml.py
@@ -30,7 +30,7 @@ def handle_line(line, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_ge
 		# Apply alias grouping
 		arch = _pattern_arch_genericliases.get(arch, arch)
 
-		assert(subarch not in subarch_id_to_pattern_arch_genericrch_id)
+		assert subarch not in subarch_id_to_pattern_arch_genericrch_id
 		subarch_id_to_pattern_arch_genericrch_id[subarch] = arch
 
 		return
@@ -40,7 +40,7 @@ def handle_line(line, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_ge
 		child_subarch = x.group(1)
 		parent_subarch = x.group(2)
 
-		assert(child_subarch not in subarch_id_to_pattern_arch_genericrch_id)
+		assert child_subarch not in subarch_id_to_pattern_arch_genericrch_id
 		subarch_id_to_pattern_arch_genericrch_id[child_subarch] = subarch_id_to_pattern_arch_genericrch_id[parent_subarch]
 
 		return
@@ -49,7 +49,7 @@ def handle_line(line, subarch_title_to_subarch_id, subarch_id_to_pattern_arch_ge
 		subarch_title = x.group(1)
 		subarch_id = x.group(2)
 
-		assert(subarch_title not in subarch_title_to_subarch_id)
+		assert subarch_title not in subarch_title_to_subarch_id
 		subarch_title_to_subarch_id[subarch_title] = subarch_id
 
 
diff --git a/setup.py b/setup.py
index e4569ee..a875db1 100755
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,6 @@
 """Catalyst is a release building tool used by Gentoo Linux"""
 
+from __future__ import print_function
 
 import codecs as _codecs
 from distutils.core import setup as _setup, Command as _Command
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [gentoo-catalyst] [PATCH 13/13] lint: clean up superfluous parens
  2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 13/13] lint: clean up superfluous parens Mike Frysinger
@ 2015-10-06 15:27   ` Brian Dolbec
  0 siblings, 0 replies; 14+ messages in thread
From: Brian Dolbec @ 2015-10-06 15:27 UTC (permalink / raw
  To: gentoo-catalyst

On Tue,  6 Oct 2015 11:05:29 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> These don't need the parens, so omit them.
> 
> In the case of setup.py, we were expecting a print function, not a
> keyword, so make sure to import that module.
> ---
>  catalyst/lock.py                   | 6 +++---
>  doc/make_subarch_table_guidexml.py | 6 +++---
>  setup.py                           | 1 +
>  3 files changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/catalyst/lock.py b/catalyst/lock.py
> index d079b2d..3d50c06 100644
> --- a/catalyst/lock.py
> +++ b/catalyst/lock.py
> @@ -179,7 +179,7 @@ class LockDir(object):
>  		if not os.path.exists(self.lockfile):
>  			print "lockfile does not exist '%s'" %
> self.lockfile #print "fcntl_unlock() , self.myfd:", self.myfd,
> type(self.myfd)
> -			if (self.myfd != None):
> +			if self.myfd != None:
>  				#print "fcntl_unlock() trying to
> close it " try:
>  					os.close(self.myfd)
> @@ -236,7 +236,7 @@ class LockDir(object):
>  					#if type(lockfilename) ==
> types.StringType: #        os.close(myfd)
>  		#print "fcntl_unlock() trying a last ditch close",
> self.myfd
> -		if (self.myfd != None):
> +		if self.myfd != None:
>  			os.close(self.myfd)
>  			self.myfd=None
>  			self.locked=False
> @@ -256,7 +256,7 @@ class LockDir(object):
>  		start_time = time.time()
>  		reported_waiting = False
>  
> -		while(time.time() < (start_time + max_wait)):
> +		while time.time() < (start_time + max_wait):
>  			# We only need it to exist.
>  			self.myfd = os.open(self.myhardlock,
> os.O_CREAT|os.O_RDWR,0660) os.close(self.myfd)
> diff --git a/doc/make_subarch_table_guidexml.py
> b/doc/make_subarch_table_guidexml.py index 54e0a4a..a6a9022 100755
> --- a/doc/make_subarch_table_guidexml.py
> +++ b/doc/make_subarch_table_guidexml.py
> @@ -30,7 +30,7 @@ def handle_line(line, subarch_title_to_subarch_id,
> subarch_id_to_pattern_arch_ge # Apply alias grouping
>  		arch = _pattern_arch_genericliases.get(arch, arch)
>  
> -		assert(subarch not in
> subarch_id_to_pattern_arch_genericrch_id)
> +		assert subarch not in
> subarch_id_to_pattern_arch_genericrch_id
> subarch_id_to_pattern_arch_genericrch_id[subarch] = arch 
>  		return
> @@ -40,7 +40,7 @@ def handle_line(line, subarch_title_to_subarch_id,
> subarch_id_to_pattern_arch_ge child_subarch = x.group(1)
>  		parent_subarch = x.group(2)
>  
> -		assert(child_subarch not in
> subarch_id_to_pattern_arch_genericrch_id)
> +		assert child_subarch not in
> subarch_id_to_pattern_arch_genericrch_id
> subarch_id_to_pattern_arch_genericrch_id[child_subarch] =
> subarch_id_to_pattern_arch_genericrch_id[parent_subarch] return
> @@ -49,7 +49,7 @@ def handle_line(line, subarch_title_to_subarch_id,
> subarch_id_to_pattern_arch_ge subarch_title = x.group(1)
>  		subarch_id = x.group(2)
>  
> -		assert(subarch_title not in
> subarch_title_to_subarch_id)
> +		assert subarch_title not in
> subarch_title_to_subarch_id
> subarch_title_to_subarch_id[subarch_title] = subarch_id 
>  
> diff --git a/setup.py b/setup.py
> index e4569ee..a875db1 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -1,5 +1,6 @@
>  """Catalyst is a release building tool used by Gentoo Linux"""
>  
> +from __future__ import print_function
>  
>  import codecs as _codecs
>  from distutils.core import setup as _setup, Command as _Command

I'll just reply to this last one.


All patches in this series look good, Thank you.

-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-10-06 15:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-06 15:05 [gentoo-catalyst] [PATCH 01/13] lint: fix duplicate fcntl import Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 02/13] lint: unwrap multiple statements Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 03/13] lint: fix bad indentation Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 04/13] lint: convert funcs to @staticmethod where it makes sense Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 05/13] lint: clean up bare exception handling Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 06/13] lint: avoid relative imports Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 07/13] fileops: fix passing of gid/uid/minimal args Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 08/13] lint: revise wildcard import Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 09/13] lint: mark unused func args Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 10/13] lint: init all members in __init__ Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 11/13] version: use the passed in value Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 12/13] targets: fix bad set_build_kernel_vars call Mike Frysinger
2015-10-06 15:05 ` [gentoo-catalyst] [PATCH 13/13] lint: clean up superfluous parens Mike Frysinger
2015-10-06 15:27   ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox