All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

Do not fail when no scp command is found, unless it is actually needed to fetch something

Review Request #127 - Created Jan. 28, 2011 and submitted

Oz Linden Reviewers
viewer
None autobuild
During initialization, if there is no scp or pscp command found then autobuild fails immediately.  This is true whether or not any scp urls need to be used.

This change modifies the behavior so that a warning is printed if no command is found, but execution proceeds until an scp command is needed, at which time execution fails with an explanatory message.

This patch can print the warning multiple times - I didn't attempt to suppress the extras.
I've tested this locally, simulating the error by temporarily modifying the names of the commands to be found for scp.

I have not checked it on Windows, where the original problem was found.

Diff revision 2 (Latest)

1 2
1 2

  1. autobuild/common.py: Loading...
autobuild/common.py
Revision 9ae505976dfa New Change
... 94 lines hidden [Expand]
def get_current_user():
95
        namelen = ctypes.c_int(len(name)) # len in chars, NOT bytes
95
        namelen = ctypes.c_int(len(name)) # len in chars, NOT bytes
96
        if not ctypes.windll.advapi32.GetUserNameW(name, ctypes.byref(namelen)):
96
        if not ctypes.windll.advapi32.GetUserNameW(name, ctypes.byref(namelen)):
97
            raise ctypes.WinError()
97
            raise ctypes.WinError()
98
        return name.value
98
        return name.value
99

   
99

   
100
def get_default_scp_command():
100
def get_default_scp_command():
101
    """
101
    """
102
    Return the full path to the scp command
102
    Return the full path to the scp command
103
    """
103
    """
104
    scp = find_executable(['pscp', 'scp'], ['.exe'])
104
    scp = find_executable(['pscp', 'scp'], ['.exe'])
105
    if not scp:

   
106
        raise AutobuildError("cannot find an appropriate scp or pscp command")

   
107
    return scp
105
    return scp
108

   
106

   
109
def get_default_install_cache_dir():
107
def get_default_install_cache_dir():
110
    """
108
    """
111
    In general, the package archives do not change much, so find a 
109
    In general, the package archives do not change much, so find a 
112
    host/user specific location to cache files.
110
    host/user specific location to cache files.
113
    """
111
    """
114
    return get_temp_dir("install.cache")
112
    return get_temp_dir("install.cache")
115

   
113

   
116
def get_s3_url():
114
def get_s3_url():
... 287 lines hidden [Expand]
def do_http(self, remote):
404
            url.insert(1, '/')
402
            url.insert(1, '/')
405
        url.insert(0, "http://")
403
        url.insert(0, "http://")
406
        url = ''.join(url)
404
        url = ''.join(url)
407
        logger.info("using HTTP: " + url)
405
        logger.info("using HTTP: " + url)
408
        return urllib2.urlopen(url)
406
        return urllib2.urlopen(url)
409

   
407

   
410
    def do_scp(self, remote):
408
    def do_scp(self, remote):
411
        if not self._dir:
409
        if not self._dir:
412
            self._dir = tempfile.mkdtemp()
410
            self._dir = tempfile.mkdtemp()
413
        local = os.path.join(self._dir, remote.split('/')[-1])
411
        local = os.path.join(self._dir, remote.split('/')[-1])

   
412
        if not self._scp:

   
413
            raise AutobuildError("no scp command available; cannot fetch %s" % remote)
414
        command = (self._scp, remote, local)
414
        command = (self._scp, remote, local)

   
415
        logger.info("using SCP: " + remote)
415
        rv = subprocess.call(command)
416
        rv = subprocess.call(command)
416
        if rv != 0:
417
        if rv != 0:
417
            raise AutobuildError("cannot fetch %s" % remote)
418
            raise AutobuildError("cannot fetch %s" % remote)
418
        return file(local, 'rb')
419
        return file(local, 'rb')
419

   
420

   
420
    def cleanup(self):
421
    def cleanup(self):
421
        if self._dir:
422
        if self._dir:
422
            shutil.rmtree(self._dir)
423
            shutil.rmtree(self._dir)
423

   
424

   
424
#
425
#
... 152 lines hidden [Expand]
  1. autobuild/common.py: Loading...