From: Mike O'Connor Date: Fri, 13 Mar 2009 13:30:41 +0000 (-0400) Subject: merge from master X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a650ca814d48fbe72cde347828d405e5da780b80;p=dak merge from master Signed-off-by: Mike O'Connor --- a650ca814d48fbe72cde347828d405e5da780b80 diff --cc daklib/binary.py index 8dd9b301,042cd266..57b0f65d --- a/daklib/binary.py +++ b/daklib/binary.py @@@ -191,52 -154,11 +191,51 @@@ class Binary(object) except: traceback.print_exc() - result = False - return False + os.chdir(cwd) + return result - finally: - os.chdir( cwd ) + def check_utf8_package(self, package): + """ + Unpack the .deb, do sanity checking, and gather info from it. + + Currently information gathering consists of getting the contents list. In + the hopefully near future, it should also include gathering info from the + control file. + + @ptype bootstrap_id: int + @param bootstrap_id: the id of the binary these packages + should be associated or zero meaning we are not bootstrapping + so insert into a temporary table + + @return True if the deb is valid and contents were imported + """ + rejected = not self.valid_deb() + self.__unpack() + + if not rejected and self.tmpdir: + cwd = os.getcwd() + try: + os.chdir(self.tmpdir) + if self.chunks[1] == "control.tar.gz": + control = tarfile.open(os.path.join(self.tmpdir, "control.tar.gz" ), "r:gz") + control.extract('control', self.tmpdir ) + if self.chunks[2] == "data.tar.gz": + data = tarfile.open(os.path.join(self.tmpdir, "data.tar.gz"), "r:gz") + elif self.chunks[2] == "data.tar.bz2": + data = tarfile.open(os.path.join(self.tmpdir, "data.tar.bz2" ), "r:bz2") + + for tarinfo in data: + try: + unicode( tarinfo.name ) + except: + print >> sys.stderr, "E: %s has non-unicode filename: %s" % (package,tarinfo.name) + + except: + traceback.print_exc() + result = False + + os.chdir(cwd) if __name__ == "__main__": Binary( "/srv/ftp.debian.org/queue/accepted/halevt_0.1.3-2_amd64.deb" ).scan_package()