WebKitTools:
authoraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jun 2007 23:58:50 +0000 (23:58 +0000)
committeraroben <aroben@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Jun 2007 23:58:50 +0000 (23:58 +0000)
        Land CygwinDownloader.

        Rubberstamped by Hyatt.

        * CygwinDownloader/cygwin-downloader.py: Added.
        * CygwinDownloader/cygwin-downloader.zip: Added.
        * CygwinDownloader/make-zip.sh: Added.
        * CygwinDownloader/setup.py: Added.

WebKitSite:

        Update the location of cygwin-downloader.zip.

        Rubberstamped by Hyatt.

        * building/tools.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@23466 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitSite/ChangeLog
WebKitSite/building/tools.html
WebKitTools/ChangeLog
WebKitTools/CygwinDownloader/cygwin-downloader.py [new file with mode: 0644]
WebKitTools/CygwinDownloader/cygwin-downloader.zip [new file with mode: 0644]
WebKitTools/CygwinDownloader/make-zip.sh [new file with mode: 0755]
WebKitTools/CygwinDownloader/setup.py [new file with mode: 0644]

index b68c882eb4c1dca0d04630a233609224ab482338..3fc45881fb6313f31d213b345a4a78c748379978 100644 (file)
@@ -1,3 +1,11 @@
+2007-06-12  Adam Roben  <aroben@apple.com>
+
+        Update the location of cygwin-downloader.zip.
+
+        Rubberstamped by Hyatt.
+
+        * building/tools.html:
+
 2007-06-12  Dave Hyatt  <hyatt@apple.com>
   
         Add Windows checkout/build instructions to the website.
index b322dfbcfbfae5556cf411e86fc5341d65aca4b3..483ac8a93f106b057302f2713ba2d10372e4be31 100644 (file)
@@ -35,7 +35,7 @@ client, but also additional tools that are required to build the WebKit source.
 have made a downloader available that automatically collects all of the required
 packages.
 <p>Download <a 
-href="cygwin-downloader.zip">cygwin-downloader.zip</a>.</p>
+href="http://svn.webkit.org/repository/webkit/trunk/WebKitTools/CygwinDownloader/cygwin-downloader.zip">cygwin-downloader.zip</a>.</p>
 <p>Right-click <tt>cygwin-downloader.zip</tt> and choose <b>Extract All...</b>.
 Keep all the default options and click <b>Next</b> until the file is extracted and the cygwin-downloader folder opens.</p>
 <p>Double-click <tt>cygwin-downloader.exe</tt>. This will download all the Cygwin packages you need.</p>
index 687703d995ea3c14fee8193ed7e5a89b2b6b31c7..4dcb6e94b5ebc8b2d47e2f00ae157b69dd89e186 100644 (file)
@@ -1,3 +1,14 @@
+2007-06-12  Adam Roben  <aroben@apple.com>
+
+        Land CygwinDownloader.
+
+        Rubberstamped by Hyatt.
+
+        * CygwinDownloader/cygwin-downloader.py: Added.
+        * CygwinDownloader/cygwin-downloader.zip: Added.
+        * CygwinDownloader/make-zip.sh: Added.
+        * CygwinDownloader/setup.py: Added.
+
 2007-06-06  Vladimir Olexa  <vladimir.olexa@gmail.com>
 
         Reviewed by Mark Rowe.
