diff --git a/cblrepo.cabal b/cblrepo.cabal
--- a/cblrepo.cabal
+++ b/cblrepo.cabal
@@ -1,5 +1,5 @@
 name: cblrepo
-version: 0.9.3
+version: 0.10
 cabal-version: >= 1.6
 license: OtherLicense
 license-file: LICENSE-2.0
@@ -11,11 +11,12 @@
 synopsis: Tool to maintain a database of CABAL packages and their dependencies
 description:
     Helper tool for people maintaining a set of CABAL packages for their
-    distribution.  It maintains a database of packages and verifies
-    dependencies of the entire set as packages are added or updated.  It also
-    makes it trivial to track packages as new versions are released on Hackage.
+    distribution. It maintains a database of packages and verifies dependencies
+    of the entire set as packages are added or updated. It also makes it trivial
+    to track packages as new versions are released on Hackage.
 
-    It can also be used to build source packages for the ArchLinux distribution.
+    It can also be used to build source packages for the Arch Linux
+    distribution.
 category: Utils, Distribution
 build-type: Custom
 
@@ -30,7 +31,7 @@
         bytestring ==0.10.*, tar ==0.4.*, zlib ==0.5.*, mtl >=2.0 && <2.2,
         process ==1.1.*, Unixutils ==1.52.*, unix ==2.6.*,
         ansi-wl-pprint ==0.6.*, aeson ==0.6.* && >= 0.6.2,
-        optparse-applicative ==0.5.*
+        optparse-applicative ==0.7.*
 
 Source-Repository head
     Type:                 git
diff --git a/src/Main.hs b/src/Main.hs
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -69,7 +69,8 @@
     (fullDesc <> progDesc "update the index"))
 
 cmdVersionsOpts = CmdVersions
-    <$> arguments1 Just (metavar "PKGNAME ...")
+    <$> switch (short 'l' <> long "latest" <> help "list only the latest version of packages")
+    <*> arguments1 Just (metavar "PKGNAME ...")
 cmdVersionsCmd = command "versions" (info (helper <*> cmdVersionsOpts)
     (fullDesc <> progDesc "list available versions of packages"))
 
@@ -101,7 +102,7 @@
     <$> strOption (short 'i' <> long "indb" <> value "cblrepo.db" <> help "old database")
     <*> strOption (short 'o' <> long "outdb" <> value "new-cblrepo.db" <> help "new database")
 cmdConvertDbCmd = command "convertdb" (info (helper <*> cmdConvertDbOpts)
-    (fullDesc <> progDesc "convert and old database to the new format"))
+    (fullDesc <> progDesc "convert an old database to the new format"))
 
 cmdRemovePkgOpts = CmdRemovePkg
     <$> arguments1 Just (metavar "PKGNAME ...")
diff --git a/src/Sync.hs b/src/Sync.hs
--- a/src/Sync.hs
+++ b/src/Sync.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright 2011 Per Magnus Therning
+ - Copyright 2011-2013 Per Magnus Therning
  -
  - Licensed under the Apache License, Version 2.0 (the "License");
  - you may not use this file except in compliance with the License.
@@ -20,9 +20,8 @@
 
 import Control.Monad.Reader
 import System.FilePath
-import Control.Monad.Error
 
 sync :: Command ()
 sync = do
     aD <- cfgGet appDir
-    liftIO $ getFromURL "http://hackage.haskell.org/packages/index.tar.gz" (aD </> "00-index.tar.gz")
+    liftIO $ getFromURL indexUrl (aD </> indexFileName)
diff --git a/src/Updates.hs b/src/Updates.hs
--- a/src/Updates.hs
+++ b/src/Updates.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright 2011 Per Magnus Therning
+ - Copyright 2011-2013 Per Magnus Therning
  -
  - Licensed under the Apache License, Version 2.0 (the "License");
  - you may not use this file except in compliance with the License.
@@ -35,7 +35,7 @@
     aD <- cfgGet appDir
     aCS <- cfgGet $ idxStyle .optsCmd
     entries <- liftIO $ liftM (Tar.read . GZip.decompress)
-        (BS.readFile $ aD </> "00-index.tar.gz")
+        (BS.readFile $ aD </> indexFileName)
     let nonBasePkgs = filter (not . isBasePkg) db
     let pkgsNVers = map (\ p -> (pkgName p, pkgVersion p)) nonBasePkgs
     let availPkgs = catMaybes $ eMap extractPkgVer entries
diff --git a/src/Util/Misc.hs b/src/Util/Misc.hs
--- a/src/Util/Misc.hs
+++ b/src/Util/Misc.hs
@@ -66,6 +66,9 @@
 ghcVersion = (Version [7, 6, 3] [])
 ghcVersionDep = "ghc=" ++ display ghcVersion ++ "-1"
 
