(self, structure, layer_id)
return True
Verify layer file in repository
Verify layer file in repository
Verify layer file in repository
def _verify_layer_file(self, structure, layer_id):
        """Verify layer file in repository"""
        (layer_algorithm, layer_hash) = self._split_layer_id(layer_id)
        layer_f = structure["repolayers"][layer_id]["layer_f"]
        if not (os.path.exists(layer_f) and
                os.path.islink(layer_f)):
            Msg().err("Error: layer data file symbolic link not found",
                      layer_id)
            return False
        if not os.path.exists(self.cur_tagdir + '/' +
                              os.readlink(layer_f)):
            Msg().err("Error: layer data file not found")
            return False
        if "gzip" in OSInfo('/').get_filetype(layer_f):
            if not FileUtil(layer_f).verify_tar():
                Msg().err("Error: layer tar verify failed:", layer_f)
                return False
        if layer_algorithm:
            layer_f_chksum = ChkSUM().hash(layer_f, layer_algorithm)
            if layer_f_chksum and layer_f_chksum != layer_hash:
                Msg().err("Error: layer file chksum failed:", layer_f)
                return False
        return True
def _verify_layer_file ( self , structure , layer_id ) : ( layer_algorithm , layer_hash ) = self . _split_layer_id ( layer_id ) layer_f = structure [ "repolayers" ] [ layer_id ] [ "layer_f" ] if not ( os . path . exists ( layer_f ) and os . path . islink ( layer_f ) ) : Msg ( ) . err ( "Error: layer data file symbolic link not found" , layer_id ) return False if not os . path . exists ( self . cur_tagdir + '/' + os . readlink ( layer_f ) ) : Msg ( ) . err ( "Error: layer data file not found" ) return False if "gzip" in OSInfo ( '/' ) . get_filetype ( layer_f ) : if not FileUtil ( layer_f ) . verify_tar ( ) : Msg ( ) . err ( "Error: layer tar verify failed:" , layer_f ) return False if layer_algorithm : layer_f_chksum = ChkSUM ( ) . hash ( layer_f , layer_algorithm ) if layer_f_chksum and layer_f_chksum != layer_hash : Msg ( ) . err ( "Error: layer file chksum failed:" , layer_f ) return False return True