Ejemplo n.º 1
0
 def test_vercmp_badarg2(self):
     success = False
     try:
         alpm.vercmp("12", 9)
     except TypeError:
         success = True
     self.assertEqual(success,True)
Ejemplo n.º 2
0
 def test_vercmp(self):
     tests = [
         "0.18.0-1 0.16a-1",
         "20100907-1 20100803-4",
         "97-2 98-8",
         "1b 2a",
         "1.2-5 1.2-9"
     ] # Any ideas for more?
     for t in tests:
         (local, remote) = t.split(" ")
         our_result = alpm.vercmp(local,remote)
         pman_result = int(subprocess.getoutput("vercmp " + t))
         self.assertEqual(our_result, pman_result)
Ejemplo n.º 3
0
 def _get_aur_updates(self):
     packages = self.ALPM.get_foreign()
     retval = list()
     for pkg in packages:
         LOG.debug("Polling AUR for package %s"%pkg['name'])
         local_version = pkg['version']
         try:
             aur_version = alpm.get_aur_version(pkg['name'])
             if alpm.vercmp(local_version, aur_version) < 0:
                 retval.append({'name':pkg['name'],'version':aur_version,\
                     'oldversion':local_version})
         except alpm.NoSuchPackageException as exc:
             LOG.warning("Package %s does not exist in aur, skipping"\
                 %pkg['name'])
             continue
         except urllib.error.URLError as url_error:
             LOG.error("A URL error occurred: %s"%url_error.reason)
             continue
         except SSLError as ssl_error:
             LOG.error("An SSL error occurred while polling AUR: %s"%\
                     (ssl_error))
     return retval