+indexUrl = "http://hackage.haskell.org/packages/index.tar.gz"
+indexFileName = "index.tar.gz"
+
 -- {{{1 command line argument type
 
 data Cmds
@@ -76,7 +79,7 @@
     | CmdBuildPkgs { pkgs :: [String] }
     | CmdBumpPkgs { inclusive :: Bool, pkgs :: [String] }
     | CmdSync { unused :: Bool }
-    | CmdVersions { pkgs :: [String] }
+    | CmdVersions { latest :: Bool, pkgs :: [String] }
     | CmdListPkgs
         { listGhc :: Bool, listDistro :: Bool, noListRepo :: Bool
         , hackageFmt :: Bool }
@@ -96,7 +99,7 @@
 
 strPairArg s = let
         (s0, s1) = break (== ',') s
-    in return (s0, tail s1)
+    in if null s1 then error "Missing version" else return (s0, tail s1)
 strTripleArg s = let
         (s0, r1) = break (== ',') s
         (s1, r2) = break (== ',') (tail r1)
@@ -106,7 +109,7 @@
 
 -- {{{1 getFromURL
 getFromURL url fn = do
-    (ec, _, er) <- readProcessWithExitCode "curl" ["-f", "-o", fn, url] ""
+    (ec, _, er) <- readProcessWithExitCode "curl" ["-f", "-L", "-o", fn, url] ""
     case ec of
         ExitSuccess -> return ()
         ExitFailure _ -> do
@@ -166,9 +169,9 @@
                         _ -> Nothing
 
             in do
-                fp <- liftIO $ getAppUserDataDirectory "cblrepo"
+                aD <- liftIO $ getAppUserDataDirectory "cblrepo"
                 es <- liftM (Tar.read . GZip.decompress)
-                    (liftIO $ BS.readFile $ fp </> "00-index.tar.gz")
+                    (liftIO $ BS.readFile $ aD </> indexFileName)
                 e <- maybe (throwError $ "No entry for " ++ pkgStr)
                     return
                     (esFindEntry path es)
diff --git a/src/Util/Translation.hs b/src/Util/Translation.hs
--- a/src/Util/Translation.hs
+++ b/src/Util/Translation.hs
@@ -173,18 +173,18 @@
             where
                 libBuildFunction = text "build() {" <>
                     nest 4 (empty <$>
-                        text "cd ${srcdir}/${_hkgname}-${pkgver}" <$>
+                        text "cd \"${srcdir}/${_hkgname}-${pkgver}\"" <$>
                         maybe empty (\ _ ->
-                            text $ "patch " ++ shVarValue hkgName ++ ".cabal ${srcdir}/cabal.patch ")
+                            text $ "patch " ++ shVarValue hkgName ++ ".cabal \"${srcdir}/cabal.patch\" ")
                             cabalPatchFile <$>
                         maybe empty (\ _ ->
-                            text $ "patch -p4 < ${srcdir}/source.patch")
+                            text $ "patch -p4 < \"${srcdir}/source.patch\"")
                             buildPatchFile <$>
                         nest 4 (text "runhaskell Setup configure -O -p --enable-split-objs --enable-shared \\" <$>
-                            text "--prefix=/usr --docdir=/usr/share/doc/${pkgname} \\" <$>
+                            text "--prefix=/usr --docdir=\"/usr/share/doc/${pkgname}\" \\" <$>
                             text "--libsubdir=\\$compiler/site-local/\\$pkgid" <> confFlags) <$>
                         text "runhaskell Setup build" <$>
-                        text "runhaskell Setup haddock" <$>
+                        text "runhaskell Setup haddock --hoogle --html" <$>
                         text "runhaskell Setup register --gen-script" <$>
                         text "runhaskell Setup unregister --gen-script" <$>
                         text "sed -i -r -e \"s|ghc-pkg.*unregister[^ ]* |&'--force' |\" unregister.sh"
@@ -192,14 +192,14 @@
                     char '}'
 
                 exeBuildFunction = text "build() {" <>
-                    nest 4 (empty <$> text "cd ${srcdir}/${_hkgname}-${pkgver}" <$>
+                    nest 4 (empty <$> text "cd \"${srcdir}/${_hkgname}-${pkgver}\"" <$>
                         maybe empty
-                            (\ _ -> text $ "patch " ++ shVarValue hkgName ++ ".cabal ${srcdir}/cabal.patch ")
+                            (\ _ -> text $ "patch " ++ shVarValue hkgName ++ ".cabal \"${srcdir}/cabal.patch\" ")
                             cabalPatchFile <$>
                         maybe empty (\ _ ->
-                            text $ "patch -p4 < ${srcdir}/source.patch")
+                            text $ "patch -p4 < \"${srcdir}/source.patch\"")
                             buildPatchFile <$>
-                        text "runhaskell Setup configure -O --prefix=/usr --docdir=/usr/share/doc/${pkgname}" <> confFlags <$>
+                        text "runhaskell Setup configure -O --prefix=/usr --docdir=\"/usr/share/doc/${pkgname}\"" <> confFlags <$>
                         text "runhaskell Setup build"
                         ) <$>
                     char '}'
@@ -211,20 +211,20 @@
 
                 libPackageFunction = text "package() {" <>
                     nest 4 (empty <$>
-                        text "cd ${srcdir}/${_hkgname}-${pkgver}" <$>
-                        text "install -D -m744 register.sh   ${pkgdir}/usr/share/haskell/${pkgname}/register.sh" <$>
-                        text "install    -m744 unregister.sh ${pkgdir}/usr/share/haskell/${pkgname}/unregister.sh" <$>
-                        text "install -d -m755 ${pkgdir}/usr/share/doc/ghc/html/libraries" <$>
-                        text "ln -s /usr/share/doc/${pkgname}/html ${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}" <$>
-                        text "runhaskell Setup copy --destdir=${pkgdir}" <$>
-                        (maybe empty (\ _ -> text "install -D -m644 ${_licensefile} ${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" <$>
-                            text "rm -f ${pkgdir}/usr/share/doc/${pkgname}/${_licensefile}") licenseFile)
+                        text "cd \"${srcdir}/${_hkgname}-${pkgver}\"" <$>
+                        text "install -D -m744 register.sh   \"${pkgdir}/usr/share/haskell/${pkgname}/register.sh\"" <$>
+                        text "install    -m744 unregister.sh \"${pkgdir}/usr/share/haskell/${pkgname}/unregister.sh\"" <$>
+                        text "install -d -m755 \"${pkgdir}/usr/share/doc/ghc/html/libraries\"" <$>
+                        text "ln -s \"/usr/share/doc/${pkgname}/html\" \"${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}\"" <$>
+                        text "runhaskell Setup copy --destdir=\"${pkgdir}\"" <$>
+                        (maybe empty (\ _ -> text "install -D -m644 \"${_licensefile}\" \"${pkgdir}/usr/share/licenses/${pkgname}/LICENSE\"" <$>
+                            text "rm -f \"${pkgdir}/usr/share/doc/${pkgname}/${_licensefile}\"") licenseFile)
                         ) <$>
                     char '}'
 
                 exePackageFunction = text "package() {" <>
-                    nest 4 (empty <$> text "cd ${srcdir}/${_hkgname}-${pkgver}" <$>
-                        text "runhaskell Setup copy --destdir=${pkgdir}"
+                    nest 4 (empty <$> text "cd \"${srcdir}/${_hkgname}-${pkgver}\"" <$>
+                        text "runhaskell Setup copy --destdir=\"${pkgdir}\""
                         ) <$>
                     char '}'
 
diff --git a/src/Versions.hs b/src/Versions.hs
--- a/src/Versions.hs
+++ b/src/Versions.hs
@@ -1,5 +1,5 @@
 {-
- - Copyright 2011 Per Magnus Therning
+ - Copyright 2011-2013 Per Magnus Therning
  -
  - Licensed under the Apache License, Version 2.0 (the "License");
  - you may not use this file except in compliance with the License.
@@ -32,10 +32,12 @@
 versions :: Command ()
 versions = do
     aD <- cfgGet appDir
+    l <- cfgGet $ latest . optsCmd
     pkgs <- cfgGet $ pkgs . optsCmd
+    let printFunc = if l then printLatestVersion else printAllVersions
     liftIO $ do
-        es <- liftM (Tar.read . GZip.decompress) (BS.readFile $ aD </> "00-index.tar.gz")
-        mapM_ (printVersions . findVersions es) pkgs
+        es <- liftM (Tar.read . GZip.decompress) (BS.readFile $ aD </> indexFileName)
+        mapM_ (printFunc . findVersions es) pkgs
 
 findVersions es p = (p, findV p es [])
     where
@@ -51,6 +53,10 @@
                 vs = map (fromJust . simpleParse) acc
             in map display $ sort vs
 
-printVersions (p, vs) = do
+printAllVersions (p, vs) = do
     putStr $ p ++ " : "
     putStrLn $ unwords vs
+
+printLatestVersion (p, vs) = do
+    putStr $ p ++ ","
+    putStrLn $ last vs
