at v192 73 lines 2.6 kB view raw
1{ fetchurl, stdenv, makeWrapper, perl, LWP, URI, HTMLParser 2, HTTPServerSimple, Parent }: 3 4stdenv.mkDerivation rec { 5 name = "swec-0.4"; 6 7 src = fetchurl { 8 url = "http://random.zerodogg.org/files/${name}.tar.bz2"; 9 sha256 = "1m3971z4z1wr0paggprfz0n8ng8vsnkc9m6s3bdplgyz7qjk6jwx"; 10 }; 11 12 buildInputs = [ makeWrapper perl LWP URI HTMLParser ] 13 ++ stdenv.lib.optional doCheck [ HTTPServerSimple Parent ]; 14 15 configurePhase = 16 '' for i in swec tests/{runTests,testServer} 17 do 18 sed -i "$i" -e's|/usr/bin/perl|${perl}/bin/perl|g' 19 done 20 ''; 21 22 buildPhase = "true"; 23 installPhase = 24 '' make install prefix="$out" 25 26 mkdir -p "$out/share/${name}" 27 cp -v default.sdf "$out/share/${name}" 28 sed -i "$out/bin/swec" -e"s|realpath(\$0)|'$out/share/${name}/swec'|g" 29 30 wrapProgram "$out/bin/swec" \ 31 --prefix PERL5LIB : \ 32 ${stdenv.lib.concatStringsSep ":" 33 (map (x: "${x}/lib/perl5/site_perl") [ LWP URI HTMLParser ])} 34 ''; 35 36 doCheck = true; 37 checkPhase = "make test"; 38 39 meta = { 40 homepage = http://random.zerodogg.org/swec/; 41 42 description = "Simple Web Error Checker (SWEC)"; 43 44 longDescription = 45 '' SWEC (Simple Web Error Checker) is a program that automates testing 46 of dynamic websites. It parses each HTML file it finds for links, 47 and if those links are within the site specified (ie. local, not 48 external), it will check that page as well. In this respect it 49 works a lot like a crawler, in that it'll click on any link it finds 50 (more notes about this later). 51 52 In addition to parsing and locating links, it will also parse the 53 pages looking for known errors and report those (such as Mason or 54 PHP errors), and will report if a page can not be read (by either 55 returning a 404, 500 or similar). 56 57 Since you may often want SWEC to be logged in on your site, you have 58 to be careful. When logged in, SWEC will still click on all links 59 it finds, including things like 'join group' or 'delete account' 60 (though it has some magic trying to avoid the latter). Therefore it 61 is highly recommended that when you run SWEC as a logged-in user on 62 a site, use a test server, not the live one. 63 64 Running SWEC on a live site without being logged in as a user is 65 perfectly fine, it won't do anything a normal crawler wouldn't do 66 (well, not exactly true, SWEC will ignore robots.txt). 67 ''; 68 69 license = stdenv.lib.licenses.gpl3Plus; 70 71 maintainers = [ ]; 72 }; 73}