let names_mode = !names_mode
let outputdir = !outputdir
let packages = List.rev !packages
+let verbose = !verbose
let warnings = !warnings
-let debug fs = ksprintf (fun str -> if !verbose then print_endline str) fs
+let debug fs = ksprintf (fun str -> if verbose then print_endline str) fs
val packages : string list
(** List of packages or package names as supplied on the command line. *)
+val verbose : bool
+ (** True if [--verbose] was given on the command line.
+ See also {!debug}. *)
+
val warnings : bool
(** If true, print warnings. [--no-warnings] sets this to false. *)
let yum_rpm_resolve_dependencies_and_download names =
(* Liberate this data from python. *)
- let py = "
+ let py = sprintf "
import yum
import yum.misc
import sys
yb = yum.YumBase ()
-#yum.logginglevels.setDebugLevel(0) -- doesn't work?
+yb.preconf.debuglevel = %d
+yb.preconf.errorlevel = %d
# Look up the base packages from the command line.
deps = dict ()
# Write it to a file because yum spews garbage on stdout.
f = open (sys.argv[1], \"w\")
for pkg in deps.keys ():
- f.write (\"%s %s %s %s %s\\n\" %
+ f.write (\"%%s %%s %%s %%s %%s\\n\" %%
(pkg.name, pkg.epoch, pkg.version, pkg.release, pkg.arch))
f.close ()
-" in
+" (if verbose then 1 else 0) (if verbose then 1 else 0) in
let tmpfile = tmpdir // "names.tmp" in
run_python py (tmpfile :: names);
let chan = open_in tmpfile in
exit 1
);
- let cmd = sprintf "yumdownloader --destdir %s %s"
+ let cmd = sprintf "yumdownloader%s --destdir %s %s"
+ (if verbose then "" else " --quiet")
(Filename.quote tmpdir)
(String.concat " " (List.map Filename.quote pkgnames)) in
run_command cmd;