def _download_packages(self,toDownload,destdir):
    ''' 
    download the yum packages contained in the 
    to doDownload list to the 'destdir' directory
    '''
    for pkg in toDownload:
        n,a,e,v,r = pkg.pkgtup
        packages =  self.pkgSack.searchNevra(n,e,v,r,a)
        for download in packages:
            repo = self.repos.getRepo(download.repoid)
            remote = download.returnSimple('relativepath')
            local = os.path.basename(remote)
            if not os.path.exists(destdir):
                os.makedirs(destdir)
            local = os.path.join(destdir, local)
            if (os.path.exists(local) and 
                os.path.getsize(local) == int(download.returnSimple('packagesize'))):
                print "%s already exists and appears to be complete" % local
                continue
            # Disable cache otherwise things won't download
            repo.cache = 0
            download.localpath = local # Hack: to set the localpath we want.
            try:
                path = repo.getPackage(download)
            except IOError, e:
                print "Cannot write to file %s. Error was: %s" % (local, e))
                continue

