Permalink
Browse files

Fix reading from pre-defined files

  • Loading branch information...
1 parent 8dcfa1c commit c0e47cc8843f6c630af7ceb7f0dd51d302d6af88 @kolmodin kolmodin committed Feb 20, 2009
Showing with 8 additions and 5 deletions.
  1. +8 −5 Main.hs
View
@@ -23,18 +23,21 @@ main = do
ebuilds <-
case packages_file of
Just pf -> do pkgs <- filter (not . L.isPrefixOf "#") . lines <$> readFile pf
- return $ zip (map extractCPVR_pkgLine pkgs) pkgs
+ let ps = map extractCPVR_pkgLine pkgs
+ name (cat,pkg,ver) = cat </> pkg <-> ver
+ path (cat,pkg,ver) = cat </> pkg </> pkg <-> ver
+ return $ zip (map name ps) (map path ps)
Nothing -> do pkgs <- findPackages wd
return $ zip (map extractCPVR pkgs) pkgs
-- let ebuilds = zip (map extractCPVR packages) packages
pretty prettyColumns prettyHeader
pretty prettyColumns (map (\c -> replicate (fromAlign c) '-') prettyColumns)
forM_ ebuilds $ \(package_name, package_path) -> do
- let ebuild_file = package_path ++ ".ebuild"
+ let ebuild_file = wd </> package_path ++ ".ebuild"
exists <- doesFileExist ebuild_file
if not exists
- then doesNotExist package_path
+ then doesNotExist package_name
else printIt package_name ebuild_file
where
doesNotExist package_name = do
@@ -77,8 +80,8 @@ versionRegex name = R.compile ("^" ++ name ++ "-(.*).ebuild$") []
extractCPVR_pkgLine pkg_line =
case R.match packageRegex pkg_line [] of
- Just [_, cat,pkg,ver] -> cat </> pkg </> pkg <-> ver
- Just [_, cat,pkg,ver,suf] -> cat </> pkg </> pkg <-> ver ++ suf
+ Just [_, cat,pkg,ver] -> (cat, pkg, ver)
+ Just [_, cat,pkg,ver,suf] -> (cat, pkg, ver ++ suf)
x -> error (show x)
extractCPVR_m text =

0 comments on commit c0e47cc

Please sign in to comment.