Beispiel #1
0
 def _clean(self, dirpath, files):
     """Remove the given filenames from dirpath."""
     count = 0
     for f in files:
         path = os.path.join(dirpath, f)
         logger.debug(_('Removing file %s'), path)
         misc.unlink_f(path)
         count += 1
     return count
Beispiel #2
0
    def setUp(self):
        # find the newest 'tour' package available
        self.pkg = max(self.base.sack.query().available().filter(name='tour'))
        self.assertEqual(str(self.pkg), PACKAGE)

        # pretend it's remote and not cached
        self.pkg.repo.__class__.local = False
        self.pkg.localPkg = lambda: '/tmp/%s.rpm' % PACKAGE
        unlink_f(self.pkg.localPkg())
Beispiel #3
0
def _clean(dirpath, files):
    """Remove the given filenames from dirpath."""
    count = 0
    for f in files:
        path = os.path.join(dirpath, f)
        logger.log(dnf.logging.DDEBUG, 'Removing file %s', path)
        misc.unlink_f(path)
        count += 1
    return count
Beispiel #4
0
def _clean(dirpath, files):
    """Remove the given filenames from dirpath."""
    count = 0
    for f in files:
        path = os.path.join(dirpath, f)
        logger.log(dnf.logging.DDEBUG, 'Removing file %s', path)
        misc.unlink_f(path)
        count += 1
    return count
Beispiel #5
0
Datei: drpm.py Projekt: zde/dnf
 def job_done(self, pid, code):
     # handle a finished delta rebuild
     po = self.jobs.pop(pid)
     if code != 0:
         unlink_f(po.rpm.localPkg())
         self.err[po] = _('Delta RPM rebuild failed')
     elif not po.rpm.verifyLocalPkg():
         self.err[po] = _('Checksum of the delta-rebuilt RPM failed')
     else:
         os.unlink(po.localPkg())
         if self.progress:
             name = os.path.basename(po.rpm.localPkg())
             self.progress.end(name, None, 'done', 'DRPM')
Beispiel #6
0
    def job_done(self, pid, code):
        # handle a finished delta rebuild
        logger.debug('drpm: %d: return code: %d, %d', pid, code >> 8, code & 0xff)

        pload = self.jobs.pop(pid)
        pkg = pload.pkg
        if code != 0:
            unlink_f(pload.pkg.localPkg())
            self.err[pkg] = [_('Delta RPM rebuild failed')]
        elif not pload.pkg.verifyLocalPkg():
            self.err[pkg] = [_('Checksum of the delta-rebuilt RPM failed')]
        else:
            os.unlink(pload.localPkg())
            self.progress.end(pload, dnf.callback.STATUS_DRPM, 'done')
Beispiel #7
0
    def job_done(self, pid, code):
        # handle a finished delta rebuild
        logger.debug('drpm: %d: return code: %d, %d', pid, code >> 8, code & 0xff)

        pload = self.jobs.pop(pid)
        pkg = pload.pkg
        if code != 0:
            unlink_f(pload.pkg.localPkg())
            self.err[pkg] = [_('Delta RPM rebuild failed')]
        elif not pload.pkg.verifyLocalPkg():
            self.err[pkg] = [_('Checksum of the delta-rebuilt RPM failed')]
        else:
            os.unlink(pload.localPkg())
            self.progress.end(pload, dnf.callback.STATUS_DRPM, 'done')
Beispiel #8
0
def _clean_filelist(filetype, filelist):
    removed = 0
    for item in filelist:
        try:
            misc.unlink_f(item)
        except OSError:
            logger.critical(_('Cannot remove %s file %s'), filetype, item)
            continue
        else:
            logger.log(dnf.logging.DDEBUG, _('%s file %s removed'), filetype,
                       item)
            removed += 1
    msg = P_('%d %s file removed', '%d %s files removed', removed)
    msg %= (removed, filetype)
    return 0, [msg]
Beispiel #9
0
def _clean_filelist(filetype, filelist):
    removed = 0
    for item in filelist:
        try:
            misc.unlink_f(item)
        except OSError:
            logger.critical(_('Cannot remove %s file %s'),
                                 filetype, item)
            continue
        else:
            logger.log(dnf.logging.DDEBUG,
                _('%s file %s removed'), filetype, item)
            removed += 1
    msg = P_('%d %s file removed', '%d %s files removed', removed)
    msg %= (removed, filetype)
    return 0, [msg]
Beispiel #10
0
    def setUp(self):
        cachedir = tempfile.mkdtemp()
        self.addCleanup(shutil.rmtree, cachedir)
        self.base = support.MockBase()

        # load the testing repo
        repo = self.base.add_test_dir_repo('drpm', cachedir)
        repo.deltarpm = True

        # find the newest 'tour' package available
        self.pkg = max(self.base.sack.query().available().filter(name='tour'))
        self.assertEqual(str(self.pkg), PACKAGE)

        # pretend it's remote and not cached
        self.addCleanup(mock.patch.stopall)
        mock.patch.object(self.pkg.repo.__class__, 'local', False).start()
        self.pkg.localPkg = lambda: '/tmp/%s.rpm' % PACKAGE
        unlink_f(self.pkg.localPkg())
Beispiel #11
0
    def setUp(self):
        cachedir = tempfile.mkdtemp()
        self.addCleanup(shutil.rmtree, cachedir)
        self.base = support.MockBase()

        # load the testing repo
        repo = self.base.add_test_dir_repo('drpm', cachedir)
        repo.deltarpm = True

        # find the newest 'tour' package available
        self.pkg = max(self.base.sack.query().available().filter(name='tour'))
        self.assertEqual(str(self.pkg), PACKAGE)

        # pretend it's remote and not cached
        self.addCleanup(mock.patch.stopall)
        mock.patch.object(self.pkg.repo.__class__, 'local', False).start()
        self.pkg.localPkg = lambda: '/tmp/%s.rpm' % PACKAGE
        unlink_f(self.pkg.localPkg())