diff options
author | 2009-07-30 15:38:20 +0200 | |
---|---|---|
committer | 2009-07-30 18:57:44 +0200 | |
commit | c82702c795d2b18dec3034708b6dc30daf4d5263 (patch) | |
tree | 01e88e7206b30dd179cf9e4f26a57fa66a156938 | |
parent | Added ip address/port to client handler context (diff) | |
download | collagen-c82702c795d2b18dec3034708b6dc30daf4d5263.tar.gz collagen-c82702c795d2b18dec3034708b6dc30daf4d5263.tar.bz2 collagen-c82702c795d2b18dec3034708b6dc30daf4d5263.zip |
Add current profile name to package info
-rw-r--r-- | src/protocol/__init__.py | 3 | ||||
-rw-r--r-- | src/tinderbox/__init__.py | 10 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/protocol/__init__.py b/src/protocol/__init__.py index da9712f..b2ba89e 100644 --- a/src/protocol/__init__.py +++ b/src/protocol/__init__.py @@ -22,6 +22,7 @@ class PackageInfo(object): error: None if no error, else holds error code emerge_info: output from emerge --info depends: list of dependencies this package has been built with in CPV form + profile: portage profile enabled (e.g. default/linux/x86/2008.0/desktop) """ self.name = None self.version = None @@ -31,6 +32,7 @@ class PackageInfo(object): self.error = None self.emerge_info = None self.depends = [] + self.profile = None def __str__(self): ret ="Name: %s\n" % self.name + \ "Version: %s\n" % self.version + \ @@ -38,6 +40,7 @@ class PackageInfo(object): "Content paths: %s\n" % self.content.keys() + \ "Emerge info: %s\n" % self.emerge_info + \ "Use flags: %s\n" % self.use_flags + \ + "Profile: %s\n" % self.profile + \ "Depends: %s\n" % str(self.depends) for key in self.attachments.keys(): ret = ret + "Attachment %s: \n%s\n" % (key, self.attachments[key]) diff --git a/src/tinderbox/__init__.py b/src/tinderbox/__init__.py index b3da906..bf7e96b 100644 --- a/src/tinderbox/__init__.py +++ b/src/tinderbox/__init__.py @@ -441,8 +441,18 @@ class Package(object): pi.content = self.content pi.attachments = self.attachments pi.depends = self.depends + pi.profile = self._get_current_profile() return pi + def _get_current_profile(self): + ret = None + try: + profpath = os.readlink("%s/etc/make.profile" % portage.root) + ret = profpath[profpath.rindex("profiles")+len("profiles")+1:] + except Exception, e: + print e + return ret + def get_package_contents(self): """Returns package contents as dict with paths as keys |