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.

Adds support for packaging and extracting zip formatted archives

Review Request #494 - Created Oct. 13, 2011 and submitted

Alain Linden Reviewers
http://bitbucket.org/alain_linden/autobuild viewer
oz.linden, jenn, nat_linden
None autobuild
These changes are to support packaging archives as zip files.  This is useful when you are using autobuild to construct an archive that isn't really intended to be used as an autobuild installable.  Internally autobuild can handle tarballs on any platform, but if you are making a package for windows and not installing with autobuild, it is better to use zip which is natively supported.  Changes here do the following:

1. enable the --archive-format option for autobuild package to choose the format of the package.
2. add support for reading an 'archive' entry per platform with the new 'format' element to select the archive format with the configuration file.
3. add new edit command 'autobuild edit archive' to add archive configurations.
4. add support for installing zip formatted archives.

 
autobuild/autobuild_tool_edit.py
Revision ac90b03614ea New Change
... 76 lines hidden [Expand]
def run(self, args):
77
            config.save()
77
            config.save()
78

   
78

   
79
    def _get_command_callables(self):
79
    def _get_command_callables(self):
80
        """
80
        """
81
        Lazily create arguments dict.
81
        Lazily create arguments dict.
82
        """
82
        """
83
        try:
83
        try:
84
            self.arguments
84
            self.arguments
85
        except AttributeError:
85
        except AttributeError:
86
            self.arguments = {
86
            self.arguments = {

   
87
                                'archive':      Archive,
87
                                'configure':    Configure,
88
                                'configure':    Configure,
88
                                'build':        Build,
89
                                'build':        Build,
89
                                'package':      Package,
90
                                'package':      Package,
90
                                'platform':     Platform,
91
                                'platform':     Platform,
91
                                'source-info':  SourceInfo,
92
                                'source-info':  SourceInfo,
92
                            }
93
                            }
93
        return self.arguments
94
        return self.arguments
94

   
95

   
95

   
96

   
96
def _arg_help_str(args, arg_dict):
97
def _arg_help_str(args, arg_dict):
... 151 lines hidden [Expand]
def run(self, name='', build_directory=None):
248
    def delete(self, name='', **kwargs):
249
    def delete(self, name='', **kwargs):
249
        """
250
        """
250
        Delete the named config value.
251
        Delete the named config value.
251
        """
252
        """
252
        if not name:
253
        if not name:
253
            raise AutobuildError("'name' argument must be provided with --delete option.")
254
            raise AutobuildError("'name' argument must be provided with --delete option.")
254
        print "Deleting entry."
255
        print "Deleting entry."
255
        self.config.package_description.platforms.pop(name)
256
        self.config.package_description.platforms.pop(name)
256

   
257

   
257

   
258

   

   
259
class Archive(InteractiveCommand):

   
260

   

   
261
    ARGUMENTS = ['format', 'hash_algorithm', 'platform']

   
262

   

   
263
    ARG_DICT = {    'format':             {'help':'Archive format (e.g zip or tbz2)'}, 

   
264
                    'hash_algorithm':  {'help':'The algorithm for computing the archive hash (e.g. md5)'},

   
265
                    'platform': {'help':'The name of the platform archive to be configured'}

   
266
                }

   
267

   

   
268
    HELP = "Platform-specific archive configuration"

   
269

   

   
270
    def __init__(self, config):

   
271
        stream = StringIO()

   
272
        stream.write("Current platform archive settings:\n")

   
273
        archives = {}

   
274
        for platform, description in config.get_all_platforms().iteritems():

   
275
            if description.archive is not None:

   
276
                archives[platform] = description.archive

   
277
        configfile.pretty_print(archives, stream)

   
278
        self.description = stream.getvalue()

   
279
        stream.close()

   
280
        self.config = config

   
281

   

   
282
    def _create_or_update_platform_archive(self, platform, format, hash_algorithm):

   
283
        try:

   
284
            platform_description = self.config.get_platform(platform)

   
285
        except configfile.ConfigurationError:

   
286
            platform_description = configfile.PlatformDescription({'name': platform})

   
287
            self.config.package_description.platforms[platform] = platform_description

   
288
        if platform_description.archive is None:

   
289
            platform_description.archive = configfile.ArchiveDescription()

   
290
        platform_description.archive.format = format

   
291
        platform_description.archive.hash_algorithm = hash_algorithm

   
292

   

   
293
    def run(self, platform=get_current_platform(), format=None, hash_algorithm=None):

   
294
        """

   
295
        Configure platform archive details.

   
296
        """

   
297
        self._create_or_update_platform_archive(platform, format, hash_algorithm)

   
298
        

   
299
    def delete(self, platform=get_current_platform(), **kwargs):

   
300
        """

   
301
        Delete the named config value.

   
302
        """

   
303
        print "Deleting %s archive entry." % platform

   
304
        platform_description = self.config.get_platform(platform)

   
305
        if platform_description is not None:

   
306
            platform_description.archive = None

   
307

   

   
308

   
258
class _package(InteractiveCommand):
309
class _package(InteractiveCommand):
259

   
310

   
260
    def __init__(self, config):
311
    def __init__(self, config):
261
        stream = StringIO()
312
        stream = StringIO()
262
        stream.write("Current package settings:\n")
313
        stream.write("Current package settings:\n")
263
        configfile.pretty_print(config.package_description, stream)
314
        configfile.pretty_print(config.package_description, stream)
264
        self.description = stream.getvalue()
315
        self.description = stream.getvalue()
265
        stream.close()
316
        stream.close()
266

   
317

   
267
        self.config = config
318
        self.config = config
... 79 lines hidden [Expand]
autobuild/autobuild_tool_package.py
Revision ac90b03614ea New Change
 
autobuild/common.py
Revision ac90b03614ea New Change
 
autobuild/configfile.py
Revision ac90b03614ea New Change
 
autobuild/tests/test_common.py
Revision ac90b03614ea New Change
 
autobuild/tests/test_package.py
Revision ac90b03614ea New Change
 
  1. autobuild/autobuild_tool_edit.py: Loading...
  2. autobuild/autobuild_tool_package.py: Loading...
  3. autobuild/common.py: Loading...
  4. autobuild/configfile.py: Loading...
  5. autobuild/tests/test_common.py: Loading...
  6. autobuild/tests/test_package.py: Loading...