public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] contents: punt unused module
@ 2015-10-09  5:53 Mike Frysinger
  2015-10-09 20:32 ` Brian Dolbec
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2015-10-09  5:53 UTC (permalink / raw
  To: gentoo-catalyst

It looks like this code has all been moved to the external DeComp pkg.
---
 catalyst/contents.py | 87 ----------------------------------------------------
 1 file changed, 87 deletions(-)
 delete mode 100644 catalyst/contents.py

diff --git a/catalyst/contents.py b/catalyst/contents.py
deleted file mode 100644
index 73eda61..0000000
--- a/catalyst/contents.py
+++ /dev/null
@@ -1,87 +0,0 @@
-
-from collections import namedtuple
-from subprocess import Popen, PIPE
-
-from catalyst.support import CatalystError, warn
-
-
-# use ContentsMap.fields for the value legend
-# Key:[function, cmd]
-CONTENTS_DEFINITIONS = {
-	# 'find' is disabled because it requires the source path, which is not
-	# always available
-	#"find"		:["calc_contents","find %(path)s"],
-	"tar_tv":["calc_contents","tar --xattrs tvf %(file)s"],
-	"tar_tvz":["calc_contents","tar --xattrs tvzf %(file)s"],
-	"tar_tvj":["calc_contents","tar --xattrs -I lbzip2 -tvf %(file)s"],
-	"isoinfo_l":["calc_contents","isoinfo -l -i %(file)s"],
-	# isoinfo_f should be a last resort only
-	"isoinfo_f":["calc_contents","isoinfo -f -i %(file)s"],
-}
-
-
-class ContentsMap(object):
-	'''Class to encompass all known commands to list
-	the contents of an archive'''
-
-
-	fields = ['func', 'cmd']
-
-
-	def __init__(self, defs=None):
-		'''Class init
-
-		@param defs: dictionary of Key:[function, cmd]
-		'''
-		if defs is None:
-			defs = {}
-		#self.contents = {}
-		self.contents_map = {}
-
-		# create the archive type namedtuple classes
-		for name in list(defs):
-			#obj = self.contents[name] = namedtuple(name, self.fields)
-			obj = namedtuple(name, self.fields)
-			obj.__slots__ = ()
-			self.contents_map[name] = obj._make(defs[name])
-		del obj
-
-
-	def generate_contents(self, file_, getter="auto", verbose=False):
-		try:
-			archive = getter
-			if archive == 'auto' and file_.endswith('.iso'):
-				archive = 'isoinfo_l'
-			if (archive in ['tar_tv','auto']):
-				if file_.endswith('.tgz') or file_.endswith('.tar.gz'):
-					archive = 'tar_tvz'
-				elif file_.endswith('.tbz2') or file_.endswith('.tar.bz2'):
-					archive = 'tar_tvj'
-				elif file_.endswith('.tar'):
-					archive = 'tar_tv'
-
-			if archive == 'auto':
-				warn('File %r has unknown type for automatic detection.'
-					% (file_, ))
-				return None
-			else:
-				getter = archive
-				func = getattr(self, '_%s_' % self.contents_map[getter].func)
-				return func(file_, self.contents_map[getter].cmd, verbose)
-		except:
-			raise CatalystError(
-				"Error generating contents, is appropriate utility " +
-				"(%s) installed on your system?"
-				% (self.contents_map[getter].cmd), print_traceback=True)
-
-
-	@staticmethod
-	def _calc_contents_(file_, cmd, verbose):
-		_cmd = (cmd % {'file': file_ }).split()
-		proc = Popen(_cmd, stdout=PIPE, stderr=PIPE)
-		results = proc.communicate()
-		result = "\n".join(results)
-		if verbose:
-			print result
-		return result
-
-- 
2.5.2



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

* Re: [gentoo-catalyst] [PATCH] contents: punt unused module
  2015-10-09  5:53 [gentoo-catalyst] [PATCH] contents: punt unused module Mike Frysinger
@ 2015-10-09 20:32 ` Brian Dolbec
  2015-10-09 21:26   ` Anthony G. Basile
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Dolbec @ 2015-10-09 20:32 UTC (permalink / raw
  To: gentoo-catalyst

On Fri,  9 Oct 2015 01:53:39 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> It looks like this code has all been moved to the external DeComp pkg.
> ---
>  catalyst/contents.py | 87
> ---------------------------------------------------- 1 file changed,
> 87 deletions(-) delete mode 100644 catalyst/contents.py
> 
> diff --git a/catalyst/contents.py b/catalyst/contents.py
> deleted file mode 100644
> index 73eda61..0000000
> --- a/catalyst/contents.py
> +++ /dev/null
> @@ -1,87 +0,0 @@
> -
> -from collections import namedtuple
> -from subprocess import Popen, PIPE
> -
> -from catalyst.support import CatalystError, warn
> -
> -
> -# use ContentsMap.fields for the value legend
> -# Key:[function, cmd]
> -CONTENTS_DEFINITIONS = {
> -	# 'find' is disabled because it requires the source path,
> which is not
> -	# always available
> -	#"find"		:["calc_contents","find %(path)s"],
> -	"tar_tv":["calc_contents","tar --xattrs tvf %(file)s"],
> -	"tar_tvz":["calc_contents","tar --xattrs tvzf %(file)s"],
> -	"tar_tvj":["calc_contents","tar --xattrs -I lbzip2 -tvf
> %(file)s"],
> -	"isoinfo_l":["calc_contents","isoinfo -l -i %(file)s"],
> -	# isoinfo_f should be a last resort only
> -	"isoinfo_f":["calc_contents","isoinfo -f -i %(file)s"],
> -}
> -
> -
> -class ContentsMap(object):
> -	'''Class to encompass all known commands to list
> -	the contents of an archive'''
> -
> -
> -	fields = ['func', 'cmd']
> -
> -
> -	def __init__(self, defs=None):
> -		'''Class init
> -
> -		@param defs: dictionary of Key:[function, cmd]
> -		'''
> -		if defs is None:
> -			defs = {}
> -		#self.contents = {}
> -		self.contents_map = {}
> -
> -		# create the archive type namedtuple classes
> -		for name in list(defs):
> -			#obj = self.contents[name] =
> namedtuple(name, self.fields)
> -			obj = namedtuple(name, self.fields)
> -			obj.__slots__ = ()
> -			self.contents_map[name] =
> obj._make(defs[name])
> -		del obj
> -
> -
> -	def generate_contents(self, file_, getter="auto",
> verbose=False):
> -		try:
> -			archive = getter
> -			if archive == 'auto' and
> file_.endswith('.iso'):
> -				archive = 'isoinfo_l'
> -			if (archive in ['tar_tv','auto']):
> -				if file_.endswith('.tgz') or
> file_.endswith('.tar.gz'):
> -					archive = 'tar_tvz'
> -				elif file_.endswith('.tbz2') or
> file_.endswith('.tar.bz2'):
> -					archive = 'tar_tvj'
> -				elif file_.endswith('.tar'):
> -					archive = 'tar_tv'
> -
> -			if archive == 'auto':
> -				warn('File %r has unknown type for
> automatic detection.'
> -					% (file_, ))
> -				return None
> -			else:
> -				getter = archive
> -				func = getattr(self, '_%s_' %
> self.contents_map[getter].func)
> -				return func(file_,
> self.contents_map[getter].cmd, verbose)
> -		except:
> -			raise CatalystError(
> -				"Error generating contents, is
> appropriate utility " +
> -				"(%s) installed on your system?"
> -				% (self.contents_map[getter].cmd),
> print_traceback=True) -
> -
> -	@staticmethod
> -	def _calc_contents_(file_, cmd, verbose):
> -		_cmd = (cmd % {'file': file_ }).split()
> -		proc = Popen(_cmd, stdout=PIPE, stderr=PIPE)
> -		results = proc.communicate()
> -		result = "\n".join(results)
> -		if verbose:
> -			print result
> -		return result
> -

Yeah, punt it, I didn't do it initially in case there was problems.
But it fits better living with the compression/decompression code.  It
will be easier to keep them all in sync.  The only thing extra the
contents has is iso capability.

-- 
Brian Dolbec <dolsen>



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

* Re: [gentoo-catalyst] [PATCH] contents: punt unused module
  2015-10-09 20:32 ` Brian Dolbec
