summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-02-10 14:52:54 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-02-10 14:52:54 -0400
commit516d4899d3ea7e12ee9b408160b36190b8c2d3f2 (patch)
treead34ef74d632b07a20b6dec6850d5b9e4a14b289
parent9b7a1ea41832f30e4d2f707a02df34ccedfcb69f (diff)
Now uses the Haskell uuid library, rather than needing a uuid program.
Been meaning to do this for some time; Android port was last straw. Note that newer versions of the uuid library have a Data.UUID.V4 that generates random UUIDs slightly more cleanly, but Debian has an old version of the library, so I do it slightly round-about.
-rw-r--r--Annex/UUID.hs15
-rw-r--r--Build/Configure.hs1
-rw-r--r--Build/Standalone.hs1
-rw-r--r--debian/changelog6
-rw-r--r--debian/control1
-rw-r--r--doc/install/fromscratch.mdwn3
-rw-r--r--git-annex.cabal2
7 files changed, 15 insertions, 14 deletions
diff --git a/Annex/UUID.hs b/Annex/UUID.hs
index b20d94125..c36861bbe 100644
--- a/Annex/UUID.hs
+++ b/Annex/UUID.hs
@@ -6,7 +6,7 @@
- UUIDs of remotes are cached in git config, using keys named
- remote.<name>.annex-uuid
-
- - Copyright 2010-2011 Joey Hess <joey@kitenet.net>
+ - Copyright 2010-2013 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
@@ -24,20 +24,17 @@ module Annex.UUID (
import Common.Annex
import qualified Git
import qualified Git.Config
-import qualified Build.SysConfig as SysConfig
import Config
+import qualified Data.UUID as U
+import System.Random
+
configkey :: ConfigKey
configkey = annexConfig "uuid"
-{- Generates a UUID. There is a library for this, but it's not packaged,
- - so use the command line tool. -}
+{- Generates a random UUID, that does not include the MAC address. -}
genUUID :: IO UUID
-genUUID = gen . lines <$> readProcess command params
- where
- gen [] = error $ "no output from " ++ command
- gen (l:_) = toUUID l
- (command:params) = words SysConfig.uuid
+genUUID = UUID . show <$> (randomIO :: IO U.UUID)
{- Get current repository's UUID. -}
getUUID :: Annex UUID
diff --git a/Build/Configure.hs b/Build/Configure.hs
index 491a74461..6e12d19af 100644
--- a/Build/Configure.hs
+++ b/Build/Configure.hs
@@ -19,7 +19,6 @@ tests =
, testCp "cp_a" "-a"
, testCp "cp_p" "-p"
, testCp "cp_reflink_auto" "--reflink=auto"
- , TestCase "uuid generator" $ selectCmd "uuid" [("uuid -m", ""), ("uuid", ""), ("uuidgen", "")]
, TestCase "xargs -0" $ requireCmd "xargs_0" "xargs -0 </dev/null"
, TestCase "rsync" $ requireCmd "rsync" "rsync --version >/dev/null"
, TestCase "curl" $ testCmd "curl" "curl --version >/dev/null"
diff --git a/Build/Standalone.hs b/Build/Standalone.hs
index cf0abbc13..76ff7b25c 100644
--- a/Build/Standalone.hs
+++ b/Build/Standalone.hs
@@ -39,7 +39,6 @@ thirdpartyProgs = catMaybes
, Just "rsync"
, Just "ssh"
, Just "sh"
- , headMaybe $ words SysConfig.uuid -- may include parameters
, ifset SysConfig.curl "curl"
, ifset SysConfig.wget "wget"
, ifset SysConfig.bup "bup"
diff --git a/debian/changelog b/debian/changelog
index 4422ea8bc..03236a69a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+git-annex (3.20130208) UNRELEASED; urgency=low
+
+ * Now uses the Haskell uuid library, rather than needing a uuid program.
+
+ -- Joey Hess <joeyh@debian.org> Sun, 10 Feb 2013 14:52:01 -0400
+
git-annex (3.20130207) unstable; urgency=low
* webapp: Now allows restarting any threads that crash.
diff --git a/debian/control b/debian/control
index 2610ca53b..cdfbd06c1 100644
--- a/debian/control
+++ b/debian/control
@@ -17,6 +17,7 @@ Build-Depends:
libghc-quickcheck2-dev,
libghc-monad-control-dev (>= 0.3),
libghc-lifted-base-dev,
+ libghc-uuid-dev,
libghc-json-dev,
libghc-ifelse-dev,
libghc-bloomfilter-dev,
diff --git a/doc/install/fromscratch.mdwn b/doc/install/fromscratch.mdwn
index 8fdb8dcda..bde5b9a89 100644
--- a/doc/install/fromscratch.mdwn
+++ b/doc/install/fromscratch.mdwn
@@ -20,6 +20,7 @@ quite a lot.
* [hS3](http://hackage.haskell.org/package/hS3) (optional)
* [DAV](http://hackage.haskell.org/package/DAV) (optional)
* [SafeSemaphore](http://hackage.haskell.org/package/SafeSemaphore)
+ * [UUID](http://hackage.haskell.org/package/uuid)
* Optional haskell stuff, used by the [[assistant]] and its webapp (edit Makefile to disable)
* [stm](http://hackage.haskell.org/package/stm)
(version 2.3 or newer)
@@ -48,8 +49,6 @@ quite a lot.
* [async](http://hackage.haskell.org/package/async)
* Shell commands
* [git](http://git-scm.com/)
- * [uuid](http://www.ossp.org/pkg/lib/uuid/)
- (or `uuidgen` from util-linux)
* [xargs](http://savannah.gnu.org/projects/findutils/)
* [rsync](http://rsync.samba.org/)
* [curl](http://http://curl.haxx.se/) (optional, but recommended)
diff --git a/git-annex.cabal b/git-annex.cabal
index 24fc251ee..f9c0065c6 100644
--- a/git-annex.cabal
+++ b/git-annex.cabal
@@ -60,7 +60,7 @@ Executable git-annex
pcre-light, extensible-exceptions, dataenc, SHA, process, json,
base (>= 4.5 && < 4.8), monad-control, transformers-base, lifted-base,
IfElse, text, QuickCheck >= 2.1, bloomfilter, edit-distance, process,
- SafeSemaphore
+ SafeSemaphore, UUID
-- Need to list these because they're generated from .hsc files.
Other-Modules: Utility.Touch Utility.Mounts
Include-Dirs: Utility