X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=febootstrap_yum_rpm.ml;h=f6644b8f8b7ec5a1ed7f6874f2505318214f1849;hb=refs%2Ftags%2F3.8;hp=ca38fe8f91eb61bd2d4c3643de5f1e11eb8a6b01;hpb=68eade3bca4b6024015a319e13e4ad3c5e0d840e;p=febootstrap.git diff --git a/febootstrap_yum_rpm.ml b/febootstrap_yum_rpm.ml index ca38fe8..f6644b8 100644 --- a/febootstrap_yum_rpm.ml +++ b/febootstrap_yum_rpm.ml @@ -43,6 +43,8 @@ import sys yb = yum.YumBase () yb.preconf.debuglevel = %d yb.preconf.errorlevel = %d +if %s: + yb.preconf.fn = %S yb.setCacheDir () # Look up the base packages from the command line. @@ -74,7 +76,12 @@ for pkg in deps.keys (): f.write (\"%%s %%s %%s %%s %%s\\n\" %% (pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch)) f.close () -" (if verbose then 1 else 0) (if verbose then 1 else 0) tmpfile in +" + (if verbose then 1 else 0) + (if verbose then 1 else 0) + (match yum_config with None -> "False" | Some _ -> "True") + (match yum_config with None -> "" | Some filename -> filename) + tmpfile in run_python py names; let chan = open_in tmpfile in let lines = input_all_lines chan in @@ -138,8 +145,10 @@ f.close () exit 1 ); - let cmd = sprintf "yumdownloader%s --destdir %s %s" + let cmd = sprintf "yumdownloader%s%s --destdir %s %s" (if verbose then "" else " --quiet") + (match yum_config with None -> "" + | Some filename -> sprintf " -c %s" filename) (Filename.quote tmpdir) (String.concat " " (List.map Filename.quote pkgnames)) in run_command cmd; @@ -154,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 @@ -162,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; @@ -190,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 @@ -198,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