aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStanislav Ochotnicky <sochotnicky@gmail.com>2009-07-17 11:16:02 +0200
committerStanislav Ochotnicky <sochotnicky@gmail.com>2009-07-17 14:13:46 +0200
commit864845d499f2ed0a0be5f8b2c084b036dd6d3627 (patch)
treef2902e8ec819eda24a284a271c1d52652d859efa /src
parentChanged log collection to include more information (diff)
downloadcollagen-864845d499f2ed0a0be5f8b2c084b036dd6d3627.tar.gz
collagen-864845d499f2ed0a0be5f8b2c084b036dd6d3627.tar.bz2
collagen-864845d499f2ed0a0be5f8b2c084b036dd6d3627.zip
Added output of retrieved info to files
Diffstat (limited to 'src')
-rw-r--r--src/matchbox/__init__.py16
-rw-r--r--src/protocol/__init__.py11
2 files changed, 19 insertions, 8 deletions
diff --git a/src/matchbox/__init__.py b/src/matchbox/__init__.py
index f55fd91..36f6632 100644
--- a/src/matchbox/__init__.py
+++ b/src/matchbox/__init__.py
@@ -4,6 +4,8 @@ import protocol
import pickle
import StringIO
import os
+import sys
+import time
import portage
import random
@@ -63,17 +65,15 @@ class MatchboxServer(object):
client_socket.sendall(pickle.dumps(repl))
elif type(command) is protocol.AddPackageInfo:
+ fout = open("/tmp/collagen_%s" % str(time.time()), "w")
for pi in command.package_infos:
print "adding package info"
- print pi.name
- print pi.version
- print pi.use_flags
- print pi.emerge_info
- print pi.attachments
-
- print len(pi.content)
- print pi.content.keys()
+ print pi
+ sys.stdout = fout
+ print pi
+ sys.stdout = sys.__stdout__
+ fout.close()
# TODO
else:
print "unknown command: %s" % command
diff --git a/src/protocol/__init__.py b/src/protocol/__init__.py
index fd82582..da9712f 100644
--- a/src/protocol/__init__.py
+++ b/src/protocol/__init__.py
@@ -31,6 +31,17 @@ class PackageInfo(object):
self.error = None
self.emerge_info = None
self.depends = []
+ def __str__(self):
+ ret ="Name: %s\n" % self.name + \
+ "Version: %s\n" % self.version + \
+ "Content lenght: %d\n" % len(self.content) + \
+ "Content paths: %s\n" % self.content.keys() + \
+ "Emerge info: %s\n" % self.emerge_info + \
+ "Use flags: %s\n" % self.use_flags + \
+ "Depends: %s\n" % str(self.depends)
+ for key in self.attachments.keys():
+ ret = ret + "Attachment %s: \n%s\n" % (key, self.attachments[key])
+ return ret
class AddPackageInfo(MatchboxCommand):
def __init__(self, package_infos):