view make/mirror.py @ 65:503142fc4d43

Make index/section links bidirectional, so you can jump back to the index from the start of each section.
author Rob Landley <rob@landley.net>
date Mon, 08 Oct 2007 04:19:54 -0500
parents 93c68f362860
children b1069151f74b
line wrap: on
line source

#!/usr/bin/python

import os, sys, popen2

# Download stuff to populate mirror/

try: os.mkdir("mirror")
except: pass
os.chdir("mirror")

# Fetch mirrored files if we haven't already got them

for i in (["b6398cf2d5b3cc6e2bfe572adb856dd8dddb707a", "http://www.moses.uklinux.net/patches/lki-single.html"],
          ["08727c048f443926adadb9bf86248e71eab3cbf9", "http://www.moses.uklinux.net/patches/lki.pdf"],
          ["de58dfc537e24d5e0b7cbf50666e50efafe996e7", "http://www.linux.org.uk/~ajh/ols2002_proceedings.pdf.gz","ols2002.pdf.gz"],
          ["1e7c6f9fd7722805bcba78ea4afa57ceea87e16c", "http://web.archive.org/web/20031002044046/http://archive.linuxsymposium.org/ols2003/Proceedings/LinuxSymposium2003.pdf", "ols2003.pdf"],
          ["710e98915c0b6474cabf4dd27b3d80483cb14aac", "http://web.archive.org/web/20040910220019/http://www.finux.org/proceedings/LinuxSymposium2004_V1.pdf", "ols2004v1.pdf"],
          ["0e5ab31d392a7c03213c23c3ca84c8be37a0727d", "http://web.archive.org/web/20040910220019/http://www.finux.org/proceedings/LinuxSymposium2004_V2.pdf", "ols2004v2.pdf"],
          ["2abfcb9265191e64e9c22d3f6f9dc9404b27419e", "http://www.linuxsymposium.org/2005/linuxsymposium_procv1.pdf", "ols2005v1.pdf"],
          ["437a4c35c72667f9d35012546e0d5a4720693f3f", "http://www.linuxsymposium.org/2005/linuxsymposium_procv2.pdf", "ols2005v2.pdf"],
          ["355ac65470c38333b26d55b7c8493d93c419cd2e", "http://www.linuxsymposium.org/2006/linuxsymposium_procv1.pdf","ols2006v1.pdf"],
          ["ab250f4549b13b47425e0400ea7762f21eb01cde", "http://www.linuxsymposium.org/2006/linuxsymposium_procv2.pdf","ols2006v2.pdf"],
          ["765e049036ca947af05fb5b4f29b9daf4b363558", "https://ols2006.108.redhat.com/2007/Reprints/OLS2007-Proceedings-V1.pdf", "ols2007v1.pdf"],
          ["60fdaa6a74dec29a0538325b742bee4097247c6d", "https://ols2006.108.redhat.com/2007/Reprints/OLS2007-Proceedings-V2.pdf", "ols2007v2.pdf"]
         ):
  file=i[1].split('/')[-1]
  if len(i)>2: file=i[2]
  print "check %s" % file
  if i[0]:
    sha1=popen2.Popen3('sha1sum %s' % file).fromchild.read().split()
    if sha1 and i[0] == sha1[0]:
      continue
  print "fetch %s" % i[1]
  if os.system('wget -O "%s" "%s"' % (file, i[1])):
    sys.stderr.write("wget failed\n")
    sys.exit(1)