[ghc-rpm-macros] simplify cabal-tweak-flag script to take one flag value

Jens Petersen petersen at fedoraproject.org
Tue Jan 22 03:22:37 UTC 2013


commit 11c364e456698fc8186958b9d2745b1059daa648
Author: Jens Petersen <petersen at redhat.com>
Date:   Tue Jan 22 12:22:28 2013 +0900

    simplify cabal-tweak-flag script to take one flag value

 cabal-tweak-flag    |   18 +++++++++---------
 ghc-rpm-macros.spec |    5 ++++-
 2 files changed, 13 insertions(+), 10 deletions(-)
---
diff --git a/cabal-tweak-flag b/cabal-tweak-flag
index 0d54d53..2db3a72 100755
--- a/cabal-tweak-flag
+++ b/cabal-tweak-flag
@@ -1,25 +1,25 @@
 #!/bin/sh
 
 # TODO:
-# support "$0 FLAG NEW" when no upstream default
+# support setting flag when no upstream default
 
 set -e +x
 
-USAGE="Usage: $0 FLAG OLD NEW"
+USAGE="Usage: $0 FLAG [True|False]"
 
-if [ $# -ne 3 ]; then
+if [ $# -ne 2 ]; then
     echo "$USAGE"
     exit 1
 fi
 
 FLAG=$1
-OLD=$2
-NEW=$3
 
-if [ "$OLD" = "$NEW" ]; then
-  echo "Old and new value can't be the same!"
-  exit 1
-fi
+NEW=$2
+case $NEW in
+    True) OLD=False ;;
+    False) OLD=True ;;
+    *) echo "Flag value can only be set to True or False" ; exit 1 ;;
+esac
 
 CABALFILE=$(ls *.cabal)
 
diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec
index b9a5bd0..67b9fed 100644
--- a/ghc-rpm-macros.spec
+++ b/ghc-rpm-macros.spec
@@ -6,7 +6,7 @@
 #%%global without_hscolour 1
 
 Name:           ghc-rpm-macros
-Version:        0.98
+Version:        0.98.1
 Release:        1%{?dist}
 Summary:        Macros for building packages for GHC
 
@@ -75,6 +75,9 @@ EOF
 
 
 %changelog
+* Tue Jan 22 2013 Jens Petersen <petersen at redhat.com> - 0.98.1-1
+- simplify cabal-tweak-flag script to take one flag value
+
 * Mon Jan 21 2013 Jens Petersen <petersen at redhat.com> - 0.98-1
 - new ghc_fix_dynamic_rpath macro for cleaning up package executables
   linked against their own libraries


More information about the scm-commits mailing list