darcsDist :: String -> [String] -> C String
darcsDist dn tocopy = withRootdir $
    do v <- getVersion
       let distname = dn++"-"++v
           tarname = distname++".tar.gz"
       rule [phony "sdist",tarname] [] $
                    do putS $ "making tarball as "++tarname
                       rm_rf distname
                       system "darcs" ["get","-t",v,".",distname]
                       c <- nubs `fmap` getExtra "to-clean"
                       dc <- nubs `fmap` getExtra "to-distclean"
                       withDirectory distname $
                         do setExecutable "Setup.hs" `catchC` \_ -> return ()
                            let wanted = (".releaseVersion":".latestRelease":
                                          ".lastTag":".lastTagPatchLevel":
                                          ".releaseVersionPatchLevel":
                                          ".latestReleasePatchLevel":tocopy)
                            system "./Setup.hs" wanted
                            mapM_ rm_rf $
                                      ("_darcs":".arcs-prefs":c++dc) \\ wanted
                       system "tar" ["zcf",tarname,distname]
                       rm_rf distname
       return tarname
darcsDist :: String -> [String] -> C String
darcsDist dn tocopy = withRootdir $
    do v <- getVersion
       let distname = dn++"-"++v
           tarname = distname++".tar.gz"
       rule [phony "sdist",tarname] [] $
                    do putS $ "making tarball as "++tarname
                       rm_rf distname
                       system "darcs" ["get","-t",v,".",distname]
                       c <- nubs `fmap` getExtra "to-clean"
                       dc <- nubs `fmap` getExtra "to-distclean"
                       withDirectory distname $
                         do setExecutable "Setup.hs" `catchC` \_ -> return ()
                            let wanted = (".releaseVersion":".latestRelease":
                                          ".lastTag":".lastTagPatchLevel":
                                          ".releaseVersionPatchLevel":
                                          ".latestReleasePatchLevel":tocopy)
                            system "./Setup.hs" wanted
                            mapM_ rm_rf $
                                      ("_darcs":".arcs-prefs":c++dc) \\ wanted
                       system "tar" ["zcf",tarname,distname]
                       rm_rf distname
       return tarname
darcsDist dn tocopy = withRootdir $
    do v <- getVersion
       let distname = dn++"-"++v
           tarname = distname++".tar.gz"
       rule [phony "sdist",tarname] [] $
                    do putS $ "making tarball as "++tarname
                       rm_rf distname
                       system "darcs" ["get","-t",v,".",distname]
                       c <- nubs `fmap` getExtra "to-clean"
                       dc <- nubs `fmap` getExtra "to-distclean"
                       withDirectory distname $
                         do setExecutable "Setup.hs" `catchC` \_ -> return ()
                            let wanted = (".releaseVersion":".latestRelease":
                                          ".lastTag":".lastTagPatchLevel":
                                          ".releaseVersionPatchLevel":
                                          ".latestReleasePatchLevel":tocopy)
                            system "./Setup.hs" wanted
                            mapM_ rm_rf $
                                      ("_darcs":".arcs-prefs":c++dc) \\ wanted
                       system "tar" ["zcf",tarname,distname]
                       rm_rf distname
       return tarname