From b7ac6c6b537fe144f2f9b01d04c3c87103bad548 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Mon, 24 Jun 2013 16:49:47 -0400 Subject: CHOP-955, CHOP-957: Platform-specific switches files => settings_install.xml. Instead of generating viewer command-line switch overrides into the Windows shortcut, an arguments.txt file on Mac, or a gridargs.dat file on Linux, generate a platform-independent settings_install.xml file containing 'sourceid' key (if 'sourceid' found in TeamCity environment variables). All command-line override switches previously found in the aforementioned files have happily become moot. --- indra/newview/viewer_manifest.py | 76 +++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 33 deletions(-) (limited to 'indra/newview/viewer_manifest.py') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 35451c9621..eb2cd73cc9 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -34,9 +34,13 @@ import tarfile import time import random viewer_dir = os.path.dirname(__file__) -# add llmanifest library to our path so we don't have to muck with PYTHONPATH -sys.path.append(os.path.join(viewer_dir, '../lib/python/indra/util')) -from llmanifest import LLManifest, main, proper_windows_path, path_ancestors +# add indra/lib/python to our path so we don't have to muck with PYTHONPATH +sys.path.append(os.path.join(viewer_dir, os.pardir, "lib", "python")) +from indra.util.llmanifest import LLManifest, main, proper_windows_path, path_ancestors +try: + from llbase import llsd +except ImportError: + from indra.base import llsd class ViewerManifest(LLManifest): def is_packaging_viewer(self): @@ -99,6 +103,21 @@ class ViewerManifest(LLManifest): self.path("dictionaries") self.end_prefix(pkgdir) + # CHOP-955: If we have "sourceid" in the build process + # environment, generate it into settings_install.xml. + try: + sourceid = os.environ["sourceid"] + except KeyError: + # no sourceid, no settings_install.xml file + pass + else: + # Single-entry subset of the LLSD content of settings.xml + content = dict(sourceid=dict(Comment='Identify referring agency to Linden web servers', + Persist=1, + Type='String', + Value=sourceid)) + self.put_in_file(llsd.format_pretty_xml(content), "settings_install.xml") + self.end_prefix("app_settings") if self.prefix(src="character"): @@ -196,24 +215,26 @@ class ViewerManifest(LLManifest): """ Convenience function that returns the command-line flags for the grid""" - # Set command line flags relating to the target grid - grid_flags = '' - if not self.default_grid(): - grid_flags = "--grid %(grid)s "\ - "--helperuri http://preview-%(grid)s.secondlife.com/helpers/" %\ - {'grid':self.grid()} - - # Deal with settings - setting_flags = '' - if not self.default_channel() or not self.default_grid(): - if self.default_grid(): - setting_flags = '--settings settings_%s.xml'\ - % self.channel_lowerword() - else: - setting_flags = '--settings settings_%s_%s.xml'\ - % (self.grid(), self.channel_lowerword()) - - return " ".join((grid_flags, setting_flags)).strip() + # The original role of this method seems to have been to build a + # grid-specific viewer: one that would, on launch, preselect a + # particular grid. (Apparently that dates back to when the protocol + # between viewer and simulator required them to be updated in + # lockstep, so that "the beta grid" required "a beta viewer.") But + # those viewer command-line switches no longer work without tweaking + # user_settings/grids.xml. In fact, going forward, it's unclear what + # use case that would address. + + # This method also set a channel-specific (or grid-and-channel- + # specific) user_settings/settings_something.xml file. It has become + # clear that saving user settings in a channel-specific file causes + # more problems (confusion) than it solves, so we've discontinued that. + + # In fact we now avoid forcing viewer command-line switches at all, + # instead introducing a settings_install.xml file. Command-line + # switches don't aggregate well; for instance the generated --channel + # switch actually prevented the user specifying --channel on the + # command line. Settings files have well-defined override semantics. + return None def extract_names(self,src): try: @@ -529,8 +550,7 @@ class WindowsManifest(ViewerManifest): 'final_exe' : self.final_exe(), 'grid':self.args['grid'], 'grid_caps':self.args['grid'].upper(), - # escape quotes becase NSIS doesn't handle them well - 'flags':self.flags_list().replace('"', '$\\"'), + 'flags':'', 'channel':self.channel(), 'channel_oneword':self.channel_oneword(), 'channel_unique':self.channel_unique(), @@ -757,9 +777,6 @@ class DarwinManifest(ViewerManifest): self.end_prefix("llplugin") - # command line arguments for connecting to the proper grid - self.put_in_file(self.flags_list(), 'arguments.txt') - self.end_prefix("Resources") self.end_prefix("Contents") @@ -805,10 +822,6 @@ class DarwinManifest(ViewerManifest): 'bundle': self.get_dst_prefix() }) - channel_standin = 'Second Life Viewer' # hah, our default channel is not usable on its own - if not self.default_channel(): - channel_standin = self.channel() - imagename="SecondLife_" + '_'.join(self.args['version']) # MBW -- If the mounted volume name changes, it breaks the .DS_Store's background image and icon positioning. @@ -926,9 +939,6 @@ class LinuxManifest(ViewerManifest): self.path("install.sh") self.end_prefix("linux_tools") - # Create an appropriate gridargs.dat for this package, denoting required grid. - self.put_in_file(self.flags_list(), 'etc/gridargs.dat') - if self.prefix(src="", dst="bin"): self.path("secondlife-bin","do-not-directly-run-secondlife-bin") self.path("../linux_crash_logger/linux-crash-logger","linux-crash-logger.bin") -- cgit v1.2.3 From e060f7a6e529d0ef83106db85969a2d047a2247a Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Thu, 27 Jun 2013 12:50:06 -0400 Subject: CHOP-955, CHOP-957: Prioritize indra.util.llmanifest in same source repo. It seems that certain build hosts have an (obsolete? broken?) install of indra.util.llmanifest under the system Python. If we append the local repo indra/lib/python to sys.path, viewer_manifest.py pulls in the broken llmanifest. Prepend to sys.path instead to ensure we get the right one. --- indra/newview/viewer_manifest.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/viewer_manifest.py') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index eb2cd73cc9..1429fe4c7a 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -34,8 +34,10 @@ import tarfile import time import random viewer_dir = os.path.dirname(__file__) -# add indra/lib/python to our path so we don't have to muck with PYTHONPATH -sys.path.append(os.path.join(viewer_dir, os.pardir, "lib", "python")) +# Add indra/lib/python to our path so we don't have to muck with PYTHONPATH. +# Put it FIRST because some of our build hosts have an ancient install of +# indra.util.llmanifest under their system Python! +sys.path.insert(0, os.path.join(viewer_dir, os.pardir, "lib", "python")) from indra.util.llmanifest import LLManifest, main, proper_windows_path, path_ancestors try: from llbase import llsd -- cgit v1.2.3 From 10c8fbbedbee07355f71ef206c50957a422d7ccf Mon Sep 17 00:00:00 2001 From: JJ Linden Date: Wed, 24 Jul 2013 14:38:23 -0700 Subject: added default sourceid and check that sourceid is not blank, hoping to get the windows builds to recognize the value --- indra/newview/viewer_manifest.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'indra/newview/viewer_manifest.py') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 206f81cdc2..827a8f44c3 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -113,12 +113,14 @@ class ViewerManifest(LLManifest): # no sourceid, no settings_install.xml file pass else: - # Single-entry subset of the LLSD content of settings.xml - content = dict(sourceid=dict(Comment='Identify referring agency to Linden web servers', - Persist=1, - Type='String', - Value=sourceid)) - self.put_in_file(llsd.format_pretty_xml(content), "settings_install.xml") + if len(sourceid) > 0: + print "Using sourceid: " + sourceid + # Single-entry subset of the LLSD content of settings.xml + content = dict(sourceid=dict(Comment='Identify referring agency to Linden web servers', + Persist=1, + Type='String', + Value=sourceid)) + self.put_in_file(llsd.format_pretty_xml(content), "settings_install.xml") self.end_prefix("app_settings") -- cgit v1.2.3 From a207b24d331539e16bd66ca09df3c585529c99f0 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Fri, 26 Jul 2013 10:42:13 -0400 Subject: CHOP-955: Include app_settings/settings_install.xml in file_list. viewer_manifest.py uses its base-class llmanifest.LLManifest.put_in_file() method to create several different files in the install image being marshalled. I based the logic to create settings_install.xml on that example. Unfortunately I failed to notice that after every existing call, the script also explicitly appended the newly-created file to self.file_list... which only matters on Windows. file_list is fed to the NSIS installer. Change put_in_file() method to implicitly append to self.file_list. Change every existing viewer_manifest.py call to pass new put_in_file(src=) param instead of explicitly appending to self.file_list. --- indra/newview/viewer_manifest.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'indra/newview/viewer_manifest.py') diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 827a8f44c3..b9da6c9280 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -71,13 +71,13 @@ class ViewerManifest(LLManifest): # include the entire shaders directory recursively self.path("shaders") # include the extracted list of contributors - contributor_names = self.extract_names("../../doc/contributions.txt") - self.put_in_file(contributor_names, "contributors.txt") - self.file_list.append(["../../doc/contributions.txt",self.dst_path_of("contributors.txt")]) + contributions_path = "../../doc/contributions.txt" + contributor_names = self.extract_names(contributions_path) + self.put_in_file(contributor_names, "contributors.txt", src=contributions_path) # include the extracted list of translators - translator_names = self.extract_names("../../doc/translations.txt") - self.put_in_file(translator_names, "translators.txt") - self.file_list.append(["../../doc/translations.txt",self.dst_path_of("translators.txt")]) + translations_path = "../../doc/translations.txt" + translator_names = self.extract_names(translations_path) + self.put_in_file(translator_names, "translators.txt", src=translations_path) # include the list of Lindens (if any) # see https://wiki.lindenlab.com/wiki/Generated_Linden_Credits linden_names_path = os.getenv("LINDEN_CREDITS") @@ -91,10 +91,9 @@ class ViewerManifest(LLManifest): else: # all names should be one line, but the join below also converts to a string linden_names = ', '.join(linden_file.readlines()) - self.put_in_file(linden_names, "lindens.txt") + self.put_in_file(linden_names, "lindens.txt", src=linden_names_path) linden_file.close() print "Linden names extracted from '%s'" % linden_names_path - self.file_list.append([linden_names_path,self.dst_path_of("lindens.txt")]) # ... and the entire windlight directory self.path("windlight") @@ -113,14 +112,18 @@ class ViewerManifest(LLManifest): # no sourceid, no settings_install.xml file pass else: - if len(sourceid) > 0: - print "Using sourceid: " + sourceid + if sourceid: # Single-entry subset of the LLSD content of settings.xml content = dict(sourceid=dict(Comment='Identify referring agency to Linden web servers', Persist=1, Type='String', Value=sourceid)) - self.put_in_file(llsd.format_pretty_xml(content), "settings_install.xml") + # put_in_file(src=) need not be an actual pathname; it + # only needs to be non-empty + settings_install = self.put_in_file(llsd.format_pretty_xml(content), + "settings_install.xml", + src="environment") + print "Put sourceid '%s' in %s" % (sourceid, settings_install) self.end_prefix("app_settings") -- cgit v1.2.3