Skip to content
  • Liyang HU's avatar
    Distribution.Simple.Program.Ar: Emulate GNU ar's deterministic mode. · 2b69a589
    Liyang HU authored
    After invoking ar(1), replace each object file's metadata with zero for the
    mtime, UID and GID, and 0644 for the file mode. Do not touch the existing
    archive if the contents are the same.
    
    This rewrites the previous patch to,
     ∙ also wipe UID, GID and file mode;
     ∙ do a single read/write for each header, and less seeking in general;
     ∙ do its work inside a temporary directory, via 'withTempDirectory';
       ∘ Which also deletes the temporary target when it's identical to the old.
     ∙ use Distribution.Compat.CopyFile.filesEqual;
     ∙ use the standard 'dieWithLocation' instead of invoking 'error'.
    2b69a589