git.iko.soy/typeable/nixpkgs
on master help sign in
linkchecker: init at 9.3

A few changes from upstream: 1) the executable is patched to support a --no-robots flag to ignore robots.txto 2) the GUI doesn't work (for now), so this is CLI only

commitc1ffbd8ee887f7dfb17c2a5d9249929e3672b935 authorPeter Hoeg <peter@speartail.com> dateThu 26 May 2016, 17:20 (11 years ago) parentc3bb94e
3 files changed+92
pkgs/tools/networking/linkchecker/add-no-robots-flag.patch+60 pkgs/tools/networking/linkchecker/default.nix+30 pkgs/top-level/all-packages.nix+2
pkgs/tools/networking/linkchecker/add-no-robots-flag.patchnew file+60
@@ -0,0 +1,60 @@
1+diff --git a/linkcheck/checker/httpurl.py b/linkcheck/checker/httpurl.py
2+index 6f207b6..161619c 100644
3+--- a/linkcheck/checker/httpurl.py
4++++ b/linkcheck/checker/httpurl.py
5+@@ -75,7 +75,7 @@ def allows_robots (self, url):
6+ @return: True if access is granted, otherwise False
7+ @rtype: bool
8+ """
9+- return self.aggregate.robots_txt.allows_url(self)
10++ return not self.aggregate.config['robotstxt'] or self.aggregate.robots_txt.allows_url(self)
11+
12+ def content_allows_robots (self):
13+ """
14+diff --git a/linkcheck/configuration/__init__.py b/linkcheck/configuration/__init__.py
15+index fc2c148..234fa05 100644
16+--- a/linkcheck/configuration/__init__.py
17++++ b/linkcheck/configuration/__init__.py
18+@@ -163,6 +163,7 @@ def __init__ (self):
19+ ## checking options
20+ self["allowedschemes"] = []
21+ self['cookiefile'] = None
22++ self['robotstxt'] = True
23+ self["debugmemory"] = False
24+ self["localwebroot"] = None
25+ self["maxfilesizeparse"] = 1*1024*1024
26+diff --git a/linkcheck/configuration/confparse.py b/linkcheck/configuration/confparse.py
27+index 67751ed..845fa95 100644
28+--- a/linkcheck/configuration/confparse.py
29++++ b/linkcheck/configuration/confparse.py
30+@@ -149,6 +149,7 @@ def read_checking_config (self):
31+ self.get(section, 'allowedschemes').split(',')]
32+ self.read_boolean_option(section, "debugmemory")
33+ self.read_string_option(section, "cookiefile")
34++ self.read_boolean_option(section, "robotstxt")
35+ self.read_string_option(section, "localwebroot")
36+ try:
37+ self.read_boolean_option(section, "sslverify")
38+diff --git a/linkchecker b/linkchecker
39+index 199532c..9e91fa5 100755
40+--- a/linkchecker
41++++ b/linkchecker
42+@@ -321,6 +321,9 @@ group.add_argument("--cookiefile", dest="cookiefile", metavar="FILENAME",
43+ help=_(
44+ """Read a file with initial cookie data. The cookie data format is
45+ explained below."""))
46++# const because store_false doesn't detect absent flags
47++group.add_argument("--no-robots", action="store_const", const=False,
48++ dest="norobotstxt", help=_("Disable robots.txt checks"))
49+ group.add_argument("--check-extern", action="store_true",
50+ dest="checkextern", help=_("""Check external URLs."""))
51+ group.add_argument("--ignore-url", action="append", metavar="REGEX",
52+@@ -431,6 +434,8 @@ if options.externstrict:
53+ if options.extern:
54+ pats = [linkcheck.get_link_pat(arg) for arg in options.extern]
55+ config["externlinks"].extend(pats)
56++if options.norobotstxt is not None:
57++ config['robotstxt'] = options.norobotstxt
58+ if options.checkextern:
59+ config["checkextern"] = True
60+ elif not config["checkextern"]:
pkgs/tools/networking/linkchecker/default.nixnew file+30
@@ -0,0 +1,30 @@
1+{ stdenv, lib, fetchurl, python2Packages }:
2+
3+python2Packages.buildPythonApplication rec {
4+ name = "LinkChecker-${version}";
5+ version = "9.3";
6+
7+ # LinkChecker 9.3 only works with requests 2.9.x
8+ propagatedBuildInputs = with python2Packages ; [ requests2 ];
9+
10+ src = fetchurl {
11+ url = "mirror://pypi/L/LinkChecker/${name}.tar.gz";
12+ sha256 = "0v8pavf0bx33xnz1kwflv0r7lxxwj7vg3syxhy2wzza0wh6sc2pf";
13+ };
14+
15+ # upstream refuses to support ignoring robots.txt
16+ patches = [
17+ ./add-no-robots-flag.patch
18+ ];
19+
20+ postInstall = ''
21+ rm $out/bin/linkchecker-gui
22+ '';
23+
24+ meta = {
25+ description = "Check websites for broken links";
26+ homepage = "https://wummel.github.io/linkchecker/";
27+ license = lib.licenses.gpl2;
28+ maintainers = with lib.maintainers; [ peterhoeg ];
29+ };
30+}
pkgs/top-level/all-packages.nix+2
@@ -16911,6 +16911,8 @@ in
1691116911
1691216912 golden-cheetah = qt55.callPackage ../applications/misc/golden-cheetah {};
1691316913
16914+ linkchecker = callPackage ../tools/networking/linkchecker { };
16915+
1691416916 tomb = callPackage ../os-specific/linux/tomb {};
1691516917
1691616918 imatix_gsl = callPackage ../development/tools/imatix_gsl {};