'Upload a single file. Depending on the upload path, the appropriate
method for that protocol is called. Currently this simply copies the
file to the target directory (but can be extended for other protocols)
This assumes that the web server is running on the same machine where
the method is being called from. The upload_path\'s files are
basically served by that web server.'

def upload_pkg_file(self, file_path, upload_path):

    try:
        if upload_path.startswith('ssh://'):
            (hostline, remote_path) = parse_ssh_path(upload_path)
            try:
                utils.run(('scp    %s    %s:%s' % (file_path, hostline, remote_path)))
                r_path = os.path.join(remote_path, os.path.basename(file_path))
                utils.run(("ssh    %s    'chmod    644    %s'" % (hostline, r_path)))
            except error.CmdError:
                logging.error('Error    uploading    to    repository    %s', upload_path)
        else:
            shutil.copy(file_path, upload_path)
            os.chmod(os.path.join(upload_path, os.path.basename(file_path)), 420)
    except (IOError, os.error) as why:
        logging.error('Upload    of    %s    to    %s    failed:    %s', file_path, upload_path, why)
