datapacker 1.0.0.1 → 1.0.1
raw patch · 5 files changed
+58/−6 lines, 5 files
Files
- Actions.hs +8/−3
- Types.hs +2/−0
- datapacker.cabal +1/−1
- datapacker.hs +12/−2
- datapacker.sgml +35/−0
Actions.hs view
@@ -30,7 +30,8 @@ Exec x -> action_exec x ri resultlist formatBin :: RunInfo -> Integer -> String-formatBin ri bin = printf (binFmt ri) bin+formatBin ri bin = + printf (binFmt ri) bin action_print :: RunInfo -> [(Integer, [FilePath])] -> IO () action_print ri =@@ -63,8 +64,12 @@ where makeLink (bin, fpl) = mapM_ (makeLink' (formatBin ri bin)) fpl makeLink' bin fp =- do createDirectoryIfMissing False bin- func fp (bin ++ "/" ++ takeFileName fp)+ if deepLinks ri+ then do let dirname = bin ++ "/" ++ takeDirectory fp+ createDirectoryIfMissing True dirname+ func fp (dirname ++ "/" ++ takeFileName fp)+ else do createDirectoryIfMissing False bin+ func fp (bin ++ "/" ++ takeFileName fp) action_exec :: String -> RunInfo -> [(Integer, [FilePath])] -> IO () action_exec cmd ri inp =
Types.hs view
@@ -16,6 +16,8 @@ RunInfo {binSize :: Integer, firstBinSize :: Integer, preserveOrder :: Bool,+ sortFiles :: Bool,+ deepLinks :: Bool, readNull :: Bool, binFmt :: String, action :: Action}
datapacker.cabal view
@@ -1,5 +1,5 @@ Name: datapacker-Version: 1.0.0.1+Version: 1.0.1 License: GPL Maintainer: John Goerzen <jgoerzen@complete.org> Author: John Goerzen
datapacker.hs view
@@ -62,12 +62,14 @@ \Tip: this can include a directory.\n\ \default: %03d", Option "d" ["debug"] (NoArg ("d", "")) "Enable debugging",+ Option "D" ["deep-links"] (NoArg ("D", "")) "Enable deep bin directories", Option "p" ["preserve-order"] (NoArg ("p", "")) "Don't reorder files for maximum packing", Option "s" ["size"] (ReqArg (stdRequired "s") "SIZE") "Size of each output bin", Option "S" ["size-first"] (ReqArg (stdRequired "S") "SIZE") "Override size of first output bin",+ Option "" ["sort"] (NoArg ("sort", "")) "Sort input; useless without -p", Option "" ["help"] (NoArg ("help", "")) "Display this help"] worker :: [(String, String)] -> [FilePath] -> IO ()@@ -89,7 +91,9 @@ then readFileList (readNull runinfo) else return files - results <- scan runinfo files_scan+ let listToProc = if sortFiles runinfo then sort files_scan else files_scan++ results <- scan runinfo listToProc let numberedResults = zip [1..] (map (map snd) results) runAction runinfo numberedResults @@ -118,6 +122,12 @@ let b = case lookup "b" args of Nothing -> "%03d" Just x -> x+ let deeplinks = case lookup "D" args of+ Nothing -> False+ Just _ -> True+ let dosort = case lookup "sort" args of+ Nothing -> False+ Just _ -> True a <- case lookup "a" args of Nothing -> return Print Just "print" -> return Print@@ -131,7 +141,7 @@ else fail $ "Unknown action: " ++ show x return $ RunInfo {binSize = size, firstBinSize = first, preserveOrder = po, readNull = n, binFmt = b,- action = a}+ action = a, deepLinks = deeplinks, sortFiles = dosort} usageerror :: String -> IO t usageerror errormsg =
datapacker.sgml view
@@ -206,6 +206,9 @@ with the same filename in different paths. &datapacker; will exit on either of these situations. </para>+ <para>+ See also <option>--deep-links</option>.+ </para> </listitem> </varlistentry> @@ -220,6 +223,8 @@ single filename occur in multiple input directories with this option. </para>+ <para>+ See also <option>--deep-links</option>. </listitem> </varlistentry> </variablelist>@@ -264,6 +269,22 @@ </varlistentry> <varlistentry>+ <term>-D</term>+ <term>--deep-links</term>+ <listitem>+ <para>+ When used with the symlink or hardlink action, instead+ of making all links in a single flat directory under the+ bin, mimic the source directory structure under the+ bin. Makes most sense when used with+ <option>-p</option>, but could also be useful without it+ if there are files with the same name in different+ source directories.+ </para>+ </listitem>+ </varlistentry>++ <varlistentry> <term>--help</term> <listitem> <para>@@ -361,6 +382,20 @@ </para> </listitem> </varlistentry>++ <varlistentry>+ <term>--sort</term>+ <listitem>+ <para>+ Sorts the list of files to process before acting upon+ them. When combined with <option>-p</option>, causes+ the output to be sorted. This option has no effect save+ increasing CPU usage when not combined with+ <option>-p</option>.+ </para>+ </listitem>+ </varlistentry>+ </variablelist> <refsect2> <title>File Specification</title>