Fix rhel6 relinking and remove install of src-rpms, not needed anymore

This commit is contained in:
Joshua Harlow
2012-08-17 19:32:22 -07:00
parent d7155425e9
commit f53b1890b3
3 changed files with 46 additions and 64 deletions

View File

@@ -19,6 +19,7 @@
Platform-specific logic for RedHat Enterprise Linux components.
"""
import glob
import re
from anvil import colorizer
@@ -166,28 +167,29 @@ class YumPackagerWithRelinks(yum.YumPackager):
def _remove(self, pkg):
response = yum.YumPackager._remove(self, pkg)
if response:
options = pkg.get('packager_options', {})
links = options.get('links', [])
options = pkg.get('packager_options') or {}
links = options.get('links') or []
for entry in links:
src = entry['source']
tgt = entry['target']
if sh.islink(tgt):
sh.unlink(tgt)
if sh.islink(entry['target']):
sh.unlink(entry['target'])
return response
def _install(self, pkg):
yum.YumPackager._install(self, pkg)
options = pkg.get('packager_options', {})
links = options.get('links', [])
options = pkg.get('packager_options') or {}
links = options.get('links') or []
for entry in links:
src = entry['source']
tgt = entry['target']
tgt = entry.get('target')
src = entry.get('source')
if not tgt or not src:
continue
src = glob.glob(src)
if len(src) == 0:
continue
elif len(src) != 1:
raise RuntimeError("Unable to link multiple sources %s to a single location %s" % (src, tgt))
else:
src = src[0]
if not sh.islink(tgt):
# This is actually a feature, EPEL must not conflict
# with RHEL, so X pkg installs newer version in
# parallel.
#
# This of course doesn't work when running from git
# like anvil does....
sh.symlink(src, tgt)
return True

View File

@@ -57,45 +57,6 @@ class YumPackager(pack.Packager):
def _install_special(self, name, info):
return False
# Return True if package has already been (yum) installed
def _is_installed(self, package, **kargs):
full_cmd = YUM_CMD + YUM_LIST_INSTALLED + [package]
(out_str, err_str) = sh.execute(*full_cmd, ignore_exit_code=True, **kargs)
if err_str == '':
LOG.debug("%r is already installed", package)
return True
LOG.debug("%r hasn't yet been installed", package)
return False
# Get and do a yum install of the specified rpm
# if it hasn't yet been installed.
# Assume that rpm value is full path on node or a URL.
def _install_src_rpm(self, rpm):
filename = sh.basename(rpm)
if not filename:
LOG.error("Cannot determine file name from rpm: %r", rpm)
return False
(package, ext) = os.path.splitext(filename)
if not package:
LOG.error("Cannot determine package name from rpm: %r", rpm)
return False
if self._is_installed(package):
return True
with utils.tempdir() as tdir:
if not sh.exists(rpm):
(fetched_filen, bytes_down) = downloader.UrlLibDownloader(rpm, sh.joinpths(tdir, filename)).download()
LOG.debug("For url %s, we downloaded %s bytes to %s", rpm, bytes_down, fetched_filen)
# RLOO, do we want to catch any exceptions?
else:
fetched_filen = rpm
cmd = YUM_INSTALL + ["--nogpgcheck", fetched_filen]
self._execute_yum(cmd)
return True
def _remove_src_rpm(self, rpm):
filename = sh.basename(rpm)
if not filename:
@@ -112,11 +73,6 @@ class YumPackager(pack.Packager):
def _install(self, pkg):
name = pkg['name']
source_rpm = pkg.get("source-rpm")
if source_rpm:
self._install_src_rpm(source_rpm)
if self._install_special(name, pkg):
return
else:
@@ -125,10 +81,6 @@ class YumPackager(pack.Packager):
self._execute_yum(cmd)
def _remove(self, pkg):
source_rpm = pkg.get("source-rpm")
if source_rpm:
self._remove_src_rpm(source_rpm)
name = pkg['name']
if self._remove_special(name, pkg):
return True

View File

@@ -144,12 +144,22 @@ components:
- name: nose
package:
name: python-nose1.1
packager_name: anvil.distros.rhel:YumPackagerWithRelinks
packager_options:
links:
- source: "/usr/lib/python2.6/site-packages/nose-1*-py2.6.egg/nose"
target: "/usr/lib/python2.6/site-packages/nose"
- name: paste
package:
name: python-paste
- name: pastedeploy
package:
name: python-paste-deploy1.5
packager_name: anvil.distros.rhel:YumPackagerWithRelinks
packager_options:
links:
- source: "/usr/lib/python2.6/site-packages/PasteDeploy-1.5*-py2.6.egg/paste/deploy"
target: "/usr/lib/python2.6/site-packages/paste/deploy"
- name: pep8
package:
name: python-pep8
@@ -159,12 +169,22 @@ components:
- name: routes
package:
name: python-routes1.12
packager_name: anvil.distros.rhel:YumPackagerWithRelinks
packager_options:
links:
- source: "/usr/lib/python2.6/site-packages/Routes-1.*-py2.6.egg/routes"
target: "/usr/lib/python2.6/site-packages/routes"
- name: simplejson
package:
name: python-simplejson
- name: sqlalchemy
package:
name: python-sqlalchemy0.7
packager_name: anvil.distros.rhel:YumPackagerWithRelinks
packager_options:
links:
- source: "/usr/lib64/python2.6/site-packages/SQLAlchemy-0.*.egg/sqlalchemy"
target: "/usr/lib/python2.6/site-packages/sqlalchemy"
- name: unittest2
package:
name: python-unittest2
@@ -174,6 +194,14 @@ components:
- name: webob
package:
name: python-webob1.0
# Need to relink it so that it will work without modifications
# Since new packages in rhel must never use the same names
# as previous ones (this overrides that)
packager_name: anvil.distros.rhel:YumPackagerWithRelinks
packager_options:
links:
- source: "/usr/lib/python2.6/site-packages/WebOb-*-py2.6.egg/webob/"
target: "/usr/lib/python2.6/site-packages/webob"
pips:
# Pips that aren't packages yet (or versions aren't right...)
- name: coverage