Ejemplo n.º 1
0
    def fetch(self, fetcher, progress):
        fetcher.reset()
        item = fetcher.enqueue(self._hdlurl, uncomp=True)
        fetcher.run(progress=progress)
        if item.getStatus() == SUCCEEDED:
            localpath = item.getTargetPath()
            digest = getFileDigest(localpath)
            if digest == self._digest:
                return True
            self.removeLoaders()
            loader = RPMHeaderListLoader(localpath, self._baseurl)
            loader.setChannel(self)
            self._loaders.append(loader)
        elif fetcher.getCaching() is NEVER:
            lines = [
                _("Failed acquiring information for '%s':") % self,
                u"%s: %s" % (item.getURL(), item.getFailedReason())
            ]
            raise Error, "\n".join(lines)
        else:
            return False

        digest = self._digest

        return True
Ejemplo n.º 2
0
    def fetch(self, fetcher, progress):
        fetcher.reset()
        item = fetcher.enqueue(self._hdlurl, uncomp=True)
        fetcher.run(progress=progress)
        if item.getStatus() == SUCCEEDED:
            localpath = item.getTargetPath()
            digest = getFileDigest(localpath)
            if digest == self._digest:
                return True
            self.removeLoaders()
            loader = RPMHeaderListLoader(localpath, self._baseurl)
            loader.setChannel(self)
            self._loaders.append(loader)
        elif fetcher.getCaching() is NEVER:
            lines = [_("Failed acquiring information for '%s':") % self,
                     u"%s: %s" % (item.getURL(), item.getFailedReason())]
            raise Error, "\n".join(lines)
        else:
            return False

        digest = self._digest

        return True
Ejemplo n.º 3
0
    def test_RPMHeaderListLoader_loadFileProvides(self):
        get_header_filenames_mock = self.mocker.replace(get_header_filenames)
        get_header_filenames_mock(ANY)
        self.mocker.passthrough()
        self.mocker.count(2)

        self.mocker.replay()

        cache = Cache()

        loader = RPMHeaderListLoader(
            "%s/aptrpm/base/pkglist.main" % TESTDATADIR, "http://base.url")
        loader.setCache(cache)
        loader.load()

        loader.loadFileProvides("/")
Ejemplo n.º 4
0
    def test_RPMHeaderListLoader_loadFileProvides(self):
        get_header_filenames_mock = self.mocker.replace(get_header_filenames)
        get_header_filenames_mock(ANY)
        self.mocker.passthrough()
        self.mocker.count(2)

        self.mocker.replay()

        cache = Cache()

        loader = RPMHeaderListLoader("%s/aptrpm/base/pkglist.main" %
                                     TESTDATADIR, "http://base.url")
        loader.setCache(cache)
        loader.load()

        loader.loadFileProvides("/")