diff --git a/WebKitTools/CygwinDownloader/cygwin-downloader.py b/WebKitTools/CygwinDownloader/cygwin-downloader.py
new file mode 100644 (file)
index 0000000..07b3f9f
--- /dev/null
@@ -0,0 +1,153 @@
+#!/usr/bin/env python
+
+import os, random, sys, time, urllib
+
+#
+# Options
+#
+
+dry_run = len(sys.argv) > 1 and "--dry-run" in set(sys.argv[1:])
+quiet = len(sys.argv) > 1 and "--quiet" in set(sys.argv[1:])
+
+#
+# Functions and constants
+#
+
+def download_progress_hook(block_count, block_size, total_blocks):
+        if quiet or random.random() > 0.5:
+                return
+        sys.stdout.write(".")
+        sys.stdout.flush()
+
+def download_url_to_file(url, file, message):
+        if not quiet:
+                print message + " ",
+        if not dry_run:
+                dir = os.path.dirname(file)
+                if len(dir) and not os.path.exists(dir):
+                    os.makedirs(dir)
+                urllib.urlretrieve(url, file, download_progress_hook)
+        if not quiet:
+                print
+# This is mostly just the list of North America http mirrors from http://cygwin.com/mirrors.html,
+# but a few have been removed that seemed unresponsive from Cupertino.
+mirror_servers = ["http://cygwin.elite-systems.org/",
+                  "http://mirror.mcs.anl.gov/cygwin/",
+                  "http://cygwin.osuosl.org/",
+                  "http://mirrors.kernel.org/sourceware/cygwin/",
+                  "http://cygwin.mirrors.hoobly.com/",
+                  "http://cygwin.rtin.bz/",
+                  "http://mirrors.wikifusion.info/cygwin/",
+                  "http://mirrors.xmission.com/cygwin/",
+                  "http://sourceware.mirrors.tds.net/pub/sourceware.org/cygwin/"]
+
+package_mirror_url = mirror_servers[random.choice(range(len(mirror_servers)))]
+
+def download_package(package, message):
+        download_url_to_file(package_mirror_url + package["path"], package["path"], message)
+
+required_packages = frozenset(["apache",
+                               "bc",
+                               "bison",
+                               "curl",
+                               "e2fsprogs",
+                               "emacs",
+                               "flex",
+                               "gcc",
+                               "gperf",
+                               "make",
+                               "nano",
+                               "openssh",
+                               "patch",
+                               "perl",
+                               "perl-libwin32",
+                               "rebase",
+                               "subversion",
+                               "unzip",
+                               "vim",
+                               "zip"])
+
+#
+# Main
+#
+
+print "Using Cygwin mirror server " + package_mirror_url + " to download setup.ini..."
+
+urllib.urlretrieve(package_mirror_url + "setup.ini", "setup.ini.orig")
+
+downloaded_packages_file_path = "setup.ini.orig"
+downloaded_packages_file = file(downloaded_packages_file_path, "r")
+if not dry_run:
+    modified_packages_file = file("setup.ini", "w")
+
+packages = {}
+current_package = ''
+for line in downloaded_packages_file.readlines():
+        if line[0] == "@":
+                current_package = line[2:-1]
+                packages[current_package] = {"name": current_package, "needs_download": False, "requires": [], "path": ""}
+        elif line[:10] == "category: ":
+                if current_package in required_packages:
+                        line = "category: Base\n"
+                if "Base" in set(line[10:-1].split()):
+                        packages[current_package]["needs_download"] = True
+        elif line[:10] == "requires: ":
+                packages[current_package]["requires"] = line[10:].split()
+                packages[current_package]["requires"].sort()
+        elif line[:9] == "install: " and not len(packages[current_package]["path"]):
+                end_of_path = line.find(" ", 9)
+                if end_of_path != -1:
+                        packages[current_package]["path"] = line[9:end_of_path]
+        if not dry_run:
+            modified_packages_file.write(line)
+
+downloaded_packages_file.close()
+os.remove(downloaded_packages_file_path)
+if not dry_run:
+    modified_packages_file.close()
+
+names_to_download = set()
+package_names = packages.keys()
+package_names.sort()
+
+def add_package_and_dependencies(name):
+        if name in names_to_download:
+                return
+        packages[name]["needs_download"] = True
+        names_to_download.add(name)
+        for dep in packages[name]["requires"]:
+                add_package_and_dependencies(dep)
+
+for name in package_names:
+        if packages[name]["needs_download"]:
+                add_package_and_dependencies(name)
+
+downloaded_so_far = 0
+for name in package_names:
+        if packages[name]["needs_download"]:
+                downloaded_so_far += 1
+                download_package(packages[name], "Downloading package %3d of %3d (%s)" % (downloaded_so_far, len(names_to_download), name))
+
+download_url_to_file("http://cygwin.com/setup.exe", "setup.exe", "Downloading setup.exe")
+
+seconds_to_sleep = 10
+
+print """
+Finished downloading Cygwin. In %d seconds,
+I will run setup.exe. Select the "Install
+from Local Directory" option and browse to
+"%s"
+when asked for the "Local Package Directory".
+""" % (seconds_to_sleep, os.getcwd())
+
+
+while seconds_to_sleep > 0:
+        print "%d..." % seconds_to_sleep,
+        sys.stdout.flush()
+        time.sleep(1)
+        seconds_to_sleep -= 1
+print
+
+if not dry_run:
+        os.execl("setup.exe")
diff --git a/WebKitTools/CygwinDownloader/cygwin-downloader.zip b/WebKitTools/CygwinDownloader/cygwin-downloader.zip
new file mode 100644 (file)
index 0000000..3bf541a
Binary files /dev/null and b/WebKitTools/CygwinDownloader/cygwin-downloader.zip differ
diff --git a/WebKitTools/CygwinDownloader/make-zip.sh b/WebKitTools/CygwinDownloader/make-zip.sh
new file mode 100755 (executable)
index 0000000..4a389a9
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+PYTHONEXE=$(cygpath -u "${SYSTEMDRIVE}\\Python25\\python.exe")
+ZIPNAME="cygwin-downloader.zip"
+
+if [[ ! -f "${PYTHONEXE}" ]]; then
+        echo "Couldn't find python.exe at ${PYTHONEXE}" 1>&2
+        exit 1
+fi
+
+"${PYTHONEXE}" setup.py py2exe || {
+        echo "Failed executing setup.py" 1>&2
+        exit 1
+}
+
+rm -f "${ZIPNAME}"
+
+cd dist
+
+zip -r ../"${ZIPNAME}" * || {
+        echo "Failed to create cygwin-downloader" 1>&2
+        exit 1
+}
+
+cd ..
+
+rm -rf build dist || {
+        echo "Failed to cleanup cygwin-downloader and build directories" 1>&2
+        exit 1
+}
diff --git a/WebKitTools/CygwinDownloader/setup.py b/WebKitTools/CygwinDownloader/setup.py
new file mode 100644 (file)
index 0000000..c3171d9
--- /dev/null
@@ -0,0 +1,4 @@
+from distutils.core import setup
+import py2exe
+
+setup(console=['cygwin-downloader.py'])