tools: make uninstall, reduces noise when testing

Tries to unregister all three hledger packages from the user's package
db (not cabal sandbox aware).
This commit is contained in:
Simon Michael 2014-10-18 10:19:00 -07:00
parent 33499a9957
commit 4ec9bc4c53

View File

@ -26,6 +26,7 @@ PRINT=lpr
GHC=ghc
GHCI=ghci
GHCPKG=ghc-pkg
HADDOCK=haddock
CABAL=cabal
CABALINSTALL=cabal install -w $(GHC)
@ -198,6 +199,14 @@ installdeps:
installdeps-force:
$(CABALINSTALL) $(patsubst %,./%,$(PACKAGES)) $(EXTRAINSTALLARGS) --enable-tests --only-dependencies --allow-newer --force-reinstalls
# unregister all packages, assuming they are defined lowest-dependency first
# avoids some reinstall noise when repeatedly doing make install
uninstall:
-for p in $(call reverse,$(PACKAGES)); do $(GHCPKG) unregister $$p; done
# utility function
reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))
# run a cabal command in all hledger package dirs
allcabal%:
for p in $(PACKAGES); do (echo doing cabal $* in $$p; cd $$p; cabal $*; echo); done