Changeset 74008 in webkit


Ignore:
Timestamp:
Dec 14, 2010 1:43:46 AM (13 years ago)
Author:
eric@webkit.org
Message:

2010-12-14 Eric Seidel <eric@webkit.org>

Reviewed by Ojan Vafai.

webkit-patch should warn users when they're using a 32-bit git on a 64-bit system
https://bugs.webkit.org/show_bug.cgi?id=50715

This patch makes webkit-patch print the following:

Warning: This machine is 64-bit, but the git binary (/usr/local/git/bin/git) does not support 64-bit.
Install a 64-bit git for better performance, see:
https://lists.webkit.org/pipermail/webkit-dev/2010-December/015249.html

I wrote this mostly because I have approximately 8 machines that I use
and making sure each one is using a good Git install seemed folly.
webkit-patch makes a lot of git calls, so using a fast git can shave
several seconds in every invocation. See the webkit-dev thread for more info.

This message will print twice during 'webkit-patch upload',
once from webkit-patch and once from check-webkit-style.

Unfortunately there is no good way to test this due to how machine-dependent
the code is. I considered writing a test for the log message, but it seemed not worth it.

  • Scripts/webkitpy/common/checkout/scm.py:
Location:
trunk/WebKitTools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKitTools/ChangeLog

    r73991 r74008  
     12010-12-14  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Ojan Vafai.
     4
     5        webkit-patch should warn users when they're using a 32-bit git on a 64-bit system
     6        https://bugs.webkit.org/show_bug.cgi?id=50715
     7
     8        This patch makes webkit-patch print the following:
     9
     10        Warning: This machine is 64-bit, but the git binary (/usr/local/git/bin/git) does not support 64-bit.
     11        Install a 64-bit git for better performance, see:
     12        https://lists.webkit.org/pipermail/webkit-dev/2010-December/015249.html
     13
     14        I wrote this mostly because I have approximately 8 machines that I use
     15        and making sure each one is using a good Git install seemed folly.
     16        webkit-patch makes a lot of git calls, so using a fast git can shave
     17        several seconds in every invocation.  See the webkit-dev thread for more info.
     18
     19        This message will print twice during 'webkit-patch upload',
     20        once from webkit-patch and once from check-webkit-style.
     21
     22        Unfortunately there is no good way to test this due to how machine-dependent
     23        the code is.  I considered writing a test for the log message, but it seemed not worth it.
     24
     25        * Scripts/webkitpy/common/checkout/scm.py:
     26
    1272010-12-13  Eric Seidel  <eric@webkit.org>
    228
  • trunk/WebKitTools/Scripts/webkitpy/common/checkout/scm.py

    r73384 r74008  
    576576    def __init__(self, cwd):
    577577        SCM.__init__(self, cwd)
     578        self._check_git_architecture()
     579
     580    def _machine_is_64bit(self):
     581        import platform
     582        # This only is tested on Mac.
     583        if not platform.mac_ver()[0]:
     584            return False
     585
     586        # platform.architecture()[0] can be '64bit' even if the machine is 32bit:
     587        # http://mail.python.org/pipermail/pythonmac-sig/2009-September/021648.html
     588        # Use the sysctl command to find out what the processor actually supports.
     589        return self.run(['sysctl', '-n', 'hw.cpu64bit_capable']).rstrip() == '1'
     590
     591    def _executable_is_64bit(self, path):
     592        # Again, platform.architecture() fails us.  On my machine
     593        # git_bits = platform.architecture(executable=git_path, bits='default')[0]
     594        # git_bits is just 'default', meaning the call failed.
     595        file_output = self.run(['file', path])
     596        return re.search('x86_64', file_output)
     597
     598    def _check_git_architecture(self):
     599        if not self._machine_is_64bit():
     600            return
     601
     602        # We could path-search entirely in python or with
     603        # which.py (http://code.google.com/p/which), but this is easier:
     604        git_path = self.run(['which', 'git']).rstrip()
     605        if self._executable_is_64bit(git_path):
     606            return
     607
     608        webkit_dev_thead_url = "https://lists.webkit.org/pipermail/webkit-dev/2010-December/015249.html"
     609        log("Warning: This machine is 64-bit, but the git binary (%s) does not support 64-bit.\nInstall a 64-bit git for better performance, see:\n%s\n" % (git_path, webkit_dev_thead_url))
    578610
    579611    @classmethod
Note: See TracChangeset for help on using the changeset viewer.