[mongodb] add patch to address building on older python

Nathaniel McCallum npmccallum at fedoraproject.org
Tue Jan 17 15:22:17 UTC 2012


commit ab1b77cb2ba22a184f3389b0614b6730f2406d82
Author: Nathaniel McCallum <nathaniel at themccallums.org>
Date:   Tue Jan 17 10:22:14 2012 -0500

    add patch to address building on older python

 mongodb-fix-oldpython.patch |   91 +++++++++++++++++++++++++++++++++++++++++++
 mongodb.spec                |    8 +++-
 2 files changed, 98 insertions(+), 1 deletions(-)
---
diff --git a/mongodb-fix-oldpython.patch b/mongodb-fix-oldpython.patch
new file mode 100644
index 0000000..a2421c3
--- /dev/null
+++ b/mongodb-fix-oldpython.patch
@@ -0,0 +1,91 @@
+diff -Nru mongodb-src-r2.0.2.orig/buildscripts/cleanbb.py mongodb-src-r2.0.2/buildscripts/cleanbb.py
+--- mongodb-src-r2.0.2.orig/buildscripts/cleanbb.py	2011-12-14 12:18:48.000000000 -0500
++++ mongodb-src-r2.0.2/buildscripts/cleanbb.py	2012-01-17 10:01:49.869497812 -0500
+@@ -7,7 +7,7 @@
+ 
+ cwd = os.getcwd();
+ if cwd.find("buildscripts" ) > 0 :
+-    cwd = cwd.partition( "buildscripts" )[0]
++    cwd = cwd.split( "buildscripts" , 1 )[0]
+ 
+ print( "cwd [" + cwd + "]" )
+ 
+@@ -38,7 +38,7 @@
+         if not shouldKill( x ):
+             continue
+         
+-        pid = x.partition( " " )[0]
++        pid = x.split( " " , 1 )[0]
+         print( "killing: " + x )
+         utils.execsys( "/bin/kill " + signal + " " +  pid )
+         killed = killed + 1
+diff -Nru mongodb-src-r2.0.2.orig/buildscripts/errorcodes.py mongodb-src-r2.0.2/buildscripts/errorcodes.py
+--- mongodb-src-r2.0.2.orig/buildscripts/errorcodes.py	2011-12-14 12:18:48.000000000 -0500
++++ mongodb-src-r2.0.2/buildscripts/errorcodes.py	2012-01-17 10:00:46.550588915 -0500
+@@ -16,11 +16,11 @@
+             didAnything = False
+             fixed = ""
+             for line in open( x ):
+-                s = line.partition( root + "(" )
+-                if s[1] == "" or line.startswith( "#define " + root):
++                s = line.split( root + "(" , 1 )
++                if not root + "(" in line or line.startswith( "#define " + root):
+                     fixed += line
+                     continue
+-                fixed += s[0] + root + "( " + str( cur ) + " , " + s[2]
++                fixed += s[0] + root + "( " + str( cur ) + " , " + s[1]
+                 cur = cur + 1
+                 didAnything = True
+             if didAnything:
+@@ -104,13 +104,13 @@
+     return len( errors ) == 0 
+ 
+ def getBestMessage( err , start ):
+-    err = err.partition( start )[2]
++    err = (err.split( start , 1 ) + [""])[1]
+     if not err:
+         return ""
+-    err = err.partition( "\"" )[2]
++    err = (err.split( "\"" , 1 ) + [""])[1]
+     if not err:
+         return ""
+-    err = err.rpartition( "\"" )[0]
++    err = err.split( "\"" , 1 )[0]
+     if not err:
+         return ""
+     return err
+diff -Nru mongodb-src-r2.0.2.orig/SConstruct mongodb-src-r2.0.2/SConstruct
+--- mongodb-src-r2.0.2.orig/SConstruct	2011-12-14 12:18:48.000000000 -0500
++++ mongodb-src-r2.0.2/SConstruct	2012-01-17 09:45:35.079916231 -0500
+@@ -38,7 +38,7 @@
+         if not x.endswith( ".py" ) or x.find( "#" ) >= 0:
+             continue
+          
+-        lst.append( x.rpartition( "." )[0] )
++        lst.append( x.rsplit( "." , 1 )[0] )
+     return lst
+ 
+ 
+@@ -1480,7 +1480,7 @@
+ if installSetup.clientSrc:
+     for x in allClientFiles:
+         x = str(x)
+-        env.Install( installDir + "/mongo/" + x.rpartition( "/" )[0] , x )
++        env.Install( installDir + "/mongo/" + x.rsplit( "/" , 1 )[0] , x )
+ 
+ #lib
+ if installSetup.libraries:
+@@ -1559,11 +1559,10 @@
+         remoteName = localName
+ 
+     if fixName:
+-        (root,dot,suffix) = localName.rpartition( "." )
+         name = remoteName + "-" + getSystemInstallName()
+         name += remotePrefix
+-        if dot == "." :
+-            name += "." + suffix
++        if "." in localName :
++            name += "." + localName.rsplit( "." , 1 )[1]
+         name = name.lower()
+     else:
+         name = remoteName
diff --git a/mongodb.spec b/mongodb.spec
index 247a037..b8ce0f4 100644
--- a/mongodb.spec
+++ b/mongodb.spec
@@ -5,7 +5,7 @@
 
 Name:           mongodb
 Version:        2.0.2
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        High-performance, schema-free document-oriented database
 Group:          Applications/Databases
 License:        AGPLv3 and zlib and ASL 2.0
@@ -27,6 +27,8 @@ Patch2:         mongodb-fix-fork.patch
 Patch3:         mongodb-fix-pcre.patch
 # https://github.com/mongodb/mongo/pull/160
 Patch4:         mongodb-src-r2.0.2-js.patch
+# https://jira.mongodb.org/browse/SERVER-4591
+Patch5:         mongodb-fix-oldpython.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  python-devel
@@ -111,6 +113,7 @@ software, default configuration files, and init scripts.
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
 
 # spurious permissions
 chmod -x README
@@ -264,6 +267,9 @@ fi
 %{_includedir}/mongo
 
 %changelog
+* Tue Jan 17 2012 Nathaniel McCallum <nathaniel at natemccallum.com> - 2.0.2-4
+- Patch buildsystem for building on older pythons (RHEL5)
+
 * Mon Jan 16 2012 Nathaniel McCallum <nathaniel at natemccallum.com> - 2.0.2-3
 - Merge the 2.0.2 spec file with EPEL
 - Merge mongodb-sm-pkgconfig.patch into mongodb-src-r2.0.2-js.patch


More information about the scm-commits mailing list