[freeipa/f17] Fix index task upgrade

Martin Kosek mkosek at fedoraproject.org
Wed Nov 14 07:45:11 UTC 2012


commit 87b4693b8bc3ce45c88807ceaad073a033b8e25a
Author: Martin Kosek <mkosek at redhat.com>
Date:   Wed Nov 14 08:43:18 2012 +0100

    Fix index task upgrade
    
    Added patch to run index task also for new indexes (like fqdn). See
    https://fedorahosted.org/freeipa/ticket/3253 for reference.

 0001-run-index-task-for-new-indexes.patch |   43 +++++++++++++++++++++++++++++
 freeipa.spec                              |   24 +++++++++++++++-
 2 files changed, 66 insertions(+), 1 deletions(-)
---
diff --git a/0001-run-index-task-for-new-indexes.patch b/0001-run-index-task-for-new-indexes.patch
new file mode 100644
index 0000000..659ec44
--- /dev/null
+++ b/0001-run-index-task-for-new-indexes.patch
@@ -0,0 +1,43 @@
+From 5781483a30a87a52cb4f9e98ca95708f8d3f14c3 Mon Sep 17 00:00:00 2001
+From: Martin Kosek <mkosek at redhat.com>
+Date: Tue, 13 Nov 2012 17:14:13 +0100
+Subject: [PATCH] Run index task for new indexes
+
+Index task need to be run for both index updates and new indexes,
+otherwise some current values may not be indexed and could cause
+issues when searching LDAP (like fqdn did).
+
+https://fedorahosted.org/freeipa/ticket/3253
+---
+ ipaserver/install/ldapupdate.py | 13 ++++++++-----
+ 1 file changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
+index 90b3691a8595f952f9064d5cccb2523bd08426be..036a5e108718a754ec5cbfa2164976aac3880e94 100644
+--- a/ipaserver/install/ldapupdate.py
++++ b/ipaserver/install/ldapupdate.py
+@@ -678,13 +678,16 @@ class LDAPUpdate:
+                 root_logger.error("Update failed: %s", e)
+                 updated = False
+ 
+-            if ("cn=index" in entry.dn and
+-                "cn=userRoot" in entry.dn):
+-                taskid = self.create_index_task(entry.cn)
+-                self.monitor_index_task(taskid)
+-
+             if updated:
+                 self.modified = True
++
++        # Always run the index task for both new and updated indexes
++        # See https://fedorahosted.org/freeipa/ticket/3253 for related issue
++        if entry.dn.endswith('cn=index,cn=userRoot,cn=ldbm database,'
++                             'cn=plugins,cn=config'):
++            taskid = self.create_index_task(entry.cn)
++            self.monitor_index_task(taskid)
++
+         return
+ 
+     def __delete_record(self, updates):
+-- 
+1.7.11.7
+
diff --git a/freeipa.spec b/freeipa.spec
index 955ad75..d875d82 100644
--- a/freeipa.spec
+++ b/freeipa.spec
@@ -14,7 +14,7 @@ distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
 
 Name:           freeipa
 Version:        2.2.1
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        The Identity, Policy and Audit system
 
 Group:          System Environment/Base
@@ -23,6 +23,8 @@ URL:            http://www.freeipa.org/
 Source0:        http://www.freeipa.org/downloads/src/freeipa-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+Patch0:         0001-run-index-task-for-new-indexes.patch
+
 %if ! %{ONLY_CLIENT}
 BuildRequires:  389-ds-base-devel >= 1.2.10.4
 BuildRequires:  svrcore-devel
@@ -225,8 +227,28 @@ package.
 
 
 %prep
+# Update timestamps on the files touched by a patch, to avoid non-equal
+# .pyc/.pyo files across the multilib peers within a build, where "Level"
+# is the patch prefix option (e.g. -p1)
+# Taken from specfile for sssd and python-simplejson
+UpdateTimestamps() {
+  Level=$1
+  PatchFile=$2
+
+  # Locate the affected files:
+  for f in $(diffstat $Level -l $PatchFile); do
+    # Set the files to have the same timestamp as that of the patch:
+    touch -r $PatchFile $f
+  done
+}
+
 %setup -n freeipa-%{version} -q
 
+for p in %patches ; do
+    %__patch -p1 -i $p
+    UpdateTimestamps -p1 $p
+done
+
 %build
 export CFLAGS="$CFLAGS %{optflags}"
 export CPPFLAGS="$CPPFLAGS %{optflags}"


More information about the scm-commits mailing list