X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=febootstrap_yum_rpm.ml;h=e70940df06edb87b616d739bf0912d742809842c;hb=829022742304841be78d022bc965a02f48eba2eb;hp=075e4e0def7a47e27e6e7c76479e98849b5bf23c;hpb=155b6952bb3fde46cee675c353e2462a09172c50;p=febootstrap.git diff --git a/febootstrap_yum_rpm.ml b/febootstrap_yum_rpm.ml index 075e4e0..e70940d 100644 --- a/febootstrap_yum_rpm.ml +++ b/febootstrap_yum_rpm.ml @@ -34,6 +34,7 @@ let yum_rpm_detect () = let yum_rpm_resolve_dependencies_and_download names = (* Liberate this data from python. *) + let tmpfile = tmpdir // "names.tmp" in let py = sprintf " import yum import yum.misc @@ -42,10 +43,13 @@ 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. deps = dict () -pkgs = yb.pkgSack.returnPackages (patterns=sys.argv[2:]) +pkgs = yb.pkgSack.returnPackages (patterns=sys.argv[1:]) for pkg in pkgs: deps[pkg] = False @@ -67,14 +71,18 @@ while not stable: deps[pkg] = yum.misc.unique (deps[pkg]) # Write it to a file because yum spews garbage on stdout. -f = open (sys.argv[1], \"w\") +f = open (%S, \"w\") 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) in - let tmpfile = tmpdir // "names.tmp" in - run_python py (tmpfile :: names); +" + (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 close_in chan; @@ -137,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;