verify-release 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  2. #***************************************************************************
  3. # _ _ ____ _
  4. # Project ___| | | | _ \| |
  5. # / __| | | | |_) | |
  6. # | (__| |_| | _ <| |___
  7. # \___|\___/|_| \_\_____|
  8. #
  9. # Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  10. #
  11. # This software is licensed as described in the file COPYING, which
  12. # you should have received as part of this distribution. The terms
  13. # are also available at https://curl.se/docs/copyright.html.
  14. #
  15. # You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. # copies of the Software, and permit persons to whom the Software is
  17. # furnished to do so, under the terms of the COPYING file.
  18. #
  19. # This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  20. # KIND, either express or implied.
  21. #
  22. # SPDX-License-Identifier: curl
  23. #
  24. ###########################################################################
  25. # This script remakes a provided curl release and verifies that the newly
  26. # built version is identical to the original file.
  27. #
  28. # It is designed to be invoked in a clean directory with the path to the
  29. # release tarball as an argument.
  30. #
  31. set -eu
  32. tarball="${1:-}"
  33. if [ -z "$tarball" ]; then
  34. echo "Provide a curl release tarball name as argument"
  35. exit
  36. fi
  37. i="0"
  38. # shellcheck disable=SC2034
  39. for dl in curl-*; do
  40. i=$((i + 1))
  41. done
  42. if test "$i" -gt 1; then
  43. echo "multiple curl-* entries found, disambiguate please"
  44. exit
  45. fi
  46. mkdir -p _tarballs
  47. rm -rf _tarballs/*
  48. # checksum the original tarball to compare with later
  49. sha256sum "$tarball" >_tarballs/checksum
  50. # extract the release contents
  51. tar xf "$tarball"
  52. curlver=$(grep '#define LIBCURL_VERSION ' curl-*/include/curl/curlver.h | sed 's/[^0-9.]//g')
  53. echo "version $curlver"
  54. timestamp=$(grep -Eo 'SOURCE_DATE_EPOCH=[0-9]*' curl-"$curlver"/docs/RELEASE-TOOLS.md | cut -d= -f2)
  55. pwd=$(pwd)
  56. cd "curl-$curlver"
  57. ./configure --without-ssl --without-libpsl
  58. ./scripts/dmaketgz "$curlver" "$timestamp"
  59. mv curl-"$curlver"* ../_tarballs/
  60. cd "$pwd"
  61. cd "_tarballs"
  62. # compare the new tarball against the original
  63. sha256sum -c checksum