Add --yum-config option to set a yum configuration file.
authorRichard W.M. Jones <rjones@redhat.com>
Mon, 6 Dec 2010 17:14:03 +0000 (17:14 +0000)
committerRichard W.M. Jones <rjones@redhat.com>
Mon, 6 Dec 2010 17:16:35 +0000 (17:16 +0000)
febootstrap.pod
febootstrap_cmdline.ml
febootstrap_cmdline.mli
febootstrap_yum_rpm.ml

index c76b4eb..bf6c593 100644 (file)
@@ -139,6 +139,14 @@ Enable verbose messages.
 
 Print the package name and version number, and exit.
 
 
 Print the package name and version number, and exit.
 
+=item B<--yum-config CONFIGFILE>
+
+(Yum/RPM package handler only).  Use an alternate configuration file
+instead of C</etc/yum.conf>.  If you also want to specify alternate
+repositories then you can put them in this file directly or add a
+C<reposdir> option to this file.  For more information on the file
+format see L<yum.conf(5)>.
+
 =back
 
 =head1 SEE ALSO
 =back
 
 =head1 SEE ALSO
index 92fd677..902e313 100644 (file)
@@ -24,6 +24,7 @@ let outputdir = ref "."
 let packages = ref []
 let verbose = ref false
 let warnings = ref true
 let packages = ref []
 let verbose = ref false
 let warnings = ref true
+let yum_config = ref None
 
 let print_version () =
   printf "%s %s\n" Config.package_name Config.package_version;
 
 let print_version () =
   printf "%s %s\n" Config.package_name Config.package_version;
@@ -32,6 +33,9 @@ let print_version () =
 let add_exclude re =
   excludes := Str.regexp re :: !excludes
 
 let add_exclude re =
   excludes := Str.regexp re :: !excludes
 
+let set_yum_config str =
+  yum_config := Some str
+
 let argspec = Arg.align [
   "--exclude", Arg.String add_exclude,
     "regexp Exclude packages matching regexp";
 let argspec = Arg.align [
   "--exclude", Arg.String add_exclude,
     "regexp Exclude packages matching regexp";
@@ -49,6 +53,8 @@ let argspec = Arg.align [
     " Print package name and version, and exit";
   "--version", Arg.Unit print_version,
     " Print package name and version, and exit";
     " Print package name and version, and exit";
   "--version", Arg.Unit print_version,
     " Print package name and version, and exit";
+  "--yum-config", Arg.String set_yum_config,
+    "file Set alternate yum configuration file";
 ]
 let anon_fn str =
   packages := str :: !packages
 ]
 let anon_fn str =
   packages := str :: !packages
@@ -79,5 +85,6 @@ let outputdir = !outputdir
 let packages = List.rev !packages
 let verbose = !verbose
 let warnings = !warnings
 let packages = List.rev !packages
 let verbose = !verbose
 let warnings = !warnings
+let yum_config = !yum_config
 
 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
index bd4e46e..107e70a 100644 (file)
@@ -41,3 +41,6 @@ val verbose : bool
 
 val warnings : bool
   (** If true, print warnings.  [--no-warnings] sets this to false. *)
 
 val warnings : bool
   (** If true, print warnings.  [--no-warnings] sets this to false. *)
+
+val yum_config : string option
+  (** Yum configuration file. *)
index ca38fe8..e70940d 100644 (file)
@@ -43,6 +43,8 @@ import sys
 yb = yum.YumBase ()
 yb.preconf.debuglevel = %d
 yb.preconf.errorlevel = %d
 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.
 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 ()
     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
   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
   );
 
     exit 1
   );
 
-  let cmd = sprintf "yumdownloader%s --destdir %s %s"
+  let cmd = sprintf "yumdownloader%s%s --destdir %s %s"
     (if verbose then "" else " --quiet")
     (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;
     (Filename.quote tmpdir)
     (String.concat " " (List.map Filename.quote pkgnames)) in
   run_command cmd;