Improved travis file and package scanner.

This commit is contained in:
Dominik Picheta 2015-05-18 20:40:46 +01:00
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"):
@ -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