'Fetch a package file from a package repository.
:type filename: string
:param filename: The filename of the package file to fetch.
:type dest_path: string
:param dest_path: Destination path to download the file to.
:raise PackageFetchError: if the fetch failed'

def fetch_pkg_file(self, filename, dest_path):

    logging.info('Fetching    %s    from    %s    to    %s', filename, self.url, dest_path)
    self._quick_http_test()
    package_url = os.path.join(self.url, filename)
    try:
        cmd = (self.wget_cmd_pattern % (package_url, dest_path))
        result = self.run_command(cmd)
        file_exists = (self.run_command(('ls    %s' % dest_path), _run_command_dargs={'ignore_status': True}).exit_status == 0)
        if (not file_exists):
            logging.error('wget    failed:    %s', result)
            raise error.CmdError(cmd, result)
        logging.debug('Successfully    fetched    %s    from    %s', filename, package_url)
    except error.CmdError:
        self.run_command(('rm    -f    %s' % dest_path))
        raise error.PackageFetchError(('%s    not    found    in    %s' % (filename, package_url)))
