def _update_section_(self, section, release=False): rpath = self.release.path(section, release=release) localpath = pjoin(self.local.source.distpath, rpath) url = pjoin(self.source.distpath, rpath) status = self.local.check_section(section, release=release) if status == 'missing': makepaths(dirname(localpath)) rfile = get_url(url) filecopy(rfile, localpath) elif status == 'corrupt': rfile = get_url(url) filecopy(rfile, localpath) else: print localpath, status
def update_flatrepos(self): rpath = self.release.path(section, release=release) localpath = path.join(self.backup.source.distpath, rpath) url = path.join(self.local.source.distpath, rpath) status = self.backup.check_section(section, release=release) if status == 'missing': makepaths(path.dirname(localpath)) rfile = get_url(url) filecopy(rfile, localpath) elif status == 'corrupt': rfile = get_url(url) filecopy(rfile, localpath) else: print localpath, status
def _update_packagelist_(self, filename='Packages.gz'): self.local.parse() self.source.sections = self.local.sections rpath = pjoin(self.source.uri, self.source.suite, filename) lpath = pjoin(self.local.source.distpath, filename) packagelist = get_url(rpath) self._write_file_(packagelist, lpath)
def _update_packagelist_(self, filename='Packages.gz'): self.backup.parse() self.local.source.sections = self.backup.sections rpath = path.join(self.local.source.uri, self.local.source.suite, filename) lpath = path.join(self.backup.source.distpath, filename) packagelist = get_url(rpath) self._write_file_(packagelist, lpath)
def update_release(self): makepaths(self.local.source.distpath) localpath = pjoin(self.local.source.distpath, 'Release') url = pjoin(self.source.distpath, 'Release') release = get_url(url) if not isfile(localpath): self._write_release_(release, localpath) release.seek(0) rsum = md5sum(release, keepopen=True) lsum = md5sum(file(localpath)) release.seek(0) if lsum != rsum: self._write_release_(release, localpath) release.seek(0) self.local.parse_release() self.release = self.local.release
def _update_section_(self, section, release=False): rpath = self.release.path(section, release=release) localpath = join(self.local_src.distpath, rpath) url = join(self.remote_src.distpath, rpath) status = self.local.check_dist_section(section, release=release) please_insert = False if not self.local._section_.count_rows(section) and not release: please_insert = True while status in ['missing', 'corrupt']: if status == 'missing': makepaths(dirname(localpath)) rfile = get_url(url) filecopy(rfile, localpath) print localpath, status status = self.local.check_dist_section(section, release=release) print localpath, status if please_insert: self.insert_section_data(section) elif status == 'corrupt': self.insert_section_data(section)
def get_remote_release(self): url = join(self.remote_src.distpath, 'Release') release_file = get_url(url) release_file.seek(0) return release_file