From b8a9c126d515359d3de949792a81a55f77b6e070 Mon Sep 17 00:00:00 2001 From: Loup Vaillant Date: Sun, 20 Oct 2019 01:01:43 +0200 Subject: [PATCH] Tightened up the release script - Run tests/test.sh prior to release - Removed the dist target from the shipped makefile - Removed the contributor notes from the shipped README - Don't include files that only serve to generate vectors.h - Reworded some of README a little bit. --- README.md | 27 ++++++++++++--------------- release.sh | 33 ++++++++++++++++++++++++++++++--- tarball_ignore | 8 ++++++++ 3 files changed, 50 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 02d75f8..1489645 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,8 @@ The manual can be found at https://monocypher.org/manual/, and in the `doc/` folder. The `doc/man/` folder contains the man pages. You can install them in -your system by running `make install-doc`. - -Unless you cloned the git repository, there is a html version in -`doc/html/`, that you can regenerate by executing the `doc/man2html.sh` -script. This requires mandoc. +your system by running `make install-doc`. Official releases also have a +`doc/html/` folder with an html version. Installation @@ -31,17 +28,17 @@ Installation ### Option 1: grab the sources The easiest way to use Monocypher is to include `src/monocypher.h` and -`src/monocypher.c` directly into your project. They compile as C99, -C11, C++98, C++11, C++14, and C++17. +`src/monocypher.c` directly into your project. They compile as C (since +C99) and C++ (since C++98). ### Option 2: grab the library -Alternatively, you can run `make`, then grab the `src/monocypher.h` -header and the `lib/libmonocypher.a` or `lib/libmonocypher.so` library. -The default compiler is `gcc -std=gnu99`, and the default flags are -`-pedantic -Wall -Wextra -O3 -march=native`. If they don't work on your -platform, you can change them like this: +Run `make`, then grab the `src/monocypher.h` header and either the +`lib/libmonocypher.a` or `lib/libmonocypher.so` library. The default +compiler is `gcc -std=gnu99`, and the default flags are `-pedantic -Wall +-Wextra -O3 -march=native`. If they don't work on your platform, you +can change them like this: $ make CC="clang -std=c99" CFLAGS="-O2" @@ -82,7 +79,7 @@ somewhere. *Do not* use Monocypher without running those tests at least once. -The same test suite can be run under clang sanitisers and valgrind, and +The same test suite can be run under Clang sanitisers and Valgrind, and be checked for code coverage: $ tests/test.sh @@ -174,8 +171,8 @@ option. The binary will be about 5KB smaller, and in some cases faster. Contributor notes ----------------- -If you just cloned the GitHub repository, you will miss a couple files -that ship with the tarball releases: +If you are reading this, you cloned the GitHub repository. You miss a +couple files that ship with the tarball releases: - The `test/vectors.h` header. Generating it requires Libsodium. Go to `test/gen/`, then run `make`. diff --git a/release.sh b/release.sh index f5dbaf8..bcc55f8 100755 --- a/release.sh +++ b/release.sh @@ -3,12 +3,39 @@ set -e VERSION=`git describe --tags` +FOLDER=monocypher-$VERSION +TARBALL=$FOLDER.tar.gz +# Run the tests before we do anything. It's not enough (we ought to run +# the tests from the tarball itself, including the TIS interpreter), but +# it should prevent the most egregious errors. +tests/test.sh + +# Generate documentation for users who don't have mandoc doc/man2html.sh -rsync -avd --exclude-from=tarball_ignore ./ monocypher-$VERSION + +# Delete the destination folder just to make sure everything is clean. +# May be needed if we unpack the tarball in place for testing purposes, +# then run the release script again. +rm -rf $FOLDER + +# copy everything except ignored files to the +rsync -ad --exclude-from=tarball_ignore ./ $FOLDER + +# Replace version markers by the actual version number (from tags) for file in `find monocypher-$VERSION -type f` do sed -i "s/__git__/$VERSION/g" $file done -tar -czf monocypher-$VERSION.tar.gz monocypher-$VERSION -rm -rf monocypher-$VERSION + +# Remove the dist target from the makefile (no recursive releases!) +sed '/dist:/,$d' makefile > $FOLDER/makefile + +# Remove contributor notes from the README +sed '/Contributor notes/,$d' README.md > $FOLDER/README.md + +# Make the actual tarball +tar -cvzf $TARBALL $FOLDER + +# Remove the temporary folder +rm -rf $FOLDER diff --git a/tarball_ignore b/tarball_ignore index 361426e..6346307 100644 --- a/tarball_ignore +++ b/tarball_ignore @@ -24,3 +24,11 @@ tests/formal-analysis monocypher-* lib* .git* +release.sh +tarball_ignore +tests/gen* +tests/vector_to_header.c +tests/vectors +tests/vectors/* +tests/ed25519-donna* +doc/man2html.sh -- 2.47.3