chiark / gitweb /
Improve some log levels
authorDaniel Martí <mvdan@mvdan.cc>
Tue, 1 Jul 2014 18:32:49 +0000 (20:32 +0200)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 1 Jul 2014 18:32:49 +0000 (20:32 +0200)
fdroidserver/import.py
fdroidserver/update.py

index e055dd70dba0debc9d843fbce405fd04f3ba0d45..e6c2fa1650cb2f555710ebba7c1be3c39a18d3e8 100644 (file)
@@ -76,7 +76,6 @@ def getrepofrompage(url):
         index = repo.find('<')
         if index == -1:
             return (None, "Error while getting repo address - no end tag? '" + repo + "'")
-            sys.exit(1)
         repo = repo[:index]
         index = repo.find(' ')
         if index == -1:
@@ -114,7 +113,7 @@ def main():
     config = common.read_config(options)
 
     if not options.url:
-        logging.info("Specify project url.")
+        logging.error("Specify project url.")
         sys.exit(1)
     url = options.url
 
@@ -163,7 +162,7 @@ def main():
         # Figure out the repo type and adddress...
         repotype, repo = getrepofrompage(sourcecode)
         if not repotype:
-            logging.info("Unable to determine vcs type. " + repo)
+            logging.error("Unable to determine vcs type. " + repo)
             sys.exit(1)
     elif (url.startswith('http://code.google.com/p/') or
             url.startswith('https://code.google.com/p/')):
@@ -178,29 +177,29 @@ def main():
         # Figure out the repo type and adddress...
         repotype, repo = getrepofrompage(sourcecode)
         if not repotype:
-            logging.info("Unable to determine vcs type. " + repo)
+            logging.error("Unable to determine vcs type. " + repo)
             sys.exit(1)
 
         # Figure out the license...
         req = urllib.urlopen(url)
         if req.getcode() != 200:
-            logging.info('Unable to find project page at ' + sourcecode + ' - return code ' + str(req.getcode()))
+            logging.error('Unable to find project page at ' + sourcecode + ' - return code ' + str(req.getcode()))
             sys.exit(1)
         page = req.read()
         index = page.find('Code license')
         if index == -1:
-            logging.info("Couldn't find license data")
+            logging.error("Couldn't find license data")
             sys.exit(1)
         ltext = page[index:]
         lprefix = 'rel="nofollow">'
         index = ltext.find(lprefix)
         if index == -1:
-            logging.info("Couldn't find license text")
+            logging.error("Couldn't find license text")
             sys.exit(1)
         ltext = ltext[index + len(lprefix):]
         index = ltext.find('<')
         if index == -1:
-            logging.info("License text not formatted as expected")
+            logging.error("License text not formatted as expected")
             sys.exit(1)
         ltext = ltext[:index]
         if ltext == 'GNU GPL v3':
@@ -218,13 +217,13 @@ def main():
         elif ltext == 'New BSD License':
             license = 'NewBSD'
         else:
-            logging.info("License " + ltext + " is not recognised")
+            logging.error("License " + ltext + " is not recognised")
             sys.exit(1)
 
     if not projecttype:
-        logging.info("Unable to determine the project type.")
-        logging.info("The URL you supplied was not in one of the supported formats. Please consult")
-        logging.info("the manual for a list of supported formats, and supply one of those.")
+        logging.error("Unable to determine the project type.")
+        logging.error("The URL you supplied was not in one of the supported formats. Please consult")
+        logging.error("the manual for a list of supported formats, and supply one of those.")
         sys.exit(1)
 
     # Get a copy of the source so we can extract some info...
@@ -245,7 +244,7 @@ def main():
 
         version, vercode, package = common.parse_androidmanifests(paths)
         if not package:
-            logging.info("Couldn't find package ID")
+            logging.error("Couldn't find package ID")
             sys.exit(1)
         if not version:
             logging.warn("Couldn't find latest version name")
@@ -262,13 +261,13 @@ def main():
             version = bconfig.get('app', 'version')
             vercode = None
         else:
-            logging.info("No android or kivy project could be found. Specify --subdir?")
+            logging.error("No android or kivy project could be found. Specify --subdir?")
             sys.exit(1)
 
     # Make sure it's actually new...
     for app in apps:
         if app['id'] == package:
-            logging.info("Package " + package + " already exists")
+            logging.error("Package " + package + " already exists")
             sys.exit(1)
 
     # Construct the metadata...
index 72d268d3b78fc57a7140a36e358360a4c0308c25..54ce4b61497d7f7c45a472d8635ea7db4cb53b05 100644 (file)
@@ -355,7 +355,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
 
         apkfilename = apkfile[len(repodir) + 1:]
         if ' ' in apkfilename:
-            logging.error("No spaces in APK filenames!")
+            logging.critical("Spaces in filenames are not allowed.")
             sys.exit(1)
 
         if apkfilename in apkcache:
@@ -394,7 +394,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
                         thisinfo['versioncode'] = int(re.match(vercode_pat, line).group(1))
                         thisinfo['version'] = re.match(vername_pat, line).group(1)
                     except Exception, e:
-                        logging.info("Package matching failed: " + str(e))
+                        logging.error("Package matching failed: " + str(e))
                         logging.info("Line was: " + line)
                         sys.exit(1)
                 elif line.startswith("application:"):
@@ -539,8 +539,8 @@ def scan_apks(apps, apkcache, repodir, knownapks):
                     continue
                 if last_density is None:
                     continue
-                logging.info("Density %s not available, resizing down from %s"
-                             % (density, last_density))
+                logging.debug("Density %s not available, resizing down from %s"
+                              % (density, last_density))
 
                 last_iconpath = os.path.join(
                     get_icon_dir(repodir, last_density), iconfilename)
@@ -566,8 +566,8 @@ def scan_apks(apps, apkcache, repodir, knownapks):
                     continue
                 if last_density is None:
                     continue
-                logging.info("Density %s not available, copying from lower density %s"
-                             % (density, last_density))
+                logging.debug("Density %s not available, copying from lower density %s"
+                              % (density, last_density))
 
                 shutil.copyfile(
                     os.path.join(get_icon_dir(repodir, last_density), iconfilename),
@@ -833,7 +833,7 @@ def make_index(apps, apks, repodir, archive, categories):
         p = FDroidPopen(args)
         # TODO keypass should be sent via stdin
         if p.returncode != 0:
-            logging.info("Failed to sign index")
+            logging.critical("Failed to sign index")
             sys.exit(1)
 
     # Copy the repo icon into the repo directory...
@@ -937,7 +937,7 @@ def main():
     for k in ['repo_icon', 'archive_icon']:
         if k in config:
             if not os.path.exists(config[k]):
-                logging.error(k + ' "' + config[k] + '" does not exist! Correct it in config.py.')
+                logging.critical(k + ' "' + config[k] + '" does not exist! Correct it in config.py.')
                 sys.exit(1)
 
     # Get all apps...