/[soft]/mga-gnome/trunk/mga-gnome
ViewVC logotype

Diff of /mga-gnome/trunk/mga-gnome

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3044 by ovitters, Fri Feb 24 10:35:05 2012 UTC revision 3045 by ovitters, Fri Feb 24 12:26:02 2012 UTC
# Line 11  import argparse Line 11  import argparse
11  import errno  import errno
12  import tempfile  import tempfile
13  import shutil  import shutil
14    import rpm
15  from sgmllib import SGMLParser  from sgmllib import SGMLParser
16    
17  MEDIA="Core Release Source"  MEDIA="Core Release Source"
# Line 26  def version_cmp(a, b): Line 27  def version_cmp(a, b):
27        -1 if a < b        -1 if a < b
28        0  if a == b        0  if a == b
29        1  if a > b        1  if a > b
30        """
31    
32      Logic from Bugzilla::Install::Util::vers_cmp"""      return rpm.labelCompare(('1', a, '1'), ('1', b, '1'))
     A = re_version.findall(a.lstrip('0'))  
     B = re_version.findall(b.lstrip('0'))  
   
     while A and B:  
         a = A.pop(0)  
         b = B.pop(0)  
   
         if a == b:  
             continue  
         elif a == '-':  
             return -1  
         elif b == '-':  
             return 1  
         elif a == '.':  
             return -1  
         elif b == '.':  
             return 1  
         elif a.isdigit() and b.isdigit():  
             c = cmp(a, b) if (a.startswith('0') or b.startswith('0')) else cmp(int(a, 10), int(b, 10))  
             if c:  
                 return c  
         else:  
             c = cmp(a.upper(), b.upper())  
             if c:  
                 return c  
   
     return cmp(len(A), len(B))  
33    
34  def get_latest_version(versions, max_version=None):  def get_latest_version(versions, max_version=None):
35      """Gets the latest version number      """Gets the latest version number
# Line 161  class SpecFile(object): Line 136  class SpecFile(object):
136              write_file(self.path, data)              write_file(self.path, data)
137    
138    
139          # Check RPM also agrees that version number has increased          # Verify that RPM also agrees that version number has changed
140          if self.version != version:          if self.version != version:
141              print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version              print "ERROR: Increased version to %s, but RPM doesn't agree!?!" % version
142              return False              return False

Legend:
Removed from v.3044  
changed lines
  Added in v.3045

  ViewVC Help
Powered by ViewVC 1.1.30