hg-buildpackage 1.0.1 → 1.0.4
raw patch · 4 files changed
+37/−26 lines, 4 filesdep +directorydep ~MissingH
Dependencies added: directory
Dependency ranges changed: MissingH
Files
- hg-buildpackage.cabal +3/−3
- hg-buildpackage.hs +1/−1
- hg-importdsc.hs +19/−15
- hg-importorig.hs +14/−7
hg-buildpackage.cabal view
@@ -1,5 +1,5 @@ Name: hg-buildpackage-Version: 1.0.1+Version: 1.0.4 License: GPL license-file: COPYRIGHT extra-source-files: COPYING@@ -9,8 +9,8 @@ Synopsis: Tools to help manage Debian packages with Mercurial Stability: Alpha Copyright: Copyright (c) 2003 - 2007 John Goerzen-Build-Depends: base, network, unix, parsec, MissingH>=0.18.0,- regex-compat, regex-posix, hslogger, HSH>=1.2.0+Build-Depends: base, network, unix, parsec, MissingH>=1.0.0,+ regex-compat, regex-posix, hslogger, HSH>=1.2.0, directory Executable: hg-importorig Extensions: ExistentialQuantification, OverlappingInstances,
hg-buildpackage.hs view
@@ -39,7 +39,7 @@ else do putStrLn $ "Building " ++ tgzname ++ " from Mercurial history" runIO $ ("hg", ["archive", "-r", tag2upsstr tag, "-t", "tgz",- "-X", ".hg_archival.txt", "-X", ".hgtagz",+ "-X", ".hg_archival.txt", "-X", ".hgtags", tgzname]) where tgzname = printf "../%s_%s.orig.tar.gz" (tag2pkg tag) (tag2upsver tag) origdirname = printf "../%s-%s.orig" (tag2pkg tag) (tag2upsver tag)
hg-importdsc.hs view
@@ -11,9 +11,8 @@ import Types import System.Posix.Env -args = [Option ['v'] ["verbose"] (NoArg "v") "Enable verbose mode"] helpinfo = "Usage:\n\-\hg-importdsc [-v] dscname\n\+\hg-importdsc [-v] [-s n] dscname\n\ \\n\ \The source package will be imported into ../${package}.upstream (if it has\n\ \an upstream component) and the current working directory\n\@@ -22,11 +21,11 @@ \\n\ \ dscname is the name of a dsc file to import\n" -crashusage = die 5 $ usageInfo helpinfo args+crashusage = die 5 $ usageInfo helpinfo importargs main = - do (args, files) <- parseCmdLine RequireOrder args helpinfo- let isverbose = ("v" `elem` args)+ do (args, files) <- parseCmdLine RequireOrder importargs helpinfo+ let isverbose = (Verbose `elem` args) when isverbose setverbose let verbargs = if isverbose then ["-v"] else [] (dscname) <- case files of@@ -48,7 +47,7 @@ version) hasupstream <- dschasupstream dscname- when hasupstream (procupstream verbargs dscname tag)+ when hasupstream (procupstream args verbargs dscname tag) putStrLn $ " *** Processing Debian source tree for " ++ dscname @@ -59,9 +58,10 @@ when hasupstream (pullupstream dscname tag) - brackettmpdir "../,,hg-importdsc-XXXXXX" (procdsc verbargs dscname tag)+ brackettmpdir "../,,hg-importdsc-XXXXXX" + (procdsc args verbargs dscname tag) -procupstream verbargs dscname tag =+procupstream args verbargs dscname tag = do upstreamrepo <- readlinkabs (printf "../%s.upstream" (tag2pkg tag)) assertvalidhg upstreamrepo v $ "Upstream detected at " ++ upstreamrepo@@ -70,14 +70,14 @@ let upstreamfn = dirname dscname ++ "/" ++ upstreamname putStrLn $ " *** Processing upstream file " ++ upstreamfn- runIO ("hg-importorig", verbargs ++ [upstreamfn, tag2pkg tag,- tag2upsver tag])+ runIO ("hg-importorig", (concat . map importopt2arg $ args) +++ [upstreamfn, tag2pkg tag, tag2upsver tag]) putStrLn $ " *** Done processing upstream file " ++ upstreamfn pullupstream dscname tag = do upstreamrepo <- readlinkabs (printf "../%s.upstream" (tag2pkg tag))- patchcount <- runSL $ ("hg", ["-q", "incoming", upstreamrepo]) -|- wcL- if patchcount == "0"+ result <- run $ ("hg", ["-q", "incoming", upstreamrepo])+ if result /= (0::Int) then putStrLn "No patches to pull from upstream; skipping this step." else do runIO $ ("hg", ["pull", upstreamrepo]) procpull upstreamrepo tag@@ -91,15 +91,19 @@ tag2upsver tag ++ " into Debian branch"]) else runIO "hg update" -procdsc verbargs dscname tag tmpdir =+procdsc args verbargs dscname tag tmpdir = do absname <- readlinkabs dscname v $ "Unpacking " ++ absname ++ " into " ++ tmpdir bracketCWD tmpdir $ runIO $ ("dpkg-source", ["-x", absname]) let srcdir = printf "%s/%s-%s" tmpdir (tag2pkg tag) (tag2upsver tag) v $ "Importing directory " ++ srcdir- - runIO $ ("hg_load_dirs", verbargs +++ case [s | S s <- args] of+ [] -> runIO $ ("hg_load_dirs", verbargs ++ ["--summary=Import Debian " ++ (tag2pkg tag) ++ " " ++ (tag2ver tag), srcdir])+ (x:_) -> do runIO $ ("hg_load_dirs", verbargs ++ ["-n", "-f", srcdir])+ runIO $ ("hg", verbargs ++ ["addremove", "-s", x])+ runIO $ ("hg", verbargs ++ ["commit", "-m",+ printf "Import Debian %s %s" (tag2pkg tag) (tag2ver tag)]) runIO $ ("hg", ["tag", show tag])
hg-importorig.hs view
@@ -9,10 +9,10 @@ import Control.Monad import System.Path import Types+import System.Path -args = [Option ['v'] ["verbose"] (NoArg "v") "Enable verbose mode"] helpinfo = "Usage:\n\-\hg-importorig [-v] orig-name package version\n\+\hg-importorig [-v] [-s n] orig-name package version\n\ \\n\ \Imports the orig-name into ../${package}.upstream\n\ \\n\@@ -25,15 +25,15 @@ \\n\ \ version is the upstream version being imported\n" -crashusage = die 5 $ usageInfo helpinfo args+crashusage = die 5 $ usageInfo helpinfo importargs main = - do (args, files) <- parseCmdLine RequireOrder args helpinfo+ do (args, files) <- parseCmdLine RequireOrder importargs helpinfo (origname, package, version) <- case files of [o, p, v] -> return (o, p, v) _ -> crashusage let tag = Tag "UPSTREAM" package version- let isverbose = ("v" `elem` args)+ let isverbose = (Verbose `elem` args) when isverbose setverbose let verbargs = if isverbose then ["-v"] else [] upstreamrepo <- readlinkabs (printf "../%s.upstream" package)@@ -52,9 +52,16 @@ (flip unless) (die 1 $ printf "%s is not newer than all upstreams" version) - runIO $ ("hg_load_dirs", verbargs ++ ["--wc=" ++ upstreamrepo,+ case [s | S s <- args] of+ [] -> runIO $ ("hg_load_dirs", verbargs ++ ["--wc=" ++ upstreamrepo, printf "--summary=Import upstream %s version %s" package version,- origname]) + origname])+ (x:_) -> do runIO $ ("hg_load_dirs", verbargs ++ + ["--wc=" ++ upstreamrepo, "-n", "-f", origname])+ bracketCWD upstreamrepo $ do+ runIO $ ("hg", verbargs ++ ["addremove", "-s", x])+ runIO $ ("hg", verbargs ++ ["commit", "-m",+ printf "Import upstream %s version %s" package version]) bracketCWD upstreamrepo $ runIO $ ("hg", ["tag", show tag]) bracketCWD upstreamrepo $ runIO $ ("hg", ["tag", show tag ++ "_TAG"]) putStrLn ""