[svn] r4758 - trunk/tools/yam

packagers at lists.rpmforge.net packagers at lists.rpmforge.net
Sat Sep 23 09:54:14 CEST 2006


Author: dag
Date: 2006-09-23 09:53:59 +0200 (Sat, 23 Sep 2006)
New Revision: 4758

Modified:
   trunk/tools/yam/yam
Log:
Small improvements to reporting

Modified: trunk/tools/yam/yam
===================================================================
--- trunk/tools/yam/yam	2006-09-23 07:40:12 UTC (rev 4757)
+++ trunk/tools/yam/yam	2006-09-23 07:53:59 UTC (rev 4758)
@@ -553,14 +553,14 @@
 
 	def rpmlist(self):
 		"Capture a list of packages in the repository"
-		list = []
+		list = Set()
 		for root, dirs, files in os.walk(self.srcdir):
 			for file in files:
 				if file.endswith('.rpm'):
 					size = os.stat(os.path.join(root, file)).st_size
-					list.append( (file, size) )
+					list.add( (file, size) )
 		list.sort()
-		return set(list)
+		return list
 
 	def check(self):
 		"Return what repositories require an update and write .newsha1sum"
@@ -744,6 +744,34 @@
 			if ret:
 				raise(YamGenerateException('%s failed with return code: %s' % (cf.cmd['repoview'], ret)))
 
+class Set:
+	def __init__(self):
+		self.list = []
+
+	def add(self, input):
+		if input not in self.list:
+			self.list.append(input)
+
+	def delete(self, input):
+		if input in self.list:
+			self.list.removed(input)
+
+	def difference(self, other):
+		newlist = Set()
+		for element in self.list:
+			if element not in other.list:
+				newlist.add(element)
+		return newlist
+
+	def sort(self):
+		return self.list.sort()
+
+	def __str__(self):
+		return '\n\t' + '\n\t'.join([element[0] for element in self.list])
+
+	def __len__(self):
+		return len(self.list)
+
 class YamMirrorException(Exception):
 	def __init__(self, value):
 		self.value = value



More information about the svn-commits mailing list