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-133: move log calls to match what is really happening

Review Request #539 - Created Jan. 19, 2012 and updated

Oz Linden Reviewers
open-133 jenn, nat_linden
None autobuild
The proposed change just moves the generation of the progress messages from before to after the checks that determine whether or not the operation is needed so that the messages are displayed only when the step is actually being performed.

This changes only the logging - the actual operations have not been modified.
I've run installs that demonstrate that the messages actually match what is happening (by comparing file modification times).

Diff revision 1 (Latest)

  1. autobuild/autobuild_tool_install.py: Loading...
  2. autobuild/common.py: Loading...
autobuild/autobuild_tool_install.py
Revision e1687c2ac203 New Change
... 267 lines hidden [Expand]
def do_install(packages, config_file, installed_file, platform, install_dir, dry_run, as_source=[], local_archives=[]):
268
        else:
268
        else:
269
            # Existing install. If pname was previously installed --as-source,
269
            # Existing install. If pname was previously installed --as-source,
270
            # do not mess with it now.
270
            # do not mess with it now.
271
            source_install = installed.as_source
271
            source_install = installed.as_source
272
            if source_install:
272
            if source_install:
273
                logger.warn("%s previously installed --as-source, not updating" % pname)
273
                logger.warn("%s previously installed --as-source, not updating" % pname)
274
                continue
274
                continue
275

   
275

   
276
        # Existing tarball install, or new package install of either kind
276
        # Existing tarball install, or new package install of either kind
277
        if source_install:
277
        if source_install:
278
            logger.warn("installing %s --as-source" % pname)

   
279
            if _install_source(package, installed_file, config_file, dry_run):
278
            if _install_source(package, installed_file, config_file, dry_run):
280
                installed_pkgs.append(pname)
279
                installed_pkgs.append(pname)
281
        elif pname in local_archives:
280
        elif pname in local_archives:
282
            logger.warn("installing %s from local archive" % pname)

   
283
            if _install_local(platform, package, local_archives[pname], install_dir, installed_file, dry_run):
281
            if _install_local(platform, package, local_archives[pname], install_dir, installed_file, dry_run):
284
                installed_pkgs.append(pname)
282
                installed_pkgs.append(pname)
285
        else:
283
        else:
286
            logger.warn("installing %s from archive" % pname)

   
287
            if _install_binary(package, platform, config_file, install_dir, installed_file, dry_run):
284
            if _install_binary(package, platform, config_file, install_dir, installed_file, dry_run):
288
                installed_pkgs.append(pname)
285
                installed_pkgs.append(pname)
289
    return installed_pkgs
286
    return installed_pkgs
290

   
287

   
291
def _install_source(package, installed_config, config_file, dry_run):
288
def _install_source(package, installed_config, config_file, dry_run):
292
    if dry_run:
289
    if dry_run:
293
        dry_run_msg("Dry run mode: not installing %s source for %s from %s" %
290
        dry_run_msg("Dry run mode: not installing %s source for %s from %s" %
294
                    (package.sourcetype, package.name, package.source))
291
                    (package.sourcetype, package.name, package.source))
295
        return False
292
        return False
296

   
293

   
... 48 lines hidden [Expand]
def _install_source(package, installed_config, config_file, dry_run):
345
    package_name = package.name
342
    package_name = package.name
346
    
343
    
347
    if dry_run:
344
    if dry_run:
348
        dry_run_msg("Dry run mode: not installing %s" % package.name)
345
        dry_run_msg("Dry run mode: not installing %s" % package.name)
349
        return False
346
        return False
350

   
347

   
351
    # If this package has already been installed, first uninstall the older
348
    # If this package has already been installed, first uninstall the older
352
    # version.
349
    # version.
353
    uninstall(package_name, installed_file)
350
    uninstall(package_name, installed_file)
354

   
351

   

   
352
    logger.warn("installing %s from local archive" % package.name)

   
353

   
355
    # check that the install dir exists...
354
    # check that the install dir exists...
356
    if not os.path.exists(install_dir):
355
    if not os.path.exists(install_dir):
357
        logger.debug("creating " + install_dir)
356
        logger.debug("creating " + install_dir)
358
        os.makedirs(install_dir)
357
        os.makedirs(install_dir)
359

   
358

   
360
    # extract the files from the package
359
    # extract the files from the package
361
    logger.warn("extracting %s" % (package.name))

   
362
    files = common.install_package(package_path, install_dir)
360
    files = common.install_package(package_path, install_dir)
363
    if not files:
361
    if not files:
364
        return False
362
        return False
365
    for f in files:
363
    for f in files:
366
        logger.debug("extracted: " + f)
364
        logger.debug("extracted: " + f)
367
    
365
    
368
    installed_package = package.copy()
366
    installed_package = package.copy()
369
    if platform not in package.platforms:
367
    if platform not in package.platforms:
370
        installed_platform = configfile.PlatformDescription(dict(name=platform))
368
        installed_platform = configfile.PlatformDescription(dict(name=platform))
371
    else:
369
    else:
... 63 lines hidden [Expand]
def _install_binary(package, platform, config_file, install_dir, installed_file, dry_run):
435

   
433

   
436
    # If this package has already been installed, first uninstall the older
434
    # If this package has already been installed, first uninstall the older
437
    # version.
435
    # version.
438
    uninstall(package.name, installed_file)
436
    uninstall(package.name, installed_file)
439

   
437

   
440
    # check that the install dir exists...
438
    # check that the install dir exists...
441
    if not os.path.exists(install_dir):
439
    if not os.path.exists(install_dir):
442
        logger.debug("creating " + install_dir)
440
        logger.debug("creating " + install_dir)
443
        os.makedirs(install_dir)
441
        os.makedirs(install_dir)
444

   
442

   

   
443
    logger.warn("installing %s from archive" % package.name)
445
    # extract the files from the package
444
    # extract the files from the package
446
    logger.warn("extracting %s" % (package.name))

   
447
    files = common.extract_package(archive.url, install_dir)
445
    files = common.extract_package(archive.url, install_dir)
448
    for f in files:
446
    for f in files:
449
        logger.debug("extracted: " + f)
447
        logger.debug("extracted: " + f)
450
        
448
        
451
    _update_installed_package_files(package, platform, installed_file, install_dir, files)
449
    _update_installed_package_files(package, platform, installed_file, install_dir, files)
452
    return True
450
    return True
453

   
451

   
454
def _update_installed_package_files(package, platform, installed_file, install_dir, files):
452
def _update_installed_package_files(package, platform, installed_file, install_dir, files):
455
    installed_package = package.copy()
453
    installed_package = package.copy()
456
    installed_file.installables[package.name] = installed_package
454
    installed_file.installables[package.name] = installed_package
... 161 lines hidden [Expand]
autobuild/common.py
Revision e1687c2ac203 New Change
 
  1. autobuild/autobuild_tool_install.py: Loading...
  2. autobuild/common.py: Loading...