Hi,
It seems that the commit 620ee4 is causing failure of unit tests.
A new list keyword has been added to handle the case where gnupg key is
a list. The first error I found is the list_sep that doesn't accept
simple space between values:
- let list_sep = del /[ \t]*(,[ \t]*|\n[ \t]+)/ "\n\t"
+ let list_sep = del /([ \t]*(,[ \t]*|\n[ \t]+))|[ \t]+/ "\n\t"
The lens accept sections with one of either "baseurl" or "gpgkey", and
an error occur when they are both present, as in
tests/etc/yum.repos.d/remi.repo. The "lists" lens can't be iterated,
because a iteration in put direction occur. So, I added every possible
combinations of entries and lists:
let section =
let list_baseurl = kv_list "baseurl" in
let list_gpgkey = kv_list "gpgkey" in
[ sechead . ( entry*
| entry* . list_baseurl . entry*
| entry* . list_gpgkey . entry*
| entry* . list_baseurl . entry* . list_gpgkey . entry*
| entry* . list_gpgkey . entry* . list_baseurl .
entry*)]
It's ugly, but it prevent to change the tree structure, and preserve the
behavior that reject the config if more than one baseurl option is
present.
We can do it because there are only two options. Adding a third special
keyword this way will create huge lens, to list every combinations:
x |
xax | xbx | xcx |
xaxbx | xaxcx | xbxax | xbxcx | xcxax | xcxbx |
xaxbxcx | xaxcxbx | xbxaxcx | xbxcxax | xcxaxbx | xcxbxax
options | alternatives
----------------------
1 | 2
2 | 5
3 | 16
Anyway, here is the little patch to fix the isue.
Francis
>From 0d625e2aec578173977c5d743f56f6851ef74949 Mon Sep 17 00:00:00 2001
From: Francis Giraldeau <[email protected]>
Date: Sat, 21 Aug 2010 18:30:16 -0400
Subject: [PATCH] Fix yum tests
* Modify separator for list values to accept simple spaces
* Add all alternatives for baseurl and gpgkey
* Add tests to verify the correct behavior
---
lenses/tests/test_yum.aug | 99 +++++++++++++++++++++++++++++++++++++++++++++
lenses/yum.aug | 11 ++++-
2 files changed, 107 insertions(+), 3 deletions(-)
diff --git a/lenses/tests/test_yum.aug b/lenses/tests/test_yum.aug
index 2bd1657..46f6411 100644
--- a/lenses/tests/test_yum.aug
+++ b/lenses/tests/test_yum.aug
@@ -26,6 +26,50 @@ installonly_limit=100
# in /etc/yum.repos.d
"
+ let yum_repo1 = "[fedora]
+name=Fedora $releasever - $basearch
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
+
+[fedora-debuginfo]
+name=Fedora $releasever - $basearch - Debug
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
+
+[fedora-source]
+name=Fedora $releasever - Source
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
+"
+ let yum_repo2 = "[remi]
+name=Les RPM de remi pour FC$releasever - $basearch
+baseurl=http://remi.collet.free.fr/rpms/fc$releasever.$basearch/
+ http://iut-info.ens.univ-reims.fr/remirpms/fc$releasever.$basearch/
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
+
+[remi-test]
+name=Les RPM de remi en test pour FC$releasever - $basearch
+baseurl=http://remi.collet.free.fr/rpms/test-fc$releasever.$basearch/
+ http://iut-info.ens.univ-reims.fr/remirpms/test-fc$releasever.$basearch/
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
+"
+
let cont = "[main]\nbaseurl=url1\n url2 , url3\n \n"
test Yum.lns get yum_simple =
@@ -87,6 +131,61 @@ installonly_limit=100
{ "gpgkey" = "key1" }
{ "gpgkey" = "key2" } }
+ test Yum.lns get yum_repo1 =
+ { "fedora"
+ { "name" = "Fedora $releasever - $basearch" }
+ { "failovermethod" = "priority" }
+ { }
+ { "mirrorlist" = "http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch" }
+ { "enabled" = "1" }
+ { "gpgcheck" = "1" }
+ { "gpgkey" = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora" }
+ { "gpgkey" = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY" }
+ { }
+ }
+ { "fedora-debuginfo"
+ { "name" = "Fedora $releasever - $basearch - Debug" }
+ { "failovermethod" = "priority" }
+ { }
+ { "mirrorlist" = "http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch" }
+ { "enabled" = "0" }
+ { "gpgcheck" = "1" }
+ { "gpgkey" = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora" }
+ { "gpgkey" = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY" }
+ { }
+ }
+ { "fedora-source"
+ { "name" = "Fedora $releasever - Source" }
+ { "failovermethod" = "priority" }
+ { }
+ { "mirrorlist" = "http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch" }
+ { "enabled" = "0" }
+ { "gpgcheck" = "1" }
+ { "gpgkey" = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora" }
+ { "gpgkey" = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY" }
+ }
+
+
+
+ test Yum.lns get yum_repo2 =
+ { "remi"
+ { "name" = "Les RPM de remi pour FC$releasever - $basearch" }
+ { "baseurl" = "http://remi.collet.free.fr/rpms/fc$releasever.$basearch/" }
+ { "baseurl" = "http://iut-info.ens.univ-reims.fr/remirpms/fc$releasever.$basearch/" }
+ { "enabled" = "0" }
+ { "gpgcheck" = "1" }
+ { "gpgkey" = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi" }
+ { }
+ }
+ { "remi-test"
+ { "name" = "Les RPM de remi en test pour FC$releasever - $basearch" }
+ { "baseurl" = "http://remi.collet.free.fr/rpms/test-fc$releasever.$basearch/" }
+ { "baseurl" = "http://iut-info.ens.univ-reims.fr/remirpms/test-fc$releasever.$basearch/" }
+ { "enabled" = "0" }
+ { "gpgcheck" = "1" }
+ { "gpgkey" = "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi" }
+ }
+
(* Local Variables: *)
(* mode: caml *)
(* End: *)
diff --git a/lenses/yum.aug b/lenses/yum.aug
index ebf537a..96836e1 100644
--- a/lenses/yum.aug
+++ b/lenses/yum.aug
@@ -17,7 +17,7 @@ module Yum =
(* define KEY_RE as /[A-Za-z0-9]+/ - "REM" - "rem" *)
let comment = [ del /([;#].*)?[ \t]*\n/ "\n" ]
- let list_sep = del /[ \t]*(,[ \t]*|\n[ \t]+)/ "\n\t"
+ let list_sep = del /([ \t]*(,[ \t]*|\n[ \t]+))|[ \t]+/ "\n\t"
let list_value = store /[^ \t\n,]+/
let kv_list(s:string) =
@@ -39,8 +39,13 @@ module Yum =
(* section (more precisely, yum will only obey one of them, but we act *)
(* as if yum would actually barf) *)
let section =
- let lists = kv_list "baseurl" | kv_list "gpgkey" in
- [ sechead . (entry* | entry* . lists . entry*)]
+ let list_baseurl = kv_list "baseurl" in
+ let list_gpgkey = kv_list "gpgkey" in
+ [ sechead . ( entry*
+ | entry* . list_baseurl . entry*
+ | entry* . list_gpgkey . entry*
+ | entry* . list_baseurl . entry* . list_gpgkey . entry*
+ | entry* . list_gpgkey . entry* . list_baseurl . entry*)]
let lns = (comment) * . (section) *
--
1.7.0.4
_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel