Skip to content
This repository has been archived by the owner on May 4, 2021. It is now read-only.

Ticket29294 #332

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
28 changes: 26 additions & 2 deletions scripts/maint/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,36 @@ def main(args):
# While we use Github releases and not dist.tpo
print("\n6. Create release tarball")
print("-------------------------")

print("\nCreating a release tarball...")
subprocess.call(
"git archive --format=tar.gz --prefix=sbws-{}/ "
"-o v{}.tar.gz v{}"
.format(release_version, release_version, release_version).split(' ')
)
print("\nCreating tarball hash file...")
fd = open('v{}.tar.gz.sha256'.format(release_version), 'w')
subprocess.call("sha256sum v{}.tar.gz".format(release_version).split(' '),
stdout=fd)
fd.close()

print("Obtaining Github tarball...")
# This will overwrite local tarball, but that's fine since the hash file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overwriting the local tarball is only fine if the user reads the output of the script, and notices when the GitHub tarball is different. Please put the tarballs in separate files.

# won't be overwritten.
subprocess.call(
"torsocks wget https://github.com/torproject/sbws/archive/v{}.tar.gz"
.format(release_version).split(' ')
"wget https://github.com/torproject/sbws/archive/v{}.tar.gz "
"-O v{}.tar.gz"
.format(release_version, release_version).split(' ')
)

print("Verifying Github tarball and local one are the same...")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we do a sha256 check, rather than a file diff check.
In fact, I'm not sure why we do this check at all?
Please add a comment explaining why it is important that GitHub matches our local tarball.

Are tarballs reproducible?
What happens if the tarballs are different?
Can they be different on different OSes?
Does GitHub guarantee that their tarballs are created with particular git and tar versions on a particular OS?

try:
subprocess.check_call("sha256sum -c v{}.tar.gz.sha256"
.format(release_version).split(' '))
except subprocess.CalledProcessError:
print("Tarballs are not the same")
sys.exit(1)

print("\n7. Create the tarball signature")
print("-------------------------------")
print("Creating detached signature...")
Expand Down