SHA256
1
0
forked from pool/supermin

Patch to Handle --packager-config in zypp_rpm

OBS-URL: https://build.opensuse.org/package/show/Virtualization/supermin?expand=0&rev=10
This commit is contained in:
Olaf Hering 2013-06-03 15:10:48 +00:00 committed by Git OBS Bridge
parent 7a304d80bb
commit e3793ebae0
2 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,90 @@
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. *)

View File

@ -42,6 +42,7 @@ Patch9: 0009-use-correct-repos.d-in-zypp-driver.patch
Patch10: 0010-zypper-Use-instead-of.patch
Patch11: 0011-debian-Experiment-with-different-options-for-apt-cac.patch
Patch12: 0012-zypp-Fix-XPath-expressions.patch
Patch13: 0001-Handle-packager-config-in-zypp_rpm.patch
BuildRequires: autoconf
BuildRequires: automake
@ -74,6 +75,7 @@ you need to boot one of them.
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%build
export ZYPPER=zypper