From 3b0c1291ae27d392ca1c4e1a582585ab01f82b5e Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Mon, 18 May 2015 20:40:46 +0100 Subject: [PATCH] Improved travis file and package scanner. --- .travis.yml | 11 +++++------ package_scanner.nim | 25 +++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 944e760..09af11f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,14 @@ - os: - linux language: c -env: - - BRANCH="travis" - - BRANCH="devel" - 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: - set -e diff --git a/package_scanner.nim b/package_scanner.nim index 8f9bc3f..9977f2e 100644 --- a/package_scanner.nim +++ b/package_scanner.nim @@ -1,8 +1,7 @@ # A very simple Nim package scanner. # -# Scan the package list from: -# https://github.com/nim-lang/packages/blob/master/packages.json +# Scans the package list from this repository. # # Check the packages for: # * Missing/unknown license @@ -19,9 +18,9 @@ import httpclient import net import json +import os const - PKG_LIST_URL = "https://raw.githubusercontent.com/nim-lang/packages/master/packages.json" LICENSES = @[ "Allegro 4 Giftware", @@ -50,7 +49,7 @@ proc check(): int = echo "" let - pkg_list = parseJson(getContent(PKG_LIST_URL)) + pkg_list = parseJson(readFile(getCurrentDir() / "packages.json")) for pdata in pkg_list: if not pdata.hasKey("name"): @@ -60,25 +59,25 @@ proc check(): int = name = pdata["name"].str if not pdata.hasKey("method"): - echo "E: ", name, "has no method" + echo "E: ", name, " has no method" result.inc() 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() if not pdata.hasKey("license"): - echo "E: ", name, "has no license" + echo "E: ", name, " has no license" result.inc() 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"): - echo "E: ", name, "has no description" + echo "E: ", name, " has no description" result.inc() if not pdata.hasKey("web"): - echo "E: ", name, "has no URL" + echo "E: ", name, " has no URL" result.inc() continue @@ -87,11 +86,13 @@ proc check(): int = name = pdata["name"].str url = pdata["web"].str 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() result.inc() + except AssertionError: + echo "W: ", name, ": httpclient failed ", url, " ", getCurrentExceptionMsg() echo "Error count: ", result return