[jhbuild/external-deps: 4/19] Logic to bail out if system version is too old



commit 1cc8a669296c3f59bcc1129797506bebd53d6a38
Author: John Carr <john carr unrouted co uk>
Date:   Thu May 28 12:39:52 2009 +0100

    Logic to bail out if system version is too old
---
 jhbuild/utils/systempackages.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/jhbuild/utils/systempackages.py b/jhbuild/utils/systempackages.py
index ecefbf9..d1fbb1b 100644
--- a/jhbuild/utils/systempackages.py
+++ b/jhbuild/utils/systempackages.py
@@ -64,12 +64,20 @@ class DebianPackages(SystemPackages):
             if pkg.Name == name:
                 if not pkg.CurrentVer:
                     return False
+                if version and apt_pkg.VersionCompare(version, pkg.CurrentVer.VerStr) > 0:
+                    return False
                 return True
         return False
 
     def is_available(self, name, version=None):
         for pkg in self.apt_cache.Packages:
             if pkg.Name == name:
+                if version:
+                    versions = list(pkg.VersionList)
+                    versions.sort(lambda x,y: apt_pkg.VersionCompare(x.VersionStr, y.VersionStr))
+                    newest = versions[-1].VerStr
+                    if apt_pkg.VersionCompare(version, newest) > 0:
+                        return False
                 return True
         return False
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]