From 842e04b13ca07be4a997ecd52f63b94743fa83b8 Mon Sep 17 00:00:00 2001 From: Thien-Thi Nguyen Date: Wed, 11 May 2022 04:27:50 -0400 Subject: [PATCH] refactor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (domake, ensure): New funcs. : Use ‘domake’, ‘ensure’. --- contrib/gana-update.sh | 54 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/contrib/gana-update.sh b/contrib/gana-update.sh index 8fcf18852..db122b9a3 100755 --- a/contrib/gana-update.sh +++ b/contrib/gana-update.sh @@ -3,32 +3,32 @@ # Run from exchange/ main directory. set -eu -# Generate taler-error-codes.h in gana and copy it to -# src/include/taler_error_codes.h -cd contrib/gana/gnu-taler-error-codes -make -cd ../../.. -for n in taler_error_codes.c -do - if ! diff contrib/gana/gnu-taler-error-codes/${n} src/util/${n} > /dev/null +domake () +{ + # $1 -- dir under contrib/gana/ + dir="contrib/gana/$1" + + make -C $dir +} + +ensure () +{ + # $1 -- filename + # $2 -- src dir under contrib/gana/ + # $3 -- dst dir under ./ + fn="$1" + src="contrib/gana/$2" + dst="./$3" + + if ! diff $src/$fn $dst/$fn > /dev/null then - cp contrib/gana/gnu-taler-error-codes/$n src/util/$n + cp $src/$fn $dst/$fn fi -done -for n in taler_error_codes.h -do - if ! diff contrib/gana/gnu-taler-error-codes/${n} src/include/${n} > /dev/null - then - cp contrib/gana/gnu-taler-error-codes/$n src/include/$n - fi -done -cd contrib/gana/gnu-taler-db-events -make -cd ../../.. -for n in taler_dbevents.h -do - if ! diff contrib/gana/gnu-taler-db-events/${n} src/include/${n} > /dev/null - then - cp contrib/gana/gnu-taler-db-events/$n src/include/$n - fi -done +} + +domake gnu-taler-error-codes +ensure taler_error_codes.c gnu-taler-error-codes src/util +ensure taler_error_codes.h gnu-taler-error-codes src/include + +domake gnu-taler-db-events +ensure taler_dbevents.h gnu-taler-db-events src/include