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