|
1 |
| -#!/usr/bin/env bash |
| 1 | +#!/bin/bash |
2 | 2 | #*******************************************************************************
|
3 |
| -# Copyright (c) 2017 IBM Corporation and others. |
| 3 | +# Copyright (c) 2017, 2025 IBM Corporation and others. |
4 | 4 | #
|
5 | 5 | # This program and the accompanying materials
|
6 | 6 | # are made available under the terms of the Eclipse Public License 2.0
|
|
13 | 13 | # David Williams - initial API and implementation
|
14 | 14 | #*******************************************************************************
|
15 | 15 | #
|
16 |
| -# this localBuildProperties.shsource file is to ease local builds to |
17 |
| -# override some variables. |
18 |
| -# It should not be used for production builds. |
19 |
| -source localBuildProperties.shsource 2>/dev/null |
20 |
| - |
21 | 16 | echo "[DEBUG] Producing checksums starting"
|
22 | 17 | echo "[DEBUG] current directory: ${PWD}"
|
23 |
| -if [[ -z "${SCRIPT_PATH}" ]] |
24 |
| -then |
25 |
| - echo -e "\n\tWARNING: SCRIPT_PATH not defined in ${0##*/}" |
26 |
| -else |
27 |
| - source "${SCRIPT_PATH}/bashUtilities.shsource" |
28 |
| - checkSumStart="$(date +%s )" |
29 |
| -fi |
30 |
| - |
31 |
| -# This checkSums script is called twice, once while publishing Eclipse DL site, again |
32 |
| -# when publishing Equinox DL site. We use a simple heuristic to |
33 |
| -# make use of "eclipse" or "equinox". |
34 |
| -# TODO: better design to require it to be passed in? |
35 |
| -currentDirectory="${PWD}" |
36 |
| -equinoxPattern="^.*equinox.*$" |
37 |
| -eclipsePattern="^.*eclipse.*$" |
38 |
| -if [[ "${currentDirectory}" =~ $equinoxPattern ]] |
39 |
| -then |
40 |
| - client="equinox" |
41 |
| -elif [[ "${currentDirectory}" =~ $eclipsePattern ]] |
42 |
| -then |
43 |
| - client="eclipse" |
44 |
| -else |
45 |
| - echo -e "\n\t[ERROR]: Unknown client: ${client} in ${0##*/}\n" |
46 |
| - exit 1 |
47 |
| -fi |
48 | 18 |
|
49 | 19 | allCheckSumsSHA512=checksum/${client}-${BUILD_ID}-SUMSSHA512
|
| 20 | +fileExtensionsToHash='zip dmg gz tar.xz jar' |
50 | 21 |
|
51 | 22 | # Remove the "all" files, here at beginning if they all ready exist,
|
52 | 23 | # so that subsequent calls can all use append (i.e. ">>")
|
53 | 24 |
|
54 |
| -rm ${allCheckSumsSHA512} |
55 |
| - |
56 |
| -#array of zipfiles |
57 |
| -zipfiles=`ls *.zip` |
58 |
| - |
59 |
| -for zipfile in ${zipfiles} |
60 |
| -do |
61 |
| - # There is one zip file to not list, eclipse.platform.releng.aggregator-<hash>.zip, which is merely |
62 |
| - # a collected utility scripts used to run unit tests. |
63 |
| - aggrPattern="^eclipse.platform.releng.aggregator.*.zip$" |
64 |
| - if [[ ! "${zipfile}" =~ $aggrPattern ]] |
65 |
| - then |
66 |
| - echo [sha512] ${zipfile} |
67 |
| - sha512sum -b ${zipfile} | tee checksum/${zipfile}.sha512 >>${allCheckSumsSHA512} |
68 |
| - fi |
69 |
| -done |
70 |
| - |
71 |
| -#array of dmgfiles |
72 |
| -dmgfiles=`ls *.dmg` |
73 |
| - |
74 |
| -for dmgfile in ${dmgfiles} |
75 |
| -do |
76 |
| - echo [sha512] ${dmgfile} |
77 |
| - sha512sum -b ${dmgfile} | tee checksum/${dmgfile}.sha512 >>${allCheckSumsSHA512} |
78 |
| -done |
79 |
| - |
80 |
| -#array of tar.gzip files |
81 |
| -gzipfiles=`ls *.gz` |
82 |
| - |
83 |
| -for gzipfile in ${gzipfiles} |
84 |
| -do |
85 |
| - echo [sha512] ${gzipfile} |
86 |
| - sha512sum -b ${gzipfile} | tee checksum/${gzipfile}.sha512 >>${allCheckSumsSHA512} |
87 |
| -done |
88 |
| - |
89 |
| -#array of tar.xz files |
90 |
| -xzfiles=`ls *.tar.xz` |
91 |
| - |
92 |
| -for xzfile in ${xzfiles} |
93 |
| -do |
94 |
| - echo [sha512] ${xzfile} |
95 |
| - sha512sum -b ${xzfile} | tee checksum/${xzfile}.sha512 >>${allCheckSumsSHA512} |
96 |
| -done |
97 |
| - |
98 |
| - |
99 |
| -#array of .jar files |
100 |
| -jarfiles=`ls *.jar` |
101 |
| - |
102 |
| -for jarfile in ${jarfiles} |
103 |
| -do |
104 |
| - echo [sha512] ${jarfile} |
105 |
| - sha512sum -b ${jarfile} | tee checksum/${jarfile}.sha512 >>${allCheckSumsSHA512} |
| 25 | +rm -f ${allCheckSumsSHA512} |
| 26 | + |
| 27 | +for extension in ${fileExtensionsToHash}; do |
| 28 | + files=$(ls *.${extension}) |
| 29 | + for file in ${files}; do |
| 30 | + # There is one zip file to not list, eclipse.platform.releng.aggregator-<hash>.zip, which is merely |
| 31 | + # a collected utility scripts used to run unit tests. |
| 32 | + aggrPattern="^eclipse.platform.releng.aggregator.*.zip$" |
| 33 | + if [[ ! "${file}" =~ $aggrPattern ]]; then |
| 34 | + echo [sha512] ${file} |
| 35 | + sha512sum -b ${file} | tee checksum/${file}.sha512 >>${allCheckSumsSHA512} |
| 36 | + fi |
| 37 | + done |
106 | 38 | done
|
107 | 39 |
|
108 | 40 | # We'll always try to sign checksum files, if passphrase file exists
|
109 | 41 | echo "[DEBUG] Producing GPG signatures starting."
|
110 |
| -# We make double use of the "client". One to simplify signing script. Second to identify times in timefile. |
111 |
| -# remember, this "WORKSPACE" is for genie.releng for production builds. |
| 42 | +set -e |
112 | 43 | if [ ! -z "${KEYRING_PASSPHRASE}" ]
|
113 | 44 | then
|
114 |
| - signature_file512=${allCheckSumsSHA512}.asc |
115 |
| - gpg --detach-sign --armor --output ${signature_file512} --batch --yes --passphrase-fd 0 ${allCheckSumsSHA512} <<< "${KEYRING_PASSPHRASE}" |
| 45 | + gpg --detach-sign --armor --output ${allCheckSumsSHA512}.asc --batch --pinentry-mode loopback --passphrase-fd 0 ${allCheckSumsSHA512} <<< "${KEYRING_PASSPHRASE}" |
116 | 46 | else
|
117 | 47 | # We don't treat as ERROR since would be normal in a "local build".
|
118 | 48 | # But, would be an ERROR in production build so could be improved.
|
119 | 49 | echo -e "\n\t[WARNING] The key_passphrase_file did not exist or was not readable.\n"
|
120 | 50 | fi
|
121 |
| -# if SCRIPT_PATH not defined, we can not call elapsed time |
122 |
| -if [[ -n "${SCRIPT_PATH}" ]] |
123 |
| -then |
124 |
| - checkSumEnd="$(date +%s )" |
125 |
| - elapsedTime $checkSumStart $checkSumEnd "${client} Elapsed Time computing checksums" |
126 |
| -fi |
127 | 51 | echo "[DEBUG] Producing checksums ended normally"
|
0 commit comments