From c82702c795d2b18dec3034708b6dc30daf4d5263 Mon Sep 17 00:00:00 2001 From: Stanislav Ochotnicky Date: Thu, 30 Jul 2009 15:38:20 +0200 Subject: Add current profile name to package info --- src/protocol/__init__.py | 3 +++ src/tinderbox/__init__.py | 10 ++++++++++ 2 files changed, 13 insertions(+) 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 -- cgit v1.2.3-65-gdbad