All submissions to this site are governed by the Second Life Viewer Contribution Agreement. By submitting patches and other information using this site, you acknowledge that you have read, understood, and agreed to those terms.

Review Board 1.6.11

Welcome to the Second Life Viewer Code Review tool.
See the documentation on our wiki for how to use this site.

OPEN-76 Fix autobuild so that --config-file option is honoured by subsequent (possibly recursive) commands

Review Request #335 - Created June 10, 2011 and submitted

Ima Mechanique Reviewers
viewer
OPEN-76 alain_linden
None autobuild
When running a command such as:

autobuild configure --config-file ab-test.xml -c ReleaseOS

the configuration is only partially completed correctly. When the installables are processed, it does not use the correct configuration file. This is due to cmake calling autobuild install to do the actual install, but not passing the --config-file option. Autobuild falls back to the default autobuild.xml, because the correct configuration file is not saved at any point, which is not the intention and can cause configuration to be done with incorrect libraries. If autobuild.xml is missing or corrupt, an error occurs (which is how I discovered this), stopping the configure command.

This fix saves the current value of the configuration file into the AUTOBUILD_CONFIG_FILE environmental variable so that it becomes the default value should any subsequent command need it. I believe that something like this was the original intention when adding this environment variable as part of the default check, but was overlooked.
Ran 'autobuild configure --config-file ab-test.xml -c ReleaseOS' successfully without any errors and was able to build the expected viewer afterwards.

Changes between revision 1 and 2

1 2
1 2

  1. autobuild/configfile.py: Loading...
autobuild/configfile.py
Diff Revision 1 Diff Revision 2
... 64 lines hidden [Expand]
class ConfigurationDescription(common.Serialized):
65
    """
65
    """
66
    
66
    
67
    path = None
67
    path = None
68
    
68
    
69
    def __init__(self, path):
69
    def __init__(self, path):
70
        self.version = AUTOBUILD_CONFIG_VERSION
70
        self.version = AUTOBUILD_CONFIG_VERSION
71
        self.type = AUTOBUILD_CONFIG_TYPE
71
        self.type = AUTOBUILD_CONFIG_TYPE
72
        self.installables = {}
72
        self.installables = {}
73
        self.package_description = None
73
        self.package_description = None
74
        self.__load(path)
74
        self.__load(path)

   
75
        os.environ['AUTOBUILD_CONFIG_FILE'] = os.path.basename(self.path)
75
 
76
 
76
    def absolute_path(self, path):
77
    def absolute_path(self, path):
77
        """
78
        """
78
        Returns an absolute path derived from the input path rooted at the configuration file's
79
        Returns an absolute path derived from the input path rooted at the configuration file's
79
        directory when the input is a relative path.
80
        directory when the input is a relative path.
80
        """
81
        """
81
        if os.path.isabs(path):
82
        if os.path.isabs(path):
82
            return path
83
            return path
83
        else:
84
        else:
84
            return os.path.abspath(os.path.join(os.path.dirname(self.path), path))
85
            return os.path.abspath(os.path.join(os.path.dirname(self.path), path))
... 107 lines hidden [Expand]
def __load(self, path):
192
            if saved_data['version'] == self.version:
193
            if saved_data['version'] == self.version:
193
                if (not saved_data.has_key('type')) or (saved_data['type'] != 'autobuild'):
194
                if (not saved_data.has_key('type')) or (saved_data['type'] != 'autobuild'):
194
                    raise AutobuildError(self.path + ' not an autobuild configuration file')
195
                    raise AutobuildError(self.path + ' not an autobuild configuration file')
195
                package_description = saved_data.pop('package_description', None)
196
                package_description = saved_data.pop('package_description', None)
196
                if package_description is not None:
197
                if package_description is not None:
197
                    self.package_description = PackageDescription(package_description)
198
                    self.package_description = PackageDescription(package_description)
198
                installables = saved_data.pop('installables', {})
199
                installables = saved_data.pop('installables', {})
199
                for (name, package) in installables.iteritems():
200
                for (name, package) in installables.iteritems():
200
                    self.installables[name] = PackageDescription(package)
201
                    self.installables[name] = PackageDescription(package)
201
                self.update(saved_data)
202
                self.update(saved_data)
202
                os.environ['AUTOBUILD_CONFIG_FILE'] = os.path.basename(self.path)

   
203
                logger.debug("Configuration file '%s'" % self.path)
203
                logger.debug("Configuration file '%s'" % self.path)
204
            else:
204
            else:
205
                if saved_data['version'] in update.updaters:
205
                if saved_data['version'] in update.updaters:
206
                    update.updaters[saved_data['version']](saved_data, self)
206
                    update.updaters[saved_data['version']](saved_data, self)
207
                else:
207
                else:
208
                    raise ConfigurationError("cannot update version %s file %s" %
208
                    raise ConfigurationError("cannot update version %s file %s" %
209
                                             (saved_data.version, self.path))
209
                                             (saved_data.version, self.path))
210
        elif not os.path.exists(self.path):
210
        elif not os.path.exists(self.path):
211
            logger.warn("Configuration file '%s' not found" % self.path)
211
            logger.warn("Configuration file '%s' not found" % self.path)
212
        else:
212
        else:
... 224 lines hidden [Expand]
  1. autobuild/configfile.py: Loading...