@ 2015-10-09 21:26   ` Anthony G. Basile
  2015-10-09 21:55     ` Brian Dolbec
  0 siblings, 1 reply; 4+ messages in thread
From: Anthony G. Basile @ 2015-10-09 21:26 UTC (permalink / raw
  To: gentoo-catalyst

On 10/9/15 4:32 PM, Brian Dolbec wrote:
> On Fri,  9 Oct 2015 01:53:39 -0400
> Mike Frysinger <vapier@gentoo.org> wrote:
>
>> It looks like this code has all been moved to the external DeComp pkg.
>> ---
>>   catalyst/contents.py | 87
>> ---------------------------------------------------- 1 file changed,
>> 87 deletions(-) delete mode 100644 catalyst/contents.py
>>
>> diff --git a/catalyst/contents.py b/catalyst/contents.py
>> deleted file mode 100644
>> index 73eda61..0000000
>> --- a/catalyst/contents.py
>> +++ /dev/null
>> @@ -1,87 +0,0 @@
>> -
>> -from collections import namedtuple
>> -from subprocess import Popen, PIPE
>> -
>> -from catalyst.support import CatalystError, warn
>> -
>> -
>> -# use ContentsMap.fields for the value legend
>> -# Key:[function, cmd]
>> -CONTENTS_DEFINITIONS = {
>> -	# 'find' is disabled because it requires the source path,
>> which is not
>> -	# always available
>> -	#"find"		:["calc_contents","find %(path)s"],
>> -	"tar_tv":["calc_contents","tar --xattrs tvf %(file)s"],
>> -	"tar_tvz":["calc_contents","tar --xattrs tvzf %(file)s"],
>> -	"tar_tvj":["calc_contents","tar --xattrs -I lbzip2 -tvf
>> %(file)s"],
>> -	"isoinfo_l":["calc_contents","isoinfo -l -i %(file)s"],
>> -	# isoinfo_f should be a last resort only
>> -	"isoinfo_f":["calc_contents","isoinfo -f -i %(file)s"],
>> -}
>> -
>> -
>> -class ContentsMap(object):
>> -	'''Class to encompass all known commands to list
>> -	the contents of an archive'''
>> -
>> -
>> -	fields = ['func', 'cmd']
>> -
>> -
>> -	def __init__(self, defs=None):
>> -		'''Class init
>> -
>> -		@param defs: dictionary of Key:[function, cmd]
>> -		'''
>> -		if defs is None:
>> -			defs = {}
>> -		#self.contents = {}
>> -		self.contents_map = {}
>> -
>> -		# create the archive type namedtuple classes
>> -		for name in list(defs):
>> -			#obj = self.contents[name] =
>> namedtuple(name, self.fields)
>> -			obj = namedtuple(name, self.fields)
>> -			obj.__slots__ = ()
>> -			self.contents_map[name] =
>> obj._make(defs[name])
>> -		del obj
>> -
>> -
>> -	def generate_contents(self, file_, getter="auto",
>> verbose=False):
>> -		try:
>> -			archive = getter
>> -			if archive == 'auto' and
>> file_.endswith('.iso'):
>> -				archive = 'isoinfo_l'
>> -			if (archive in ['tar_tv','auto']):
>> -				if file_.endswith('.tgz') or
>> file_.endswith('.tar.gz'):
>> -					archive = 'tar_tvz'
>> -				elif file_.endswith('.tbz2') or
>> file_.endswith('.tar.bz2'):
>> -					archive = 'tar_tvj'
>> -				elif file_.endswith('.tar'):
>> -					archive = 'tar_tv'
>> -
>> -			if archive == 'auto':
>> -				warn('File %r has unknown type for
>> automatic detection.'
>> -					% (file_, ))
>> -				return None
>> -			else:
>> -				getter = archive
>> -				func = getattr(self, '_%s_' %
>> self.contents_map[getter].func)
>> -				return func(file_,
>> self.contents_map[getter].cmd, verbose)
>> -		except:
>> -			raise CatalystError(
>> -				"Error generating contents, is
>> appropriate utility " +
>> -				"(%s) installed on your system?"
>> -				% (self.contents_map[getter].cmd),
>> print_traceback=True) -
>> -
>> -	@staticmethod
>> -	def _calc_contents_(file_, cmd, verbose):
>> -		_cmd = (cmd % {'file': file_ }).split()
>> -		proc = Popen(_cmd, stdout=PIPE, stderr=PIPE)
>> -		results = proc.communicate()
>> -		result = "\n".join(results)
>> -		if verbose:
>> -			print result
>> -		return result
>> -
> Yeah, punt it, I didn't do it initially in case there was problems.
> But it fits better living with the compression/decompression code.  It
> will be easier to keep them all in sync.  The only thing extra the
> contents has is iso capability.
>

The tar --xattrs stuff was recently added and needed.  Will it be there 
in the DeComp pkg?

-- 
Anthony G. Basile, Ph.D.
Gentoo Linux Developer [Hardened]
E-Mail    : blueness@gentoo.org
GnuPG FP  : 1FED FAD9 D82C 52A5 3BAB  DC79 9384 FA6E F52D 4BBA
GnuPG ID  : F52D4BBA



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

* Re: [gentoo-catalyst] [PATCH] contents: punt unused module
  2015-10-09 21:26   ` Anthony G. Basile
@ 2015-10-09 21:55     ` Brian Dolbec
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Dolbec @ 2015-10-09 21:55 UTC (permalink / raw
  To: gentoo-catalyst

On Fri, 9 Oct 2015 17:26:38 -0400
"Anthony G. Basile" <blueness@gentoo.org> wrote:

> On 10/9/15 4:32 PM, Brian Dolbec wrote:
> > On Fri,  9 Oct 2015 01:53:39 -0400
> > Mike Frysinger <vapier@gentoo.org> wrote:
> >
> >> It looks like this code has all been moved to the external DeComp
> >> pkg. ---
> >>   catalyst/contents.py | 87
> >> ---------------------------------------------------- 1 file
> >> changed, 87 deletions(-) delete mode 100644 catalyst/contents.py
> >>

> > Yeah, punt it, I didn't do it initially in case there was problems.
> > But it fits better living with the compression/decompression code.
> > It will be easier to keep them all in sync.  The only thing extra
> > the contents has is iso capability.
> >
> 
> The tar --xattrs stuff was recently added and needed.  Will it be
> there in the DeComp pkg?
> 

Yes, it is.  

See for yourself:
https://github.com/dol-sen/pyDeComp/blob/master/DeComp/definitions.py#L277

Also if there are other compression/decompression algorithms or
definitions you think should be added...

-- 
Brian Dolbec <dolsen>



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

end of thread, other threads:[~2015-10-09 21:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-09  5:53 [gentoo-catalyst] [PATCH] contents: punt unused module Mike Frysinger
2015-10-09 20:32 ` Brian Dolbec
2015-10-09 21:26   ` Anthony G. Basile
2015-10-09 21:55     ` Brian Dolbec

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