forked from pool/supermin
91 lines
2.7 KiB
Diff
91 lines
2.7 KiB
Diff
|
From 4e383ba22421c2eaf797dcac09dfed30a8ccfa66 Mon Sep 17 00:00:00 2001
|
||
|
From: Olaf Hering <olaf@aepfle.de>
|
||
|
Date: Mon, 3 Jun 2013 17:09:10 +0200
|
||
|
Subject: Handle --packager-config in zypp_rpm
|
||
|
|
||
|
---
|
||
|
src/Makefile.am | 2 +-
|
||
|
src/supermin_zypp_rpm.ml | 21 ++++++++++++++++++---
|
||
|
2 files changed, 19 insertions(+), 4 deletions(-)
|
||
|
|
||
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
||
|
index 3b6ca9b..6ed0faf 100644
|
||
|
--- a/src/Makefile.am
|
||
|
+++ b/src/Makefile.am
|
||
|
@@ -56,7 +56,7 @@ OBJECTS = $(XOBJECTS)
|
||
|
BEST = opt
|
||
|
endif
|
||
|
|
||
|
-OCAMLPACKAGES = -package unix,str
|
||
|
+OCAMLPACKAGES = -package unix,str,inifiles
|
||
|
OCAMLFLAGS = -warn-error CDEFLMPSUVXYZ
|
||
|
|
||
|
supermin: $(OBJECTS)
|
||
|
diff --git a/src/supermin_zypp_rpm.ml b/src/supermin_zypp_rpm.ml
|
||
|
index c269aab..b82984b 100644
|
||
|
--- a/src/supermin_zypp_rpm.ml
|
||
|
+++ b/src/supermin_zypp_rpm.ml
|
||
|
@@ -45,6 +45,7 @@
|
||
|
*)
|
||
|
open Unix
|
||
|
open Printf
|
||
|
+open Inifiles
|
||
|
|
||
|
open Supermin_package_handlers
|
||
|
open Supermin_utils
|
||
|
@@ -54,6 +55,19 @@ open Supermin_cmdline
|
||
|
(* Create a temporary directory for use by all the functions in this file. *)
|
||
|
let tmpdir = tmpdir ()
|
||
|
|
||
|
+let get_repos_dir () =
|
||
|
+ let zypper_default = "/etc/zypp/repos.d" in
|
||
|
+ let parse_repos_dir path =
|
||
|
+ let cfg = new inifile path in
|
||
|
+ let dir = (try cfg#getval "main" "reposdir" with _ -> zypper_default) in
|
||
|
+ dir
|
||
|
+ in
|
||
|
+ let dir = (match packager_config with None -> zypper_default |
|
||
|
+ Some filename -> (try parse_repos_dir filename with _ -> zypper_default) ) in
|
||
|
+ dir
|
||
|
+
|
||
|
+let repos_dir = get_repos_dir ()
|
||
|
+
|
||
|
let zypp_rpm_detect () =
|
||
|
(file_exists "/etc/SuSE-release") &&
|
||
|
Config.zypper <> "no" && Config.rpm <> "no"
|
||
|
@@ -75,7 +89,7 @@ pkg_cache_dir=%S
|
||
|
time zypper \
|
||
|
%s \
|
||
|
%s \
|
||
|
- --root %S --reposd-dir /etc/zypp/repos.d \
|
||
|
+ --root %S --reposd-dir %S \
|
||
|
--cache-dir \"${cache_dir}\" \
|
||
|
--pkg-cache-dir \"${pkg_cache_dir}\" \
|
||
|
--gpg-auto-import-keys \
|
||
|
@@ -92,6 +106,7 @@ time zypper \
|
||
|
(match packager_config with None -> ""
|
||
|
| Some filename -> sprintf "--config %s" filename)
|
||
|
tmp_root
|
||
|
+ repos_dir
|
||
|
in
|
||
|
run_shell sh names;
|
||
|
|
||
|
@@ -129,7 +144,7 @@ unset LANG ${!LC_*}
|
||
|
zypper \
|
||
|
%s \
|
||
|
%s \
|
||
|
- --root %S --reposd-dir /etc/zypp/repos.d \
|
||
|
+ --root %S --reposd-dir %S \
|
||
|
--cache-dir %S \
|
||
|
--gpg-auto-import-keys \
|
||
|
--non-interactive \
|
||
|
@@ -146,7 +161,7 @@ zypper \
|
||
|
(if verbose then "--verbose --verbose" else "--quiet")
|
||
|
(match packager_config with None -> ""
|
||
|
| Some filename -> sprintf "--config %s" filename)
|
||
|
- tmpdir tmpdir (String.concat " " (List.map Filename.quote names)) in
|
||
|
+ tmpdir repos_dir tmpdir (String.concat " " (List.map Filename.quote names)) in
|
||
|
let pkg_names = run_command_get_lines cmd in
|
||
|
|
||
|
(* Return list of package names, remove empty lines. *)
|