diff options
author | Harmen Stoppels <harmenstoppels@gmail.com> | 2023-03-16 19:46:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-16 19:46:13 +0100 |
commit | ba00da61e4b0977a16d00e3579b7e07346fdb51e (patch) | |
tree | 54371620695afb885e954adf937fc07a745abcb6 | |
parent | 825599a5106d7043379de294ff30b069724811c1 (diff) | |
download | spack-ba00da61e4b0977a16d00e3579b7e07346fdb51e.tar.gz spack-ba00da61e4b0977a16d00e3579b7e07346fdb51e.tar.bz2 spack-ba00da61e4b0977a16d00e3579b7e07346fdb51e.tar.xz spack-ba00da61e4b0977a16d00e3579b7e07346fdb51e.zip |
reduce spec.json.sig file size (#36157)
Since GPG clear-sign cannot deal with lines longer than 19995 characters
and doesn't even error but simply truncates those linese (don't ask me
why...), we have to be careful not to hit that line limit when reducing
the filesize.
So, instead this PR sets the indent level to 0 and drops the whitespace
after `: `, which still reduces file size by 50% or so.
-rw-r--r-- | lib/spack/spack/binary_distribution.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/spack/spack/binary_distribution.py b/lib/spack/spack/binary_distribution.py index 5ce7b62452..81ac908b36 100644 --- a/lib/spack/spack/binary_distribution.py +++ b/lib/spack/spack/binary_distribution.py @@ -1343,7 +1343,11 @@ def _build_tarball_in_stage_dir( spec_dict["buildinfo"] = buildinfo with open(specfile_path, "w") as outfile: - outfile.write(sjson.dump(spec_dict)) + # Note: when using gpg clear sign, we need to avoid long lines (19995 chars). + # If lines are longer, they are truncated without error. Thanks GPG! + # So, here we still add newlines, but no indent, so save on file size and + # line length. + json.dump(spec_dict, outfile, indent=0, separators=(",", ":")) # sign the tarball and spec file with gpg if not unsigned: |