7b45c3d854
The content of this branch was automatically imported from Fedora ELN with the following as its source: https://src.fedoraproject.org/rpms/ghc-rpm-macros#78bda0dce526795284ef1644e7d0dd6e0b3511dc
33 lines
538 B
Bash
Executable File
33 lines
538 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e +x
|
|
|
|
function fail {
|
|
echo "$0: $1" >&2
|
|
exit 1
|
|
}
|
|
|
|
USAGE="Usage: $0 dep"
|
|
|
|
if [ $# -ne 1 ]; then
|
|
fail "$USAGE"
|
|
fi
|
|
|
|
DEP=$1
|
|
|
|
CABALFILE=$(ls *.cabal)
|
|
|
|
if [ $(echo $CABALFILE | wc -w) -ne 1 ]; then
|
|
fail "There needs to be one .cabal file in the current dir!"
|
|
fi
|
|
|
|
if [ ! -f $CABALFILE.orig ]; then
|
|
BACKUP=.orig
|
|
fi
|
|
|
|
if grep "$DEP" $CABALFILE | sed -e "s/$DEP//" | grep -q -e "[A-Za-z]"; then
|
|
fail "$0: deleting whole $DEP lines not safe - try more precise pattern"
|
|
fi
|
|
|
|
sed -i$BACKUP -e "/$DEP/d" $CABALFILE
|