Commit 3c545f6e authored by ijones's avatar ijones
Browse files

added rm for installed-pkg-config and .setup-config in clean rule.

also changed installed-pkg-config to a dotfile.
parent 0696e4db
......@@ -59,8 +59,8 @@ import qualified Distribution.Simple.Build as D.S.B (hunitTests)
import qualified Distribution.Simple.SrcDist as D.S.S (hunitTests)
import qualified Distribution.Simple.Utils as D.S.U (hunitTests)
import Distribution.Simple.Utils(pathJoin)
import qualified Distribution.Simple.Configure as D.S.C (hunitTests)
import qualified Distribution.Simple.Register as D.S.R (hunitTests)
import qualified Distribution.Simple.Configure as D.S.C (hunitTests, localBuildInfoFile)
import qualified Distribution.Simple.Register as D.S.R (hunitTests, installedPkgConfigFile)
import qualified Distribution.Simple.GHCPackageConfig as GHC (localPackageConfig)
......@@ -115,6 +115,10 @@ tests = [TestLabel "testing the HUnit package" $ TestCase $
system $ "ghc-pkg --config-file=" ++ pkgConf ++ " -r HUnit"
system "make clean"
system "make"
system $ "touch " ++ D.S.C.localBuildInfoFile
system $ "touch " ++ D.S.R.installedPkgConfigFile
doesFileExist D.S.C.localBuildInfoFile >>=
assertBool ("touch " ++ D.S.C.localBuildInfoFile ++ " failed")
assertCmd "./setup configure --prefix=\",tmp\"" "hunit configure"
-- Test clean:
assertCmd "./setup build" "hunit build"
......@@ -123,7 +127,12 @@ tests = [TestLabel "testing the HUnit package" $ TestCase $
assertCmd "./setup clean" "hunit clean"
doesDirectoryExist "dist/build" >>=
assertEqual "HUnit clean did not get rid of build directory" False
doesFileExist D.S.C.localBuildInfoFile >>=
assertEqual ("clean " ++ D.S.C.localBuildInfoFile ++ " failed") False
doesFileExist D.S.R.installedPkgConfigFile >>=
assertEqual ("clean " ++ D.S.R.installedPkgConfigFile ++ " failed") False
assertCmd "./setup configure --prefix=\",tmp\"" "hunit configure"
assertCmd "./setup build" "hunit build"
assertCmd "./setup install --user" "hunit install"
assertCmd ("ghc -package-conf " ++ pkgConf ++ " -package HUnit HUnitTester.hs -o ./hunitTest") "compile w/ hunit"
......
......@@ -59,10 +59,10 @@ import Distribution.Setup(parseArgs, Action(..), optionHelpString)
import Distribution.Simple.Build ( build )
import Distribution.Simple.SrcDist ( sdist )
import Distribution.Simple.Register ( register, unregister )
import Distribution.Simple.Register ( register, unregister, installedPkgConfigFile )
import Distribution.Simple.Configure(LocalBuildInfo(..), getPersistBuildConfig,
configure, writePersistBuildConfig)
configure, writePersistBuildConfig, localBuildInfoFile)
import Distribution.Simple.Install(install)
import Distribution.Simple.Utils (die, pathJoin, removeFileRecursive)
import Distribution.Misc (License(..), Extension(..), Dependency(..))
......@@ -72,7 +72,9 @@ import Distribution.Version (Version(..), VersionRange(..),
-- Base
import System(getArgs)
import System.Directory(removeFile)
import Control.Exception(try)
import Control.Monad(when)
import Data.Maybe(isNothing)
import Data.List ( intersperse )
......@@ -117,7 +119,10 @@ defaultMainNoRead pkg_descr
Right (CleanCmd, extra_flags) -> do
no_extra_flags extra_flags
removeFileRecursive buildPref
try $ removeFileRecursive buildPref
try $ removeFile installedPkgConfigFile
try $ removeFile localBuildInfoFile
return ()
Right (InstallCmd install_prefixM userInst, extra_flags) -> do
no_extra_flags extra_flags
......
......@@ -46,7 +46,8 @@ module Distribution.Simple.Configure (writePersistBuildConfig,
getPersistBuildConfig,
LocalBuildInfo(..),
configure,
hunitTests
hunitTests,
localBuildInfoFile
)
where
......
......@@ -45,6 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -}
module Distribution.Simple.Register (
register,
unregister,
installedPkgConfigFile,
#ifdef DEBUG
hunitTests
#endif
......@@ -84,7 +85,7 @@ register pkg_descr lbi userInst = do
_ -> die ("only registering with GHC is implemented")
installedPkgConfigFile :: String
installedPkgConfigFile = "installed-pkg-config"
installedPkgConfigFile = ".installed-pkg-config"
-- -----------------------------------------------------------------------------
-- Unregistration
......
......@@ -5,8 +5,8 @@
- constructorless data-types
** grep for "FIX"
** does clean remove installed-pkg-config and .setup-config or
whatever? should the former be a . file? should it be removed
after successful register?
whatever?
** should .installed-pkg-config be removed after successful register?
** Clean up field parsers (Martin: what else goes here?)
*** license parser parses either known strings, or a filename.
** add "clean" to doc?
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment