We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`spack checksum` finds wrong URLs
I was having some problems getting spack to find the correct URL for files.

With these settings

``` python
    homepage = "http://fishshell.com/"
    url      = "http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz"
    list_url = homepage
```

I get the following result (with wrong URLs):

``` sh
$ spack checksum fish
==> Found 5 versions of fish.
  2.2.0     http://fishshell.com/fish-2.2.0.tar.gz
  2.1.2     http://fishshell.com/fish-2.1.2.tar.gz
  2.1.1     http://fishshell.com/fish-2.1.1.tar.gz
  2.1.0     http://fishshell.com/fish-2.1.0.tar.gz
  2.0.0     http://fishshell.com/fish-2.0.0.tar.gz

How many would you like to checksum? (default is 5, q to abort)
==> Downloading...
==> Trying to fetch from http://fishshell.com/fish-2.2.0.tar.gz

curl: (22) The requested URL returned error: 404 Not Found
==> Fetching from http://fishshell.com/fish-2.2.0.tar.gz failed.
==> Error: All fetchers failed for spack-stage-Slflbn
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `var/spack/repos/builtin/packages/fish/package.py`
Content:
```
1 ##############################################################################
2 # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
3 # Produced at the Lawrence Livermore National Laboratory.
4 #
5 # This file is part of Spack.
6 # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
7 # LLNL-CODE-647188
8 #
9 # For details, see https://github.com/llnl/spack
10 # Please also see the LICENSE file for our notice and the LGPL.
11 #
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU Lesser General Public License (as
14 # published by the Free Software Foundation) version 2.1, February 1999.
15 #
16 # This program is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
19 # conditions of the GNU Lesser General Public License for more details.
20 #
21 # You should have received a copy of the GNU Lesser General Public
22 # License along with this program; if not, write to the Free Software
23 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 ##############################################################################
25 from spack import *
26 
27 
28 class Fish(Package):
29     """fish is a smart and user-friendly command line shell for OS X, Linux, and
30     the rest of the family.
31     """
32 
33     homepage = "http://fishshell.com/"
34     url      = "http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz"
35     list_url = "http://fishshell.com/files/"
36     list_depth = 2
37 
38     version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')
39 
40     def install(self, spec, prefix):
41         configure('--prefix=%s' % prefix)
42 
43         make()
44         make("install")
45
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/var/spack/repos/builtin/packages/fish/package.py b/var/spack/repos/builtin/packages/fish/package.py
--- a/var/spack/repos/builtin/packages/fish/package.py
+++ b/var/spack/repos/builtin/packages/fish/package.py
@@ -32,8 +32,7 @@
 
     homepage = "http://fishshell.com/"
     url      = "http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz"
-    list_url = "http://fishshell.com/files/"
-    list_depth = 2
+    list_url = "http://fishshell.com/"
 
     version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')

{"golden_diff": "diff --git a/var/spack/repos/builtin/packages/fish/package.py b/var/spack/repos/builtin/packages/fish/package.py\n--- a/var/spack/repos/builtin/packages/fish/package.py\n+++ b/var/spack/repos/builtin/packages/fish/package.py\n@@ -32,8 +32,7 @@\n \n     homepage = \"http://fishshell.com/\"\n     url      = \"http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz\"\n-    list_url = \"http://fishshell.com/files/\"\n-    list_depth = 2\n+    list_url = \"http://fishshell.com/\"\n \n     version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')\n", "issue": "`spack checksum` finds wrong URLs\nI was having some problems getting spack to find the correct URL for files.\n\nWith these settings\n\n``` python\n    homepage = \"http://fishshell.com/\"\n    url      = \"http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz\"\n    list_url = homepage\n```\n\nI get the following result (with wrong URLs):\n\n``` sh\n$ spack checksum fish\n==> Found 5 versions of fish.\n  2.2.0     http://fishshell.com/fish-2.2.0.tar.gz\n  2.1.2     http://fishshell.com/fish-2.1.2.tar.gz\n  2.1.1     http://fishshell.com/fish-2.1.1.tar.gz\n  2.1.0     http://fishshell.com/fish-2.1.0.tar.gz\n  2.0.0     http://fishshell.com/fish-2.0.0.tar.gz\n\nHow many would you like to checksum? (default is 5, q to abort)\n==> Downloading...\n==> Trying to fetch from http://fishshell.com/fish-2.2.0.tar.gz\n\ncurl: (22) The requested URL returned error: 404 Not Found\n==> Fetching from http://fishshell.com/fish-2.2.0.tar.gz failed.\n==> Error: All fetchers failed for spack-stage-Slflbn\n```\n\n", "before_files": [{"content": "##############################################################################\n# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.\n# Produced at the Lawrence Livermore National Laboratory.\n#\n# This file is part of Spack.\n# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.\n# LLNL-CODE-647188\n#\n# For details, see https://github.com/llnl/spack\n# Please also see the LICENSE file for our notice and the LGPL.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License (as\n# published by the Free Software Foundation) version 2.1, February 1999.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and\n# conditions of the GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n##############################################################################\nfrom spack import *\n\n\nclass Fish(Package):\n    \"\"\"fish is a smart and user-friendly command line shell for OS X, Linux, and\n    the rest of the family.\n    \"\"\"\n\n    homepage = \"http://fishshell.com/\"\n    url      = \"http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz\"\n    list_url = \"http://fishshell.com/files/\"\n    list_depth = 2\n\n    version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')\n\n    def install(self, spec, prefix):\n        configure('--prefix=%s' % prefix)\n\n        make()\n        make(\"install\")\n", "path": "var/spack/repos/builtin/packages/fish/package.py"}], "after_files": [{"content": "##############################################################################\n# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.\n# Produced at the Lawrence Livermore National Laboratory.\n#\n# This file is part of Spack.\n# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.\n# LLNL-CODE-647188\n#\n# For details, see https://github.com/llnl/spack\n# Please also see the LICENSE file for our notice and the LGPL.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU Lesser General Public License (as\n# published by the Free Software Foundation) version 2.1, February 1999.\n#\n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and\n# conditions of the GNU Lesser General Public License for more details.\n#\n# You should have received a copy of the GNU Lesser General Public\n# License along with this program; if not, write to the Free Software\n# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n##############################################################################\nfrom spack import *\n\n\nclass Fish(Package):\n    \"\"\"fish is a smart and user-friendly command line shell for OS X, Linux, and\n    the rest of the family.\n    \"\"\"\n\n    homepage = \"http://fishshell.com/\"\n    url      = \"http://fishshell.com/files/2.2.0/fish-2.2.0.tar.gz\"\n    list_url = \"http://fishshell.com/\"\n\n    version('2.2.0', 'a76339fd14ce2ec229283c53e805faac48c3e99d9e3ede9d82c0554acfc7b77a')\n\n    def install(self, spec, prefix):\n        configure('--prefix=%s' % prefix)\n\n        make()\n        make(\"install\")\n", "path": "var/spack/repos/builtin/packages/fish/package.py"}]}