[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:55:20 UTC 2010
The following commit has been merged in the master branch:
commit 166aa85bc7212e20cef5c210d2369f0522a4eaae
Author: John Goerzen <jgoerzen at complete.org>
Date: Tue Mar 15 08:04:52 2005 +0100
checkpointing
Keywords:
(jgoerzen at complete.org--projects/missingh--head--0.7--patch-206)
diff --git a/ChangeLog b/ChangeLog
index 4c84f13..f8e49ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,18 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.7
#
+2005-03-15 01:04:52 GMT John Goerzen <jgoerzen at complete.org> patch-206
+
+ Summary:
+ checkpointing
+ Revision:
+ missingh--head--0.7--patch-206
+
+
+ modified files:
+ ChangeLog MissingH/Debian.hs MissingH/Debian/ControlParser.hs
+
+
2005-03-14 20:31:41 GMT John Goerzen <jgoerzen at complete.org> patch-205
Summary:
diff --git a/MissingH/Debian.hs b/MissingH/Debian.hs
index b2c09e0..514c43a 100644
--- a/MissingH/Debian.hs
+++ b/MissingH/Debian.hs
@@ -35,7 +35,7 @@ Written by John Goerzen, jgoerzen\@complete.org
module MissingH.Debian (-- * Control or Similar File Utilities
ControlFile,
-- * Version Number Utilities
- DebVersion, compareDebVersion
+ DebVersion, compareDebVersion, checkDebVersion
)
where
import System.Cmd
@@ -61,16 +61,14 @@ of 'Prelude.Ord', but you can also use 'compareDebVersion' if you prefer. -}
data DebVersion = DebVersion String
deriving (Eq)
instance Ord DebVersion where
- compare v1 v2 =
+ compare (DebVersion v1) (DebVersion v2) =
{- This is OK since compareDebVersion should always be the same. -}
unsafePerformIO $ compareDebVersion v1 v2
-compareDebVersion :: DebVersion -> DebVersion -> IO Ordering
-compareDebVersion (DebVersion v1) (DebVersion v2) =
- let runit op = do ec <- rawSystem "dpkg" ["--compare-versions", v1, op, v2]
- case ec of
- ExitSuccess -> return True
- ExitFailure _ -> return False
+{- | Compare the versions of two packages. -}
+compareDebVersion :: String -> String -> IO Ordering
+compareDebVersion v1 v2 =
+ let runit op = checkDebVersion v1 op v2
in do islt <- runit "lt"
if islt
then return LT
@@ -79,3 +77,12 @@ compareDebVersion (DebVersion v1) (DebVersion v2) =
then return GT
else return EQ
+checkDebVersion :: String -- ^ Version 1
+ -> String -- ^ Operator
+ -> String -- ^ Version 2
+ -> IO Bool
+checkDebVersion v1 op v2 =
+ do ec <- rawSystem "dpkg" ["--compare-versions", v1, op, v2]
+ case ec of
+ ExitSuccess -> return True
+ ExitFailure _ -> return False
diff --git a/MissingH/Debian/ControlParser.hs b/MissingH/Debian/ControlParser.hs
index c5477d8..f8a9a3e 100644
--- a/MissingH/Debian/ControlParser.hs
+++ b/MissingH/Debian/ControlParser.hs
@@ -32,16 +32,18 @@ files and programs.
Written by John Goerzen, jgoerzen\@complete.org
-}
-module MissingH.Debian.ControlParser(control)
+module MissingH.Debian.ControlParser(control, depPart)
where
import Text.ParserCombinators.Parsec
eol = (try (string "\r\n"))
<|> string "\n" <?> "EOL"
-extline = do char ' '
- content <- many (noneOf "\r\n")
- eol
+extline = try (do char ' '
+ content <- many (noneOf "\r\n")
+ eol
+ return content
+ )
entry = do key <- many1 (noneOf ":\r\n")
char ':'
@@ -50,4 +52,19 @@ entry = do key <- many1 (noneOf ":\r\n")
exts <- many extline
return (key, unlines ([val] ++ exts))
+{- | Main parser for the control file -}
control = many entry
+
+depPart = do packagename <- many1 (noneOf " (")
+ version <- (do many (char ' ')
+ char '('
+ op <- many1 (oneOf "<>=")
+ many (char ' ')
+ vers <- many1 (noneOf ") ")
+ many (char ' ')
+ char ')'
+ return $ Just (op, vers)
+ ) <|> return Nothing
+ return (packagename, version)
+
+
\ No newline at end of file
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list