]> git.decadent.org.uk Git - dak.git/commitdiff
merge from master
authorMike O'Connor <stew@vireo.org>
Fri, 13 Mar 2009 13:30:41 +0000 (09:30 -0400)
committerMike O'Connor <stew@vireo.org>
Fri, 13 Mar 2009 13:30:41 +0000 (09:30 -0400)
Signed-off-by: Mike O'Connor <stew@vireo.org>
1  2 
daklib/binary.py

index 8dd9b30113cdf7800aa2420d0e0726a3a5374d2b,042cd266070a300f6e62644f8c709866cf6e7de1..57b0f65ddd30183f67a670733a6a5d3abe8c5ade
@@@ -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()