Improved travis file and package scanner.

This commit is contained in:
Dominik Picheta 2015-05-18 20:40:46 +01:00
parent 32fe581193
commit 3b0c1291ae
2 changed files with 18 additions and 18 deletions

View File

@ -1,15 +1,14 @@
os: os:
- linux - linux
language: c language: c
env:
- BRANCH="travis"
- BRANCH="devel"
install: install:
- git clone -b $BRANCH git://github.com/Araq/Nim.git; cd Nim; git clone -b $BRANCH --depth 1 git://github.com/nim-lang/csources; cd csources && sh build.sh; cd ..; bin/nim c koch; ./koch boot -d:release; cd .. - |
wget http://nim-lang.org/download/nim-0.11.2.tar.xz
tar xf nim-0.11.2.tar.xz
cd nim-0.11.2
sh build.sh
before_script: before_script:
- set -e - set -e

View File

@ -1,8 +1,7 @@
# A very simple Nim package scanner. # A very simple Nim package scanner.
# #
# Scan the package list from: # Scans the package list from this repository.
# https://github.com/nim-lang/packages/blob/master/packages.json
# #
# Check the packages for: # Check the packages for:
# * Missing/unknown license # * Missing/unknown license
@ -19,9 +18,9 @@
import httpclient import httpclient
import net import net
import json import json
import os
const const
PKG_LIST_URL = "https://raw.githubusercontent.com/nim-lang/packages/master/packages.json"
LICENSES = @[ LICENSES = @[
"Allegro 4 Giftware", "Allegro 4 Giftware",
@ -50,7 +49,7 @@ proc check(): int =
echo "" echo ""
let let
pkg_list = parseJson(getContent(PKG_LIST_URL)) pkg_list = parseJson(readFile(getCurrentDir() / "packages.json"))
for pdata in pkg_list: for pdata in pkg_list:
if not pdata.hasKey("name"): if not pdata.hasKey("name"):
@ -60,25 +59,25 @@ proc check(): int =
name = pdata["name"].str name = pdata["name"].str
if not pdata.hasKey("method"): if not pdata.hasKey("method"):
echo "E: ", name, "has no method" echo "E: ", name, " has no method"
result.inc() result.inc()
elif not (pdata["method"].str in VCS_TYPES): elif not (pdata["method"].str in VCS_TYPES):
echo "E: ", name, "has an unknown method: ", pdata["method"].str echo "E: ", name, " has an unknown method: ", pdata["method"].str
result.inc() result.inc()
if not pdata.hasKey("license"): if not pdata.hasKey("license"):
echo "E: ", name, "has no license" echo "E: ", name, " has no license"
result.inc() result.inc()
elif not (pdata["license"].str in LICENSES): elif not (pdata["license"].str in LICENSES):
echo "W: ", name, "has an unexpected license: ", pdata["license"] echo "W: ", name, " has an unexpected license: ", pdata["license"]
if not pdata.hasKey("description"): if not pdata.hasKey("description"):
echo "E: ", name, "has no description" echo "E: ", name, " has no description"
result.inc() result.inc()
if not pdata.hasKey("web"): if not pdata.hasKey("web"):
echo "E: ", name, "has no URL" echo "E: ", name, " has no URL"
result.inc() result.inc()
continue continue
@ -87,11 +86,13 @@ proc check(): int =
name = pdata["name"].str name = pdata["name"].str
url = pdata["web"].str url = pdata["web"].str
try: try:
discard getContent(url, timeout=3000) discard getContent(url, timeout=400)
except HttpRequestError, TimeoutError, AssertionError: except HttpRequestError, TimeoutError:
echo "E: ", name, ": unable to fetch repository ", url, " ", getCurrentExceptionMsg() echo "E: ", name, ": unable to fetch repository ", url, " ", getCurrentExceptionMsg()
result.inc() result.inc()
except AssertionError:
echo "W: ", name, ": httpclient failed ", url, " ", getCurrentExceptionMsg()
echo "Error count: ", result echo "Error count: ", result
return return