diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2012-02-10 12:04:27 -0500 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2012-02-10 12:04:27 -0500 |
commit | 028a05e79467e0c1fd7d63224fb447a964ab7a0b (patch) | |
tree | 1b06f4bfc24984d12112562f073fd8d5f0ca2d86 | |
parent | d7f123ab526df7dbef153e0de71f325ab1b69571 (diff) |
Use wildcards instead of many version-specific lib names on Linux.
viewer_manifest.py's Linux_i686Manifest class has contained directives to copy
library files with names like (e.g.) "libapr-1.so.0.4.2", which means that
every update to any such library requires messing with viewer_manifest.py.
But LLManifest.path() claims to support wildcards, and it's more robust to
specify "libapr-1.so*" instead.
Unfortunately LLManifest.path()'s wildcard support only used to work for files
in the source tree (vs. the artwork tree or the build tree). The logic in
path() tries each tree in turn, relying on an exception to make it try the
next tree. This exception was raised for a nonexistent specific filename --
but it never used to raise that exception for a wildcard matching 0 files.
Instead it would simply report "0 files" and proceed, producing an invalid
viewer install.
Raise that exception for a wildcard matching nothing. This forces path() to
consider the artwork tree and the build tree, permitting us to use wildcards
in library names.
Define an exception specific to LLManifest: ManifestException rather than the
generic Python RuntimeException. Make it a subclass of RuntimeException so any
existing callers expecting to catch RuntimeException will continue to work.
-rw-r--r-- | indra/lib/python/indra/util/llmanifest.py | 27 | ||||
-rwxr-xr-x | indra/newview/viewer_manifest.py | 42 |
2 files changed, 32 insertions, 37 deletions
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index c33a03034a..237153b756 100644 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -41,6 +41,9 @@ import tarfile import errno import subprocess +class ManifestError(RuntimeError): + pass + def path_ancestors(path): drive, path = os.path.splitdrive(os.path.normpath(path)) result = [] @@ -180,6 +183,9 @@ def usage(srctree=""): arg['description'] % nd) def main(): +## import itertools +## print ' '.join((("'%s'" % item) if ' ' in item else item) +## for item in itertools.chain([sys.executable], sys.argv)) option_names = [arg['name'] + '=' for arg in ARGUMENTS] option_names.append('help') options, remainder = getopt.getopt(sys.argv[1:], "", option_names) @@ -385,7 +391,7 @@ class LLManifest(object): child.stdout.close() status = child.wait() if status: - raise RuntimeError( + raise ManifestError( "Command %s returned non-zero status (%s) \noutput:\n%s" % (command, status, output) ) return output @@ -395,7 +401,7 @@ class LLManifest(object): a) verify that you really have created it b) schedule it for cleanup""" if not os.path.exists(path): - raise RuntimeError, "Should be something at path " + path + raise ManifestError, "Should be something at path " + path self.created_paths.append(path) def put_in_file(self, contents, dst): @@ -550,7 +556,7 @@ class LLManifest(object): except (IOError, os.error), why: errors.append((srcname, dstname, why)) if errors: - raise RuntimeError, errors + raise ManifestError, errors def cmakedirs(self, path): @@ -598,13 +604,16 @@ class LLManifest(object): def check_file_exists(self, path): if not os.path.exists(path) and not os.path.islink(path): - raise RuntimeError("Path %s doesn't exist" % ( - os.path.normpath(os.path.join(os.getcwd(), path)),)) + raise ManifestError("Path %s doesn't exist" % (os.path.abspath(path),)) - wildcard_pattern = re.compile('\*') + wildcard_pattern = re.compile(r'\*') def expand_globs(self, src, dst): src_list = glob.glob(src) + # Assume that if caller specifies a wildcard, s/he wants it to match + # at least one file... + if not src_list: + raise ManifestError("Path %s doesn't exist" % (os.path.abspath(src),)) src_re, d_template = self.wildcard_regex(src.replace('\\', '/'), dst.replace('\\', '/')) for s in src_list: @@ -615,7 +624,7 @@ class LLManifest(object): sys.stdout.write("Processing %s => %s ... " % (src, dst)) sys.stdout.flush() if src == None: - raise RuntimeError("No source file, dst is " + dst) + raise ManifestError("No source file, dst is " + dst) if dst == None: dst = src dst = os.path.join(self.get_dst_prefix(), dst) @@ -639,10 +648,10 @@ class LLManifest(object): return count try: count = try_path(os.path.join(self.get_src_prefix(), src)) - except RuntimeError: + except ManifestError: try: count = try_path(os.path.join(self.get_artwork_prefix(), src)) - except RuntimeError: + except ManifestError: count = try_path(os.path.join(self.get_build_prefix(), src)) print "%d files" % count diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 0931c4ec9b..d65d51ce32 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -1025,41 +1025,27 @@ class Linux_i686Manifest(LinuxManifest): super(Linux_i686Manifest, self).construct() if self.prefix("../packages/lib/release", dst="lib"): - self.path("libapr-1.so") - self.path("libapr-1.so.0") - self.path("libapr-1.so.0.4.2") - self.path("libaprutil-1.so") - self.path("libaprutil-1.so.0") - self.path("libaprutil-1.so.0.3.10") - self.path("libbreakpad_client.so.0.0.0") - self.path("libbreakpad_client.so.0") - self.path("libbreakpad_client.so") + self.path("libapr-1.so*") + self.path("libaprutil-1.so*") + self.path("libbreakpad_client.so*") self.path("libcollada14dom.so") - self.path("libdb-5.1.so") - self.path("libdb-5.so") - self.path("libdb.so") - self.path("libcrypto.so.1.0.0") - self.path("libexpat.so.1.5.2") + self.path("libdb*.so") + self.path("libcrypto.so.*") + self.path("libexpat.so.*") self.path("libssl.so.1.0.0") self.path("libglod.so") self.path("libminizip.so") - self.path("libuuid.so") - self.path("libuuid.so.16") - self.path("libuuid.so.16.0.22") - self.path("libSDL-1.2.so.0.11.3") - self.path("libdirectfb-1.4.so.5.0.4") - self.path("libfusion-1.4.so.5.0.4") - self.path("libdirect-1.4.so.5.0.4") - self.path("libopenjpeg.so.1.4.0") - self.path("libopenjpeg.so.1") - self.path("libopenjpeg.so") + self.path("libuuid.so*") + self.path("libSDL-1.2.so.*") + self.path("libdirectfb-1.*.so.*") + self.path("libfusion-1.*.so.*") + self.path("libdirect-1.*.so.*") + self.path("libopenjpeg.so*") self.path("libalut.so") self.path("libopenal.so", "libopenal.so.1") self.path("libopenal.so", "libvivoxoal.so.1") # vivox's sdk expects this soname - self.path("libfontconfig.so.1.4.4") - self.path("libtcmalloc.so", "libtcmalloc.so") #formerly called google perf tools - self.path("libtcmalloc.so.0", "libtcmalloc.so.0") #formerly called google perf tools - self.path("libtcmalloc.so.0.1.0", "libtcmalloc.so.0.1.0") #formerly called google perf tools + self.path("libfontconfig.so.*") + self.path("libtcmalloc.so*") #formerly called google perf tools try: self.path("libfmod-3.75.so") pass |