From 7c5b611b1699774f4a86211a03e9cb15b8ad0d76 Mon Sep 17 00:00:00 2001 From: Aleric Inglewood Date: Sun, 10 Oct 2010 15:45:25 +0200 Subject: RED-429: Additional fixes. This patch fixes the regression that you couldn't run 'scripts/install.py' anymore from linden/ when installing a prebuilt package. It also adds support for --dry-run: still printing what symlinks are missing when that options is used without actually adding the symlinks. Finally, the added symlinks are now added to the 'files' section in install.xml so that they are also removed again when you uninstall the package. --- linden/scripts/install.py | 51 +++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/linden/scripts/install.py b/linden/scripts/install.py index 69f0c64..a16034f 100755 --- a/linden/scripts/install.py +++ b/linden/scripts/install.py @@ -564,40 +564,43 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" tar.extractall(path=install_dir) except AttributeError: _extractall(tar, path=install_dir) - if _get_platform() == 'linux' or _get_platform() == 'linux64': - first = 1 - for tfile in tar.getnames(): - if tfile.find('.so.') > 0: - LINK = re.sub(r'\.so\.[0-9.]*$', '.so', tfile) - link_name = "../" + LINK - if not os.path.exists(link_name): - if first == 1: - first = 0 - print "Adding missing symlink(s) for package %s:" % ifile.filename - target = os.path.basename(tfile) - soname = os.popen("readelf -d \"../%(tfile)s\" " - " | grep SONAME " - " | sed -e 's/.*\[//;s/\].*//'" % {"tfile": tfile}).read() - soname = soname.strip() - if soname: # not empty - tmpfname = os.path.dirname(LINK) + "/" + soname - if os.path.exists("../" + tmpfname): - target = soname - else: - print "WARNING: SONAME %s doesn't exist!" % tmpfname + symlinks = [] + if _get_platform() == 'linux' or _get_platform() == 'linux64': + first = 1 + for tfile in tar.getnames(): + if tfile.find('.so.') > 0: + LINK = re.sub(r'\.so\.[0-9.]*$', '.so', tfile) + link_name = install_dir + "/" + LINK + if not os.path.exists(link_name): + if first == 1: + first = 0 + print "Adding missing symlink(s) for package %s:" % ifile.filename + target = os.path.basename(tfile) + soname = os.popen("readelf -d \"%(install_dir)s/%(tfile)s\" %(stderr_redirect)s" + " | grep SONAME | sed -e 's/.*\[//;s/\].*//'" % + {"install_dir": install_dir, "tfile": tfile, "stderr_redirect": ("2>/dev/null" if self._dryrun else "")}).read() + soname = soname.strip() + if soname: # not empty + tmpfname = os.path.dirname(LINK) + "/" + soname + if os.path.exists(install_dir + "/" + tmpfname): + target = soname + else: + print "WARNING: SONAME %s doesn't exist!" % tmpfname + if not self._dryrun: os.symlink(target, link_name) - print " %s --> %s" % (LINK, target) + symlinks += [LINK] + print " %s --> %s" % (LINK, target) if ifile.pkgname in self._installed: self._installed[ifile.pkgname].add_files( ifile.url, - tar.getnames()) + tar.getnames() + symlinks) self._installed[ifile.pkgname].set_md5sum( ifile.url, ifile.md5sum) else: # *HACK: this understands the installed package syntax. definition = { ifile.url : - {'files': tar.getnames(), + {'files': tar.getnames() + symlinks, 'md5sum' : ifile.md5sum } } self._installed[ifile.pkgname] = InstalledPackage(definition) self._installed_changed = True -- cgit v1.1