def scan_all_files():
     allpkgparts = PortageInterface.get_fileinfo_from_vdb(
         [os.path.join(path, file)
         for configbasedir in PortageInterface.get_config_protect(
             Config.Backend)
         for (path, dir, files) in os.walk(configbasedir)
         for file in files])
     return len([EtcProposalConfigFile(pkgpart.path).update_unmodified(pkgpart.md5) for pkgpart in allpkgparts.values()])
 def refresh(self):
     "clears and repopulates the list from the filesystem"
     self.clear_cache()
     del self[:] 
     for dir in PortageInterface.get_config_protect():
         self._add_update_proposals(dir)
     self.sort()
 def refresh(self, current_file_callback = None):
     "clears and repopulates the list from the filesystem"
     self.clear_cache()
     del self[:] 
     for dir in PortageInterface.get_config_protect(Config.Backend):
         self._add_update_proposals(dir, current_file_callback)
     self.sort()
 def update_unmodified(self, finished_proposals):
     "records the md5 if it matches the one of the file in the fs"
     finished_filepaths = set((proposal.get_file_path() for proposal in finished_proposals))
     expected_md5s =  PortageInterface.get_md5_from_vdb(finished_filepaths)
     for (path, expected_md5) in expected_md5s.iteritems():
         EtcProposalConfigFile(path).update_unmodified(expected_md5)
     for path in (finished_filepaths - set(expected_md5s.keys())):
         EtcProposalConfigFile(path).clear_unmodified()
 def runTest(self):
     """Testing vdb access"""
     nonexsistantfile = '/some nonexsistant file'
     issue = '/etc/issue'
     hostname = '/etc/conf.d/hostname'
     files = set([issue, hostname, nonexsistantfile])
     md5s = PortageInterface.get_md5_from_vdb(files)
     self.failIf(md5s.has_key(nonexsistantfile), 'Found an entry in the pkgdb that shouldnt be there: "%s".' % nonexsistantfile )
     self.failUnless(md5s.has_key(issue), 'Didnt find an entry in the pkgdb: "%s"' % issue)
     self.failUnless(md5s.has_key(hostname), 'Didnt find an entry in the pkgdb: "%s"' % hostname)
 def clear_all_states(self):
     "this is pretty much 'undo all' but it also removes orphaned state files"
     # removing deprecated old style statefile
     for dir in PortageInterface.get_config_protect():
         self._remove_statefiles(dir)
     self.refresh()
 def runTest(self):
     """Testing CONFIG_PROTECT calculation"""
     portage_config_protect = set(portage.settings['CONFIG_PROTECT'].split(' '))
     stubs_config_protect = set(PortageInterface.get_config_protect())
     self.failUnless(stubs_config_protect == portage_config_protect, 'Calculated CONFIG_PROTECT differs from the one calculated by portage.')
 def _assure_etc_in_config_protect(self):
     self.failUnless('/etc' in PortageInterface.get_config_protect(), 'This test can only run if /etc is in CONFIG_PROTECT.')