Add patches needed for rpms to correctly work without relinking

This commit is contained in:
Joshua Harlow 2012-11-09 14:28:37 -08:00
parent 57de43d83b
commit 537172e738
14 changed files with 253 additions and 2 deletions

View File

@ -62,10 +62,12 @@ class DependencyPackager(comp.Component):
path = sh.abspth(path)
if sh.isdir(path):
for c_path in sh.listdir(path, files_only=True):
if not c_path.endswith(".patch"):
continue
tgt_fn = sh.joinpths(self.build_paths['sources'], sh.basename(c_path))
sh.copy(c_path, tgt_fn)
your_patches.append(sh.basename(tgt_fn))
else:
elif path.endswith(".patch"):
tgt_fn = sh.joinpths(self.build_paths['sources'], sh.basename(path))
sh.copy(path, tgt_fn)
your_patches.append(sh.basename(tgt_fn))

View File

@ -31,6 +31,8 @@ def apply_patches(patch_files, working_dir):
apply_files = []
for p in patch_files:
p = sh.abspth(p)
if not p.endswith(".patch"):
continue
if not sh.isfile(p):
LOG.warn("Can not apply non-file patch %s", p)
apply_files.append(p)

View File

@ -20,6 +20,11 @@ db:
host: "$(db:host)"
port: "$(db:port)"
# Package time patches
patches:
package:
- "conf/patches/glance/"
# Interactions with keystone are via the following settings
paste_flavor: 'keystone'
keystone:

View File

@ -19,7 +19,12 @@ db:
user: "$(db:user)"
host: "$(db:host)"
port: "$(db:port)"
# Package time patches
patches:
package:
- "conf/patches/keystone/"
# Needed when running to setup the right roles/endpoints...
glance:
api_port: "$(glance:api_port)"

View File

@ -123,6 +123,11 @@ volume_group: nova-volumes
volume_name_postfix: "%08x"
volume_name_prefix: "volume-"
# Package time patches
patches:
package:
- "conf/patches/nova/"
# Needed for setting up your database
db:
type: "$(db:type)"

View File

@ -0,0 +1,6 @@
These patches help fix issues for the
current release or ensure that epel
packages can be brought in by openstack
code.
They can be used for other purposes as needed.

View File

@ -0,0 +1,39 @@
Crypto.Random was added in python-crypto-2.1.0 to replace
the problematic randpool in 2.0.1: http://www.pycrypto.org/randpool-broken
However on Linux os.urandom() should be fine to set IV.
I'm not sure it's necessary to pad with random bytes,
but I'm leaving that as is for now:
http://www.codekoala.com/blog/2009/aes-encryption-python-using-pycrypto/#comment-25921785
http://eli.thegreenplace.net/2010/06/25/aes-encryption-of-files-in-python-with-pycrypto/
diff -Naur glance-2012.1.orig/glance/common/crypt.py glance-2012.1/glance/common/crypt.py
--- glance-2012.1.orig/glance/common/crypt.py 2012-03-30 13:12:40.000000000 +0000
+++ glance-2012.1/glance/common/crypt.py 2012-04-09 01:46:38.244937150 +0000
@@ -21,10 +21,7 @@
"""
import base64
-
from Crypto.Cipher import AES
-from Crypto import Random
-from Crypto.Random import random
def urlsafe_encrypt(key, plaintext, blocksize=16):
@@ -41,13 +38,12 @@
Pads text to be encrypted
"""
pad_length = (blocksize - len(text) % blocksize)
- sr = random.StrongRandom()
- pad = ''.join(chr(sr.randint(1, 0xFF)) for i in range(pad_length - 1))
+ pad = os.urandom(pad_length - 1)
# We use chr(0) as a delimiter between text and padding
return text + chr(0) + pad
# random initial 16 bytes for CBC
- init_vector = Random.get_random_bytes(16)
+ init_vector = os.urandom(16)
cypher = AES.new(key, AES.MODE_CBC, init_vector)
padded = cypher.encrypt(pad(str(plaintext)))
return base64.urlsafe_b64encode(init_vector + padded)

View File

@ -0,0 +1,41 @@
Delve into pkg_resources a little to get it to modify sys.path,
so that our parallel installed egg takes precedence over the
system default module versions.
diff -up glance-2011.3/glance/__init__.py.newdeps glance-2011.3/glance/__init__.py
--- glance-2011.3/glance/__init__.py.newdeps 2012-01-06 17:22:36.000000000 +0000
+++ glance-2011.3/glance/__init__.py 2012-01-06 17:25:01.019063547 +0000
@@ -18,3 +18,31 @@
import gettext
gettext.install('glance', unicode=1)
+
+import sys
+import pkg_resources
+
+# If there is a conflicting non egg module,
+# i.e. an older standard system module installed,
+# then replace it with this requirement
+def replace_dist(requirement):
+ try:
+ return pkg_resources.require(requirement)
+ except pkg_resources.VersionConflict:
+ e = sys.exc_info()[1]
+ dist=e.args[0]
+ req=e.args[1]
+ if dist.key == req.key and not dist.location.endswith('.egg'):
+ del pkg_resources.working_set.by_key[dist.key]
+ # We assume there is no need to adjust sys.path
+ # and the associated pkg_resources.working_set.entries
+ return pkg_resources.require(requirement)
+
+replace_dist("SQLALchemy >= 0.6.3")
+replace_dist("WebOb >= 1.0")
+replace_dist("Routes >= 1.12.3")
+
+replace_dist("PasteDeploy >= 1.5.0")
+# This hack is needed because replace_dist() results in
+# the standard paste module path being at the start of __path__.
+# TODO: See can we get pkg_resources to do the right thing directly
+import paste
+paste.__path__.insert(0, paste.__path__.pop(-1))

