Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use --packager-config option to replace --yum-config and --pacman-con…
…fig.

This makes it easier to use this option from libguestfs.
  • Loading branch information
rwmjones committed Dec 22, 2012
1 parent bfecae4 commit b8cbe19
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 33 deletions.
21 changes: 10 additions & 11 deletions src/febootstrap.pod
Expand Up @@ -91,13 +91,16 @@ written (C<hostfiles> and C<base.img>). The default directory is the
current directory. Note that if this files exist already in the
output directory then they will be overwritten.

=item B<--pacman-config CONFIGFILE>
=item B<--packager-config CONFIGFILE>

(ArchLinux package handler only). Use an alternate configuration file
instead of C</etc/pacman.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<pacman.conf(5)>.
Set the configuration file for the package manager. This allows you
to specify alternate software repositories.

For ArchLinux, this sets the pacman configuration file (default
C</etc/pacman.conf>). See L<pacman.conf(5)>.

For Yum/RPM distributions, this sets the yum configuration file
(default C</etc/yum.conf>). See L<yum.conf(5)>.

=item B<--save-temps>

Expand Down Expand Up @@ -130,11 +133,7 @@ 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)>.
This is a deprecated alias for I<--packager-config CONFIGFILE>.

=back

Expand Down
21 changes: 8 additions & 13 deletions src/febootstrap_cmdline.ml
Expand Up @@ -26,8 +26,7 @@ let save_temps = ref false
let use_installed = ref false
let verbose = ref false
let warnings = ref true
let yum_config = ref None
let pacman_config = ref None
let packager_config = ref None

let print_version () =
printf "%s %s\n" Config.package_name Config.package_version;
Expand All @@ -36,11 +35,8 @@ let print_version () =
let add_exclude re =
excludes := Str.regexp re :: !excludes

let set_yum_config str =
yum_config := Some str

let set_pacman_config str =
pacman_config := Some str
let set_packager_config str =
packager_config := Some str

let argspec = Arg.align [
"--exclude", Arg.String add_exclude,
Expand All @@ -51,8 +47,8 @@ let argspec = Arg.align [
" Suppress warnings";
"-o", Arg.Set_string outputdir,
"outputdir Set output directory (default: \".\")";
"--pacman-config", Arg.String set_pacman_config,
"file Set alternate pacman configuration file";
"--packager-config", Arg.String set_packager_config,
"file Set alternate package manager configuration file";
"--save-temp", Arg.Set save_temps,
" Don't delete temporary files and directories on exit.";
"--save-temps", Arg.Set save_temps,
Expand All @@ -67,8 +63,8 @@ let argspec = Arg.align [
" 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";
"--yum-config", Arg.String set_packager_config,
"file Deprecated alias for `--packager-config file'";
]
let anon_fn str =
packages := str :: !packages
Expand Down Expand Up @@ -101,7 +97,6 @@ let save_temps = !save_temps
let use_installed = !use_installed
let verbose = !verbose
let warnings = !warnings
let yum_config = !yum_config
let pacman_config = !pacman_config
let packager_config = !packager_config

let debug fs = ksprintf (fun str -> if verbose then print_endline str) fs
7 changes: 2 additions & 5 deletions src/febootstrap_cmdline.mli
Expand Up @@ -48,8 +48,5 @@ val verbose : bool
val warnings : bool
(** If true, print warnings. [--no-warnings] sets this to false. *)

val yum_config : string option
(** Yum configuration file. *)

val pacman_config : string option
(**pacman configuration file. *)
val packager_config : string option
(** Package manager configuration file. *)
2 changes: 1 addition & 1 deletion src/febootstrap_pacman.ml
Expand Up @@ -58,7 +58,7 @@ let pacman_resolve_dependencies_and_download names =
let cmd =
sprintf "umask 0000; cd %s && mkdir -p var/lib/pacman && fakeroot pacman%s -Syw --noconfirm --cachedir=$(pwd) --root=$(pwd) %s"
(Filename.quote tmpdir)
(match pacman_config with
(match packager_config with
| None -> ""
| Some filename -> " --config " ^ filename)
pkg in
Expand Down
6 changes: 3 additions & 3 deletions src/febootstrap_yum_rpm.ml
Expand Up @@ -102,8 +102,8 @@ if verbose:
print \"febootstrap_yum_rpm: finished python code\"
"
(if verbose then 1 else 0)
(match yum_config with None -> "False" | Some _ -> "True")
(match yum_config with None -> "" | Some filename -> filename)
(match packager_config with None -> "False" | Some _ -> "True")
(match packager_config with None -> "" | Some filename -> filename)
tmpfile in
run_python py names;
let chan = open_in tmpfile in
Expand Down Expand Up @@ -166,7 +166,7 @@ if verbose:

let cmd = sprintf "yumdownloader%s%s --destdir %s %s"
(if verbose then "" else " --quiet")
(match yum_config with None -> ""
(match packager_config with None -> ""
| Some filename -> sprintf " -c %s" filename)
(Filename.quote tmpdir)
(String.concat " " (List.map Filename.quote pkgnames)) in
Expand Down

0 comments on commit b8cbe19

Please sign in to comment.