Update of /cvsroot/fink/php-lib
In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv5736

Modified Files:
        finkinfo.inc test.php 
Log Message:
a few minor tweaks and a package/release tuple object

Index: finkinfo.inc
===================================================================
RCS file: /cvsroot/fink/php-lib/finkinfo.inc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- finkinfo.inc        15 Nov 2007 19:10:04 -0000      1.2
+++ finkinfo.inc        15 Nov 2007 19:17:45 -0000      1.3
@@ -26,12 +26,12 @@
 
        public function getId() {
                $id = $this->name;
-               if (isset($this->epoch))    { $id .= '_' . $this->epoch; };
+               if (!empty($this->epoch))   { $id .= '-' . $this->epoch; };
                if (isset($this->version))  {
-                       if (isset($this->epoch)) {
+                       if (!empty($this->epoch)) {
                                $id .= ':' . $this->version;
                        } else {
-                               $id .= '_' . $this->version;
+                               $id .= '-' . $this->version;
                        }
                }
                if (isset($this->revision)) { $id .= '-' . $this->revision; };
@@ -132,7 +132,7 @@
        }
 
        public function getId() {
-               $id = $this->distribution . '-' . $this->version . '-' . 
$this->type;
+               $id = $this->distribution->getId() . '-' . $this->version . '-' 
. $this->type;
                return $id;
        }
 
@@ -146,4 +146,22 @@
        }
 }
 
+class PackageRelease {
+       protected $package;
+       protected $release;
+
+       public function __construct($release, $package) {
+               $this->release = $release;
+               $this->package = $package;
+       }
+
+       public function getId() {
+               return $this->release->getId() . '-' . $this->package->getId();
+       }
+
+       public function __toString() {
+               return $this->getId();
+       }
+}
+
 ?>

Index: test.php
===================================================================
RCS file: /cvsroot/fink/php-lib/test.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- test.php    15 Nov 2007 19:10:05 -0000      1.1
+++ test.php    15 Nov 2007 19:17:46 -0000      1.2
@@ -7,6 +7,9 @@
 $dist = new Distribution("10.5", "i386");
 $release = new Release($dist, "unstable", "current");
 
+$pr = new PackageRelease($release, $foo);
+
 echo "foo = " . $foo . "\n";
 echo "dist = " . $dist . "\n";
 echo "release = " . $release . "\n";
+echo "pr = " . $pr . "\n";


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fink-commits mailing list
[email protected]
http://news.gmane.org/gmane.os.apple.fink.cvs

Reply via email to