summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2011-03-18 14:53:04 +0000
committerRichard Jones <rjones@redhat.com>2011-03-18 14:53:04 +0000
commitfb6a900047ba372ec933ebf1b3d7339c4f33243c (patch)
tree3eff1f12264482dbf5876a150c62bfc77fa4394e
parent91819fa0e61ee0b41f2342fd5149b385146bb954 (diff)
downloadfebootstrap-fb6a900047ba372ec933ebf1b3d7339c4f33243c.tar.gz
febootstrap-fb6a900047ba372ec933ebf1b3d7339c4f33243c.tar.xz
febootstrap-fb6a900047ba372ec933ebf1b3d7339c4f33243c.zip
Collect the size (ft_size) of files from package handlers.
-rw-r--r--febootstrap.ml9
-rw-r--r--febootstrap_debian.ml2
-rw-r--r--febootstrap_package_handlers.ml1
-rw-r--r--febootstrap_package_handlers.mli1
-rw-r--r--febootstrap_pacman.ml2
-rw-r--r--febootstrap_yum_rpm.ml13
6 files changed, 17 insertions, 11 deletions
diff --git a/febootstrap.ml b/febootstrap.ml
index 9ea9885..3c634c4 100644
--- a/febootstrap.ml
+++ b/febootstrap.ml
@@ -126,7 +126,8 @@ let () =
else (
insert_dir parent;
let newdir = (parent, { ft_dir = true; ft_config = false;
- ft_ghost = false; ft_mode = 0o40755 },
+ ft_ghost = false; ft_mode = 0o40755;
+ ft_size = 0 },
"") in
newdir :: loop parent
)
@@ -140,12 +141,12 @@ let () =
if false then (
List.iter (
fun (name, { ft_dir = dir; ft_ghost = ghost; ft_config = config;
- ft_mode = mode }, pkg) ->
- printf "%s [%s%s%s%o] from %s\n" name
+ ft_mode = mode; ft_size = size }, pkg) ->
+ printf "%s [%s%s%s%o %d] from %s\n" name
(if dir then "dir " else "")
(if ghost then "ghost " else "")
(if config then "config " else "")
- mode
+ mode size
pkg
) files
);
diff --git a/febootstrap_debian.ml b/febootstrap_debian.ml
index 83c6c1a..f0d0be5 100644
--- a/febootstrap_debian.ml
+++ b/febootstrap_debian.ml
@@ -112,7 +112,7 @@ let debian_list_files pkg =
let mode = statbuf.st_perm in
(path, { ft_dir = is_dir; ft_config = config; ft_mode = mode;
- ft_ghost = false })
+ ft_ghost = false; ft_size = statbuf.st_size })
) lines in
files
diff --git a/febootstrap_package_handlers.ml b/febootstrap_package_handlers.ml
index 72bb172..ad3a233 100644
--- a/febootstrap_package_handlers.ml
+++ b/febootstrap_package_handlers.ml
@@ -33,6 +33,7 @@ and file_type = {
ft_config : bool;
ft_ghost : bool;
ft_mode : int;
+ ft_size : int;
}
let tmpdir = tmpdir ()
diff --git a/febootstrap_package_handlers.mli b/febootstrap_package_handlers.mli
index 673e448..c28d81f 100644
--- a/febootstrap_package_handlers.mli
+++ b/febootstrap_package_handlers.mli
@@ -50,6 +50,7 @@ and file_type = {
ft_config : bool; (** Is a configuration file. *)
ft_ghost : bool; (** Is a ghost (created empty) file. *)
ft_mode : int; (** File mode. *)
+ ft_size : int; (** File size. *)
}
val register_package_handler : string -> package_handler -> unit
diff --git a/febootstrap_pacman.ml b/febootstrap_pacman.ml
index 760d0ef..96dfefa 100644
--- a/febootstrap_pacman.ml
+++ b/febootstrap_pacman.ml
@@ -111,7 +111,7 @@ let pacman_list_files pkg =
let mode = statbuf.st_perm in
(path, { ft_dir = is_dir; ft_config = config; ft_mode = mode;
- ft_ghost = false })
+ ft_ghost = false; ft_size = statbuf.st_size })
) lines in
files
diff --git a/febootstrap_yum_rpm.ml b/febootstrap_yum_rpm.ml
index e70940d..f6644b8 100644
--- a/febootstrap_yum_rpm.ml
+++ b/febootstrap_yum_rpm.ml
@@ -163,7 +163,7 @@ f.close ()
let rec yum_rpm_list_files pkg =
(* Run rpm -qlp with some extra magic. *)
let cmd =
- sprintf "rpm -q --qf '[%%{FILENAMES} %%{FILEFLAGS:fflags} %%{FILEMODES}\\n]' -p %s"
+ sprintf "rpm -q --qf '[%%{FILENAMES} %%{FILEFLAGS:fflags} %%{FILEMODES} %%{FILESIZES}\\n]' -p %s"
pkg in
let lines = run_command_get_lines cmd in
@@ -171,15 +171,16 @@ let rec yum_rpm_list_files pkg =
filter_map (
fun line ->
match string_split " " line with
- | [filename; flags; mode] ->
+ | [filename; flags; mode; size] ->
let test_flag = String.contains flags in
let mode = int_of_string mode in
+ let size = int_of_string size in
if test_flag 'd' then None (* ignore documentation *)
else
Some (filename, {
ft_dir = mode land 0o40000 <> 0;
ft_ghost = test_flag 'g'; ft_config = test_flag 'c';
- ft_mode = mode;
+ ft_mode = mode; ft_size = size;
})
| _ ->
eprintf "febootstrap: bad output from rpm command: '%s'" line;
@@ -199,7 +200,8 @@ let rec yum_rpm_list_files pkg =
let dirs =
List.map (fun name ->
name, { ft_dir = true; ft_ghost = false;
- ft_config = false; ft_mode = 0o40755 }) dirs in
+ ft_config = false; ft_mode = 0o40755;
+ ft_size = 0 }) dirs in
let devs = [ "/dev/null"; "/dev/full"; "/dev/zero"; "/dev/random";
"/dev/urandom"; "/dev/tty"; "/dev/console";
"/dev/ptmx"; "/dev/stdin"; "/dev/stdout"; "/dev/stderr" ] in
@@ -207,7 +209,8 @@ let rec yum_rpm_list_files pkg =
let devs =
List.map (fun name ->
name, { ft_dir = false; ft_ghost = false;
- ft_config = false; ft_mode = 0o644 }) devs in
+ ft_config = false; ft_mode = 0o644;
+ ft_size = 0 }) devs in
dirs @ devs @ files
) else files in