1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] How can you verify two tar.gz files are identical

Discussão em 'Python' iniciado por Stack, Outubro 7, 2024 às 08:12.

  1. Stack

    Stack Membro Participativo

    I am making a sharing protocol, and when you share a folder it gets tar.gz-ipped and inserted in a folder.

    It's created like this:

    with tarfile.open(full_data_name, "w:gz", format=GNU_FORMAT) as tar_handle:
    ...
    tar_handle.add(file_path)


    When you do that again, I'd like to verify and check if new tar.gz is identical to the old one (so I do not need to re-publish it).

    I know about pkgdiff and that works fine, but I'd like to do it in python.

    I also know I can do it manually, de-zip&tar the files, load up the content and verify byte wise, but isn't there some simpler and less resource hungry method?

    I have tried to just check the contents of the tar.gz files (removing the timestamp at byte 4-7) but that only works sometimes, so I guess there is some random reshuffling in the tar part or some randomness in the gz, as pkgdiff says they are the same, but a hex editor shows lots of differences.

    Continue reading...

Compartilhe esta Página