summaryrefslogtreecommitdiff
path: root/src/wrapper.hs
diff options
context:
space:
mode:
authorJoey Hess2014-08-19 15:02:12 -0400
committerJoey Hess2014-08-19 15:02:12 -0400
commit7d59dee4690297154f6924a04949413ddea8a17b (patch)
tree988d0a3e67a0164b2f39ab22683a089f8b6eef95 /src/wrapper.hs
parentb6c5f547419ce95d20453f30403e1a5860720fe6 (diff)
local repo fully working now
Diffstat (limited to 'src/wrapper.hs')
-rw-r--r--src/wrapper.hs25
1 files changed, 5 insertions, 20 deletions
diff --git a/src/wrapper.hs b/src/wrapper.hs
index 694067df..4c3f8074 100644
--- a/src/wrapper.hs
+++ b/src/wrapper.hs
@@ -29,7 +29,7 @@ import System.Exit
import System.Posix.Directory
localrepo :: FilePath
-localrepo = "/usr/src/propellor"
+localrepo = "/usr/src/propellor/propellor.git"
-- Using the github mirror of the main propellor repo because
-- it is accessible over https for better security.
@@ -56,28 +56,13 @@ wrapper args propellordir propellorbin = do
makeRepo = do
putStrLn $ "Setting up your propellor repo in " ++ propellordir
putStrLn ""
- ifM (doesDirectoryExist localrepo)
- ( do
- void $ boolSystem "git" [Param "clone", File localrepo, File propellordir]
- setuprepo True localrepo
+ ifM (doesFileExist localrepo <||> doesDirectoryExist localrepo)
+ ( void $ boolSystem "git" [Param "clone", File localrepo, File propellordir]
, do
void $ boolSystem "git" [Param "clone", Param netrepo, File propellordir]
- setuprepo False netrepo
+ whenM (doesDirectoryExist (propellordir </> "privdata")) $
+ mapM_ nukeFile =<< dirContents (propellordir </> "privdata")
)
- setuprepo fromlocalrepo repolocation = do
- changeWorkingDirectory propellordir
- whenM (doesDirectoryExist "privdata") $
- mapM_ nukeFile =<< dirContents "privdata"
- void $ boolSystem "git" [Param "remote", Param "rm", Param "origin"]
- void $ boolSystem "git" [Param "remote", Param "add", Param "upstream", Param repolocation]
- -- Connect synthetic git repo with upstream history so
- -- merging with upstream will work going forward.
- -- Note -s ours is used to avoid getting any divergent
- -- changes from upstream.
- when (not fromlocalrepo) $ do
- void $ boolSystem "git" [Param "fetch", Param "upstream"]
- version <- readProcess "dpkg-query" ["--showformat", "${Version}", "--show", "propellor"]
- void $ boolSystem "git" [Param "merge", Param "-s", Param "ours", Param version]
buildruncfg = do
changeWorkingDirectory propellordir
ifM (boolSystem "make" [Param "build"])