diff --git a/cabal-tweak-dep-ver b/cabal-tweak-dep-ver index 525b786..9b15068 100755 --- a/cabal-tweak-dep-ver +++ b/cabal-tweak-dep-ver @@ -2,11 +2,15 @@ set -e +x +function fail { + echo "$0: $1" >&2 + exit 1 +} + USAGE="Usage: $0 dep old new" if [ $# -ne 3 ]; then - echo "$USAGE" - exit 1 + fail "$USAGE" fi DEP=$1 @@ -16,15 +20,13 @@ NEW=$3 CABALFILE=$(ls *.cabal) if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then - echo "There needs to be one .cabal file in the current dir!" - exit 1 + fail "There needs to be one .cabal file in the current dir!" fi BREAK=[^[:alnum:]-] if ! grep -q "$BREAK$DEP$BREAK[^,]*$OLD" $CABALFILE; then - echo "$CABALFILE does not match: $DEP $OLD" - exit 1 + fail "$CABALFILE does not match: $DEP $OLD" fi if [ ! -f $CABALFILE.orig ]; then diff --git a/cabal-tweak-drop-dep b/cabal-tweak-drop-dep index 04d95bc..4a12bfb 100755 --- a/cabal-tweak-drop-dep +++ b/cabal-tweak-drop-dep @@ -2,11 +2,15 @@ set -e +x +function fail { + echo "$0: $1" >&2 + exit 1 +} + USAGE="Usage: $0 dep" if [ $# -ne 1 ]; then - echo "$USAGE" - exit 1 + fail "$USAGE" fi DEP=$1 @@ -14,8 +18,7 @@ DEP=$1 CABALFILE=$(ls *.cabal) if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then - echo "There needs to be one .cabal file in the current dir!" - exit 1 + fail "There needs to be one .cabal file in the current dir!" fi if [ ! -f $CABALFILE.orig ]; then @@ -23,8 +26,7 @@ if [ ! -f $CABALFILE.orig ]; then fi if grep "$DEP" $CABALFILE | sed -e "s/$DEP//" | grep -q -e "[A-Za-z]"; then - echo "$0: deleting whole $DEP lines not safe - try more precise pattern" - exit 1 + fail "$0: deleting whole $DEP lines not safe - try more precise pattern" fi sed -i$BACKUP -e "/$DEP/d" $CABALFILE diff --git a/cabal-tweak-flag b/cabal-tweak-flag index 2bf3a42..d1b566b 100755 --- a/cabal-tweak-flag +++ b/cabal-tweak-flag @@ -5,11 +5,15 @@ set -e +x +function fail { + echo "$0: $1" >&2 + exit 1 +} + USAGE="Usage: $0 FLAG [True|False]" if [ $# -ne 2 ]; then - echo "$USAGE" - exit 1 + fail "$USAGE" fi FLAG=$1 @@ -24,23 +28,19 @@ esac CABALFILE=$(ls *.cabal) if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then - echo "There needs to be one .cabal file in the current dir!" - exit 1 + fail "There needs to be one .cabal file in the current dir!" fi if ! grep -q -i "^flag *$FLAG" $CABALFILE; then - echo "$CABALFILE does not have flag $FLAG" - exit 1 + fail "$CABALFILE does not have flag $FLAG" fi if ! grep -A3 -i "^flag *$FLAG" $CABALFILE | grep -q -i "default:"; then - echo "$CABALFILE: $FLAG flag might not have a default" - exit 1 + fail "$CABALFILE: $FLAG flag might not have a default" fi if ! grep -A3 -i "^flag *$FLAG" $CABALFILE | grep -q -i "default: *$OLD"; then - echo "$CABALFILE: $FLAG flag already defaults to $NEW" - exit 1 + fail "$CABALFILE: $FLAG flag already defaults to $NEW" fi if [ ! -f $CABALFILE.orig ]; then diff --git a/cabal-tweak-remove-upperbound b/cabal-tweak-remove-upperbound index abce557..1b5fc56 100755 --- a/cabal-tweak-remove-upperbound +++ b/cabal-tweak-remove-upperbound @@ -2,26 +2,28 @@ set -e +x +function fail { + echo "$0: $1" >&2 + exit 1 +} + USAGE="Usage: $0 dep" if [ $# -ne 1 ]; then - echo "$USAGE" - exit 1 + fail "$USAGE" fi DEP=$1 CABALFILE=$(ls *.cabal) if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then - echo "There needs to be one .cabal file in the current dir!" - exit 1 + fail "There needs to be one .cabal file in the current dir!" fi BREAK=[^[:alnum:]-] if ! grep -q "$BREAK$DEP$BREAK[^,]*" $CABALFILE; then - echo "$CABALFILE does not match: $DEP" - exit 1 + fail "$CABALFILE does not match: $DEP" fi if [ ! -f $CABALFILE.orig ]; then diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index 8c6b59b..4be8031 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -10,7 +10,7 @@ #%%global without_hscolour 1 Name: ghc-rpm-macros -Version: 2.0.9 +Version: 2.0.10 Release: 1%{?dist} Summary: RPM macros for building Haskell packages for GHC @@ -212,6 +212,9 @@ EOF %changelog +* Thu Jun 18 2020 Jens Petersen - 2.0.10-1 +- cabal-tweak script now output errors to stderr + * Thu Jun 4 2020 Jens Petersen - 2.0.9-1 - doc subpackages should own /usr/share/doc/ghc/, /usr/share/doc/ghc/html/, and /usr/share/doc/ghc/html/libraries/ (#1795526)