diff options
author | 2010-02-08 16:44:34 +0000 | |
---|---|---|
committer | 2010-02-08 16:44:34 +0000 | |
commit | 0c3d5efb749a1fea36ce53828344f2c0c995f8e2 (patch) | |
tree | ccb230d5d1a0966d8d79ca6e2e5ca5bf96a65237 | |
parent | new class (diff) | |
download | znurt-org-backend-0c3d5efb749a1fea36ce53828344f2c0c995f8e2.tar.gz znurt-org-backend-0c3d5efb749a1fea36ce53828344f2c0c995f8e2.tar.bz2 znurt-org-backend-0c3d5efb749a1fea36ce53828344f2c0c995f8e2.zip |
Cleanup some ineffeciencies
git-svn-id: file:///var/svn/portage@84 3218660a-b0cf-4799-a991-8ddcc5b9e0f3
-rw-r--r-- | class.portage.ebuild.php | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/class.portage.ebuild.php b/class.portage.ebuild.php index 3875f25..3f3bfb5 100644 --- a/class.portage.ebuild.php +++ b/class.portage.ebuild.php @@ -1,5 +1,7 @@ <? + require_once 'class.portage.tree.php'; + /** * Notes on the standard * @@ -43,8 +45,14 @@ private $pvr; // Package version and revision (if any), for example 6.3_beta3, 6.3_beta3-r1. // File properties + private $dir; private $filename; + private $filename_cache; private $source; + private $portage; + private $cache; + private $manifest_filename; + private $basename; private $category; @@ -60,33 +68,38 @@ private $metadata_mtime; private $cache_mtime; + // hash sums + private $sha1sum; + + + function __construct($str) { global $hits; $hits['ebuild']++; + + $tree = PortageTree::singleton(); $this->atom = trim($str); $this->arr_suffix = array('alpha', 'beta', 'rc', 'pre', 'p'); - $this->portage = '/usr/portage'; + $this->portage = $tree->getTree(); $this->cache = $this->portage.'/metadata/cache'; $this->has_version = $this->hasVersion(); - $this->filename = $this->portage."/".$this->getCategory()."/".$this->getPackageName()."/".$this->getFullPackageName().".ebuild"; + $this->dir = $this->portage."/".$this->getCategory()."/".$this->getPackageName(); + $this->manifest_filename = $this->dir."/Manifest"; + + $this->basename = $this->getFullPackageName().".ebuild"; + $this->filename = $this->dir."/".$this->basename; $this->filename_cache = $this->cache."/".$this->getCategory()."/".$this->getFullPackageName(); if(file_exists($this->filename_cache)) $this->cache_mtime = filemtime($this->filename_cache); - $this->arr_metadata_keys = array('depend', 'rdepend', 'slot', 'src_uri', 'restrict', 'homepage', 'license', 'description', 'keywords', 'inherited', 'iuse', 'cdepend', 'pdepend', 'provide', 'eapi', 'properties', 'defined_phases'); - - - // Run this first to check if it has a version or not -// $this->getPackageName(); - } public function __get($var) { @@ -165,6 +178,10 @@ case 'source': return $this->source = file_get_contents($this->filename); break; + + case 'sha1sum': + return $this->sha1sum = $this->getSha1Sum(); + break; } @@ -438,6 +455,18 @@ } + function getSha1Sum() { + + require_once 'class.portage.package.manifest.php'; + + $manifest = new PackageManifest($this->manifest_filename); + + $str = $manifest->getFilenameSha1Sum($this->basename); + + return $str; + + } + function hasVersion() { $str = $this->stripCategory(); |