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()