View File

@ -0,0 +1,6 @@
These patches help fix issues for the
current release or ensure that epel
packages can be brought in by openstack
code.
They can be used for other purposes as needed.

View File

@ -0,0 +1,48 @@
--- keystone-2012.1/keystone/__init__.py.newdeps 2012-02-29 11:16:06.000000000 +0100
+++ keystone-2012.1/keystone/__init__.py 2012-03-01 22:42:08.546503618 +0100
@@ -0,0 +1,29 @@
+import sys
+import pkg_resources
+
+# If there is a conflicting non egg module,
+# i.e. an older standard system module installed,
+# then replace it with this requirement
+def replace_dist(requirement):
+ try:
+ return pkg_resources.require(requirement)
+ except pkg_resources.VersionConflict:
+ e = sys.exc_info()[1]
+ dist=e.args[0]
+ req=e.args[1]
+ if dist.key == req.key and not dist.location.endswith('.egg'):
+ del pkg_resources.working_set.by_key[dist.key]
+ # We assume there is no need to adjust sys.path
+ # and the associated pkg_resources.working_set.entries
+ return pkg_resources.require(requirement)
+
+replace_dist("WebOb >= 1.0")
+replace_dist("SQLAlchemy >= 0.6.3")
+replace_dist("Routes >= 1.12.3")
+
+replace_dist("PasteDeploy >= 1.5.0")
+# This hack is needed because replace_dist() results in
+# the standard paste module path being at the start of __path__.
+# TODO: See can we get pkg_resources to do the right thing directly
+import paste
+paste.__path__.insert(0, paste.__path__.pop(-1))
--- keystone-2012.1/bin/keystone-all.orig 2012-04-04 04:22:54.000000000 +0200
+++ keystone-2012.1/bin/keystone-all 2012-05-29 19:32:51.728668936 +0200
@@ -16,11 +16,11 @@
'__init__.py')):
sys.path.insert(0, possible_topdir)
-from paste import deploy
-
from keystone import config
from keystone.common import wsgi
+from paste import deploy
+
CONF = config.CONF

View File

@ -0,0 +1,6 @@
These patches help fix issues for the
current release or ensure that epel
packages can be brought in by openstack
code.
They can be used for other purposes as needed.

View File

@ -0,0 +1,41 @@
diff -Naur nova-2012.1.orig/nova/__init__.py nova-2012.1/nova/__init__.py
--- nova-2012.1.orig/nova/__init__.py 2012-04-25 10:16:25.104877188 +0000
+++ nova-2012.1/nova/__init__.py 2012-04-25 10:18:12.504028632 +0000
@@ -31,6 +31,37 @@
.. moduleauthor:: Andy Smith <andy@anarkystic.com>
"""
+import sys
+import pkg_resources
+
+# If there is a conflicting non egg module,
+# i.e. an older standard system module installed,
+# then replace it with this requirement
+def replace_dist(requirement):
+ try:
+ return pkg_resources.require(requirement)
+ except pkg_resources.VersionConflict:
+ e = sys.exc_info()[1]
+ dist=e.args[0]
+ req=e.args[1]
+ if dist.key == req.key and not dist.location.endswith('.egg'):
+ del pkg_resources.working_set.by_key[dist.key]
+ # We assume there is no need to adjust sys.path
+ # and the associated pkg_resources.working_set.entries
+ return pkg_resources.require(requirement)
+
+replace_dist("WebOb >= 1.0")
+replace_dist("SQLAlchemy >= 0.6.3")
+replace_dist("Routes >= 1.12.3")
+
+replace_dist("PasteDeploy >= 1.5.0")
+# This hack is needed because replace_dist() results in
+# the standard paste module path being at the start of __path__.
+# TODO: See can we get pkg_resources to do the right thing directly
+import paste
+paste.__path__.insert(0, paste.__path__.pop(-1))
+
+
import gettext
import logging

View File

@ -0,0 +1,6 @@
These patches help fix issues for the
current release or ensure that epel
packages can be brought in by openstack
code.
They can be used for other purposes as needed.

View File

@ -0,0 +1,39 @@
diff -Naur quantum-2012.1.orig/quantum/__init__.py quantum-2012.1/quantum/__init__.py
--- quantum-2012.1.orig/quantum/__init__.py 2012-04-25 12:30:18.110482493 +0000
+++ quantum-2012.1/quantum/__init__.py 2012-04-25 12:31:34.397515453 +0000
@@ -15,5 +15,35 @@
# License for the specific language governing permissions and limitations
# under the License.
+import sys
+import pkg_resources
+
+# If there is a conflicting non egg module,
+# i.e. an older standard system module installed,
+# then replace it with this requirement
+def replace_dist(requirement):
+ try:
+ return pkg_resources.require(requirement)
+ except pkg_resources.VersionConflict:
+ e = sys.exc_info()[1]
+ dist=e.args[0]
+ req=e.args[1]
+ if dist.key == req.key and not dist.location.endswith('.egg'):
+ del pkg_resources.working_set.by_key[dist.key]
+ # We assume there is no need to adjust sys.path
+ # and the associated pkg_resources.working_set.entries
+ return pkg_resources.require(requirement)
+
+replace_dist("WebOb >= 1.0")
+replace_dist("SQLAlchemy >= 0.6.3")
+replace_dist("Routes >= 1.12.3")
+
+replace_dist("PasteDeploy >= 1.5.0")
+# This hack is needed because replace_dist() results in
+# the standard paste module path being at the start of __path__.
+# TODO: See can we get pkg_resources to do the right thing directly
+import paste
+paste.__path__.insert(0, paste.__path__.pop(-1))
+
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)