commit/galaxy-central: 2 new changesets
2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/a1b7ad9035bf/ Changeset: a1b7ad9035bf Branch: next-stable User: greg Date: 2013-11-01 16:38:04 Summary: Fixes for tool_dependencies.xml files whose recipe is missing either an <actions> tag set or an <actions_group> tag set. Upon upload of a single file, an appropriate error message will be displayed (currently it is logged when uploading a tarball). In either case, when the containing repository is installed, the tool dependency will be set to an error state and and the error message will be associated with the dependency record. Affected #: 6 files diff -r 4c1879921d9a0454879e84b3d3c064bad10c008b -r a1b7ad9035bf945f78edfb84204d746fd74a8929 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -250,8 +250,11 @@ removed = False if removed: tool_shed_repository.uninstalled = True - # Remove all installed tool dependencies, but don't touch any repository dependencies.. - for tool_dependency in tool_shed_repository.installed_tool_dependencies: + # Remove all installed tool dependencies and tool dependencies stuck in the INSTALLING state, but don't touch any + # repository dependencies. + tool_dependencies_to_uninstall = tool_shed_repository.installed_tool_dependencies + tool_dependencies_to_uninstall.extend( tool_shed_repository.tool_dependencies_being_installed ) + for tool_dependency in tool_dependencies_to_uninstall: uninstalled, error_message = tool_dependency_util.remove_tool_dependency( trans.app, tool_dependency ) if error_message: errors = '%s %s' % ( errors, error_message ) @@ -433,7 +436,7 @@ tool_dependencies=tool_dependencies ) for installed_tool_dependency in installed_tool_dependencies: if installed_tool_dependency.status == trans.app.model.ToolDependency.installation_status.ERROR: - message += ' %s' % suc.to_html_string( installed_tool_dependency.error_message ) + message += ' %s' % str( installed_tool_dependency.error_message ) tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in tool_dependencies ] if message: status = 'error' diff -r 4c1879921d9a0454879e84b3d3c064bad10c008b -r a1b7ad9035bf945f78edfb84204d746fd74a8929 lib/galaxy/webapps/tool_shed/controllers/upload.py --- a/lib/galaxy/webapps/tool_shed/controllers/upload.py +++ b/lib/galaxy/webapps/tool_shed/controllers/upload.py @@ -144,12 +144,17 @@ elif uploaded_file_filename in [ suc.TOOL_DEPENDENCY_DEFINITION_FILENAME ]: # Inspect the contents of the file to see if it defines a complex repository dependency definition whose changeset_revision values # are missing and if so, set them appropriately. - altered, root_elem = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) - if altered: - tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) - shutil.move( tmp_filename, full_path ) - else: - shutil.move( uploaded_file_name, full_path ) + altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + if error_message: + ok = False + message = error_message + status = 'error' + if ok: + if altered: + tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) + shutil.move( tmp_filename, full_path ) + else: + shutil.move( uploaded_file_name, full_path ) else: shutil.move( uploaded_file_name, full_path ) # See if any admin users have chosen to receive email alerts when a repository is updated. If so, check every uploaded file to ensure @@ -289,7 +294,10 @@ shutil.move( tmp_filename, uploaded_file_name ) elif os.path.split( uploaded_file_name )[ -1 ] == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. - altered, root_elem = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + # Can this be displayed? + if error_message: + log.debug( str( error_message ) ) if altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) shutil.move( tmp_filename, uploaded_file_name ) @@ -350,7 +358,10 @@ shutil.move( tmp_filename, uploaded_file_name ) elif os.path.split( uploaded_file_name )[ -1 ] == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. - altered, root_elem = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + if error_message: + # Can this be displayed? + log.debug( error_message ) if altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) shutil.move( tmp_filename, uploaded_file_name ) diff -r 4c1879921d9a0454879e84b3d3c064bad10c008b -r a1b7ad9035bf945f78edfb84204d746fd74a8929 lib/tool_shed/galaxy_install/tool_dependencies/install_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py @@ -340,7 +340,7 @@ version=package_version, type='package', status=app.model.ToolDependency.installation_status.INSTALLING, - set_status=True ) + set_status=False ) # Get the information about the current platform in case the tool dependency definition includes tag sets for installing # compiled binaries. platform_info_dict = tool_dependency_util.get_platform_info_dict() @@ -349,83 +349,93 @@ actions_elem_tuples = td_common_util.parse_package_elem( package_elem, platform_info_dict=platform_info_dict, include_after_install_actions=True ) - # At this point we have a list of <actions> elems that are either defined within an <actions_group> tag set with <actions> - # sub-elements that contains os and architecture attributes filtered by the platform into which the appropriate compiled - # binary will be installed, or not defined within an <actions_group> tag set and not filtered. - binary_installed = False - for in_actions_group, actions_elems in actions_elem_tuples: - if in_actions_group: - # Platform matching is only performed inside <actions_group> tag sets, os and architecture attributes are otherwise - # ignored. - for actions_elem in actions_elems: - system = actions_elem.get( 'os' ) - architecture = actions_elem.get( 'architecture' ) - # If this <actions> element has the os and architecture attributes defined, then we only want to process until a - # successful installation is achieved. - if system and architecture: - # If an <actions> tag has been defined that matches our current platform, and the recipe specified within - # that <actions> tag has been successfully processed, skip any remaining platform-specific <actions> tags. - # We cannot break out of the look here because there may be <action> tags at the end of the <actions_group> - # tag set that must be processed. - if binary_installed: - continue - # No platform-specific <actions> recipe has yet resulted in a successful installation. - install_via_fabric( app, - tool_dependency, - install_dir, - package_name=package_name, - actions_elem=actions_elem, - action_elem=None ) - sa_session.refresh( tool_dependency ) - if tool_dependency.status == app.model.ToolDependency.installation_status.INSTALLED: - # If an <actions> tag was found that matches the current platform, and the install_via_fabric method - # did not result in an error state, set binary_installed to True in order to skip any remaining - # platform-specific <actions> tags. - binary_installed = True - else: - # Process the next matching <actions> tag, or any defined <actions> tags that do not contain platform - # dependent recipes. - print 'Error downloading binary for %s version %s: %s' % \ - ( package_name, package_version, tool_dependency.error_message ) - else: - # If no <actions> tags have been defined that match our current platform, or none of the matching - # <actions> tags resulted in a successful tool dependency status, proceed with one and only one - # <actions> tag that is not defined to be platform-specific. - if not binary_installed: - print 'Binary installation did not occur, so proceeding with install and compile recipe.' - # Make sure to reset for installation if attempt at binary installation resulted in an error. - if tool_dependency.status != app.model.ToolDependency.installation_status.NEVER_INSTALLED: - removed, error_message = tool_dependency_util.remove_tool_dependency( app, tool_dependency ) + if actions_elem_tuples: + # At this point we have a list of <actions> elems that are either defined within an <actions_group> tag set with <actions> + # sub-elements that contains os and architecture attributes filtered by the platform into which the appropriate compiled + # binary will be installed, or not defined within an <actions_group> tag set and not filtered. + binary_installed = False + for in_actions_group, actions_elems in actions_elem_tuples: + if in_actions_group: + # Platform matching is only performed inside <actions_group> tag sets, os and architecture attributes are otherwise + # ignored. + for actions_elem in actions_elems: + system = actions_elem.get( 'os' ) + architecture = actions_elem.get( 'architecture' ) + # If this <actions> element has the os and architecture attributes defined, then we only want to process until a + # successful installation is achieved. + if system and architecture: + # If an <actions> tag has been defined that matches our current platform, and the recipe specified within + # that <actions> tag has been successfully processed, skip any remaining platform-specific <actions> tags. + # We cannot break out of the look here because there may be <action> tags at the end of the <actions_group> + # tag set that must be processed. + if binary_installed: + continue + # No platform-specific <actions> recipe has yet resulted in a successful installation. install_via_fabric( app, tool_dependency, install_dir, package_name=package_name, actions_elem=actions_elem, action_elem=None ) - # Perform any final actions that have been defined within the actions_group tag set, but outside of - # an <actions> tag, such as a set_environment entry, or a download_file or download_by_url command to - # retrieve extra data for this tool dependency. Only do this if the tool dependency is not in an error - # state, otherwise skip this action. - if actions_elem.tag == 'action' and tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: - install_via_fabric( app, - tool_dependency, - install_dir, - package_name=package_name, - actions_elem=None, - action_elem=actions_elem ) - else: - # <actions> tags outside of an <actions_group> tag shall not check os or architecture, and if the attributes are - # defined, they will be ignored. All <actions> tags outside of an <actions_group> tag set shall always be processed. - # This is the default and original behavior of the install_package method. - install_via_fabric( app, - tool_dependency, - install_dir, - package_name=package_name, - actions_elem=actions_elems, - action_elem=None ) - sa_session.refresh( tool_dependency ) - if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: - print package_name, 'version', package_version, 'installed in', install_dir + sa_session.refresh( tool_dependency ) + if tool_dependency.status == app.model.ToolDependency.installation_status.INSTALLED: + # If an <actions> tag was found that matches the current platform, and the install_via_fabric method + # did not result in an error state, set binary_installed to True in order to skip any remaining + # platform-specific <actions> tags. + binary_installed = True + else: + # Process the next matching <actions> tag, or any defined <actions> tags that do not contain platform + # dependent recipes. + print 'Error downloading binary for %s version %s: %s' % \ + ( package_name, package_version, tool_dependency.error_message ) + else: + # If no <actions> tags have been defined that match our current platform, or none of the matching + # <actions> tags resulted in a successful tool dependency status, proceed with one and only one + # <actions> tag that is not defined to be platform-specific. + if not binary_installed: + print 'Binary installation did not occur, so proceeding with install and compile recipe.' + # Make sure to reset for installation if attempt at binary installation resulted in an error. + if tool_dependency.status != app.model.ToolDependency.installation_status.NEVER_INSTALLED: + removed, error_message = tool_dependency_util.remove_tool_dependency( app, tool_dependency ) + install_via_fabric( app, + tool_dependency, + install_dir, + package_name=package_name, + actions_elem=actions_elem, + action_elem=None ) + # Perform any final actions that have been defined within the actions_group tag set, but outside of + # an <actions> tag, such as a set_environment entry, or a download_file or download_by_url command to + # retrieve extra data for this tool dependency. Only do this if the tool dependency is not in an error + # state, otherwise skip this action. + if actions_elem.tag == 'action' and tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: + install_via_fabric( app, + tool_dependency, + install_dir, + package_name=package_name, + actions_elem=None, + action_elem=actions_elem ) + else: + # <actions> tags outside of an <actions_group> tag shall not check os or architecture, and if the attributes are + # defined, they will be ignored. All <actions> tags outside of an <actions_group> tag set shall always be processed. + # This is the default and original behavior of the install_package method. + install_via_fabric( app, + tool_dependency, + install_dir, + package_name=package_name, + actions_elem=actions_elems, + action_elem=None ) + sa_session.refresh( tool_dependency ) + if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: + print package_name, 'version', package_version, 'installed in', install_dir + else: + error_message = 'Version %s of the %s package cannot be installed because ' % ( str( package_version ), str( package_name ) ) + error_message += 'the recipe for installing the package is missing either an <actions> tag set or an <actions_group> ' + error_message += 'tag set.' + tool_dependency.status = app.model.ToolDependency.installation_status.ERROR + tool_dependency.error_message = error_message + sa_session.add( tool_dependency ) + sa_session.flush() + return tool_dependency else: raise NotImplementedError( 'Only install version 1.0 is currently supported (i.e., change your tag to be <install version="1.0">).' ) elif package_elem.tag == 'readme': diff -r 4c1879921d9a0454879e84b3d3c064bad10c008b -r a1b7ad9035bf945f78edfb84204d746fd74a8929 lib/tool_shed/util/commit_util.py --- a/lib/tool_shed/util/commit_util.py +++ b/lib/tool_shed/util/commit_util.py @@ -344,10 +344,11 @@ Populate or unpopulate the tooshed and changeset_revision attributes of each <repository> tag defined within a tool_dependencies.xml file. """ altered = False + error_message = '' # Make sure we're looking at a valid tool_dependencies.xml file. tree, error_message = xml_util.parse_xml( tool_dependencies_config ) if tree is None: - return False, None + return False, None, error_message root = tree.getroot() if root.tag == 'tool_dependency': package_altered = False @@ -425,14 +426,20 @@ action_index, action_elem, unpopulate=unpopulate ) + else: + package_name = root_elem.get( 'name', '' ) + package_version = root_elem.get( 'version', '' ) + error_message = 'Version %s of the %s package cannot be installed because ' % ( str( package_version ), str( package_name ) ) + error_message += 'the recipe for installing the package is missing either an <actions> tag set or an <actions_group> ' + error_message += 'tag set.' if package_altered: package_elem[ actions_index ] = actions_elem if package_altered: root_elem[ package_index ] = package_elem if package_altered: root[ root_index ] = root_elem - return altered, root - return False, None + return altered, root, error_message + return False, None, error_message def repository_tag_is_valid( filename, line ): """ diff -r 4c1879921d9a0454879e84b3d3c064bad10c008b -r a1b7ad9035bf945f78edfb84204d746fd74a8929 lib/tool_shed/util/export_util.py --- a/lib/tool_shed/util/export_util.py +++ b/lib/tool_shed/util/export_util.py @@ -148,7 +148,9 @@ shutil.move( tmp_filename, full_path ) elif name == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Eliminate the toolshed, and changeset_revision attributes from all <repository> tags. - altered, root_elem = commit_util.handle_tool_dependencies_definition( trans, full_path, unpopulate=True ) + altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, full_path, unpopulate=True ) + if error_message: + return None, error_message if altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem, use_indent=True ) shutil.move( tmp_filename, full_path ) diff -r 4c1879921d9a0454879e84b3d3c064bad10c008b -r a1b7ad9035bf945f78edfb84204d746fd74a8929 lib/tool_shed/util/tool_dependency_util.py --- a/lib/tool_shed/util/tool_dependency_util.py +++ b/lib/tool_shed/util/tool_dependency_util.py @@ -48,6 +48,7 @@ else: tool_dependency = get_tool_dependency_by_name_type_repository( app, tool_shed_repository, name, type ) if tool_dependency: + # In some cases we should not override the current status of an existing tool_dependency, so do so only if set_status is True. if set_status: tool_dependency.status = status else: https://bitbucket.org/galaxy/galaxy-central/commits/c4a715455519/ Changeset: c4a715455519 User: greg Date: 2013-11-01 16:38:38 Summary: Merged from next-stable Affected #: 6 files diff -r 4beddecc0ebc6bf13b5d00dc48cbabe65c401e10 -r c4a7154555192be09051a3fbb1ad655a3926be3b lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -250,8 +250,11 @@ removed = False if removed: tool_shed_repository.uninstalled = True - # Remove all installed tool dependencies, but don't touch any repository dependencies.. - for tool_dependency in tool_shed_repository.installed_tool_dependencies: + # Remove all installed tool dependencies and tool dependencies stuck in the INSTALLING state, but don't touch any + # repository dependencies. + tool_dependencies_to_uninstall = tool_shed_repository.installed_tool_dependencies + tool_dependencies_to_uninstall.extend( tool_shed_repository.tool_dependencies_being_installed ) + for tool_dependency in tool_dependencies_to_uninstall: uninstalled, error_message = tool_dependency_util.remove_tool_dependency( trans.app, tool_dependency ) if error_message: errors = '%s %s' % ( errors, error_message ) @@ -433,7 +436,7 @@ tool_dependencies=tool_dependencies ) for installed_tool_dependency in installed_tool_dependencies: if installed_tool_dependency.status == trans.app.model.ToolDependency.installation_status.ERROR: - message += ' %s' % suc.to_html_string( installed_tool_dependency.error_message ) + message += ' %s' % str( installed_tool_dependency.error_message ) tool_dependency_ids = [ trans.security.encode_id( td.id ) for td in tool_dependencies ] if message: status = 'error' diff -r 4beddecc0ebc6bf13b5d00dc48cbabe65c401e10 -r c4a7154555192be09051a3fbb1ad655a3926be3b lib/galaxy/webapps/tool_shed/controllers/upload.py --- a/lib/galaxy/webapps/tool_shed/controllers/upload.py +++ b/lib/galaxy/webapps/tool_shed/controllers/upload.py @@ -150,12 +150,17 @@ elif uploaded_file_filename in [ suc.TOOL_DEPENDENCY_DEFINITION_FILENAME ]: # Inspect the contents of the file to see if it defines a complex repository dependency definition whose changeset_revision values # are missing and if so, set them appropriately. - altered, root_elem = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) - if altered: - tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) - shutil.move( tmp_filename, full_path ) - else: - shutil.move( uploaded_file_name, full_path ) + altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + if error_message: + ok = False + message = error_message + status = 'error' + if ok: + if altered: + tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) + shutil.move( tmp_filename, full_path ) + else: + shutil.move( uploaded_file_name, full_path ) else: shutil.move( uploaded_file_name, full_path ) if ok: @@ -303,7 +308,10 @@ shutil.move( tmp_filename, uploaded_file_name ) elif os.path.split( uploaded_file_name )[ -1 ] == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. - altered, root_elem = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + # Can this be displayed? + if error_message: + log.debug( str( error_message ) ) if altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) shutil.move( tmp_filename, uploaded_file_name ) @@ -368,7 +376,10 @@ shutil.move( tmp_filename, uploaded_file_name ) elif os.path.split( uploaded_file_name )[ -1 ] == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. - altered, root_elem = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) + if error_message: + # Can this be displayed? + log.debug( error_message ) if altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) shutil.move( tmp_filename, uploaded_file_name ) diff -r 4beddecc0ebc6bf13b5d00dc48cbabe65c401e10 -r c4a7154555192be09051a3fbb1ad655a3926be3b lib/tool_shed/galaxy_install/tool_dependencies/install_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/install_util.py @@ -340,7 +340,7 @@ version=package_version, type='package', status=app.model.ToolDependency.installation_status.INSTALLING, - set_status=True ) + set_status=False ) # Get the information about the current platform in case the tool dependency definition includes tag sets for installing # compiled binaries. platform_info_dict = tool_dependency_util.get_platform_info_dict() @@ -349,83 +349,93 @@ actions_elem_tuples = td_common_util.parse_package_elem( package_elem, platform_info_dict=platform_info_dict, include_after_install_actions=True ) - # At this point we have a list of <actions> elems that are either defined within an <actions_group> tag set with <actions> - # sub-elements that contains os and architecture attributes filtered by the platform into which the appropriate compiled - # binary will be installed, or not defined within an <actions_group> tag set and not filtered. - binary_installed = False - for in_actions_group, actions_elems in actions_elem_tuples: - if in_actions_group: - # Platform matching is only performed inside <actions_group> tag sets, os and architecture attributes are otherwise - # ignored. - for actions_elem in actions_elems: - system = actions_elem.get( 'os' ) - architecture = actions_elem.get( 'architecture' ) - # If this <actions> element has the os and architecture attributes defined, then we only want to process until a - # successful installation is achieved. - if system and architecture: - # If an <actions> tag has been defined that matches our current platform, and the recipe specified within - # that <actions> tag has been successfully processed, skip any remaining platform-specific <actions> tags. - # We cannot break out of the look here because there may be <action> tags at the end of the <actions_group> - # tag set that must be processed. - if binary_installed: - continue - # No platform-specific <actions> recipe has yet resulted in a successful installation. - install_via_fabric( app, - tool_dependency, - install_dir, - package_name=package_name, - actions_elem=actions_elem, - action_elem=None ) - sa_session.refresh( tool_dependency ) - if tool_dependency.status == app.model.ToolDependency.installation_status.INSTALLED: - # If an <actions> tag was found that matches the current platform, and the install_via_fabric method - # did not result in an error state, set binary_installed to True in order to skip any remaining - # platform-specific <actions> tags. - binary_installed = True - else: - # Process the next matching <actions> tag, or any defined <actions> tags that do not contain platform - # dependent recipes. - print 'Error downloading binary for %s version %s: %s' % \ - ( package_name, package_version, tool_dependency.error_message ) - else: - # If no <actions> tags have been defined that match our current platform, or none of the matching - # <actions> tags resulted in a successful tool dependency status, proceed with one and only one - # <actions> tag that is not defined to be platform-specific. - if not binary_installed: - print 'Binary installation did not occur, so proceeding with install and compile recipe.' - # Make sure to reset for installation if attempt at binary installation resulted in an error. - if tool_dependency.status != app.model.ToolDependency.installation_status.NEVER_INSTALLED: - removed, error_message = tool_dependency_util.remove_tool_dependency( app, tool_dependency ) + if actions_elem_tuples: + # At this point we have a list of <actions> elems that are either defined within an <actions_group> tag set with <actions> + # sub-elements that contains os and architecture attributes filtered by the platform into which the appropriate compiled + # binary will be installed, or not defined within an <actions_group> tag set and not filtered. + binary_installed = False + for in_actions_group, actions_elems in actions_elem_tuples: + if in_actions_group: + # Platform matching is only performed inside <actions_group> tag sets, os and architecture attributes are otherwise + # ignored. + for actions_elem in actions_elems: + system = actions_elem.get( 'os' ) + architecture = actions_elem.get( 'architecture' ) + # If this <actions> element has the os and architecture attributes defined, then we only want to process until a + # successful installation is achieved. + if system and architecture: + # If an <actions> tag has been defined that matches our current platform, and the recipe specified within + # that <actions> tag has been successfully processed, skip any remaining platform-specific <actions> tags. + # We cannot break out of the look here because there may be <action> tags at the end of the <actions_group> + # tag set that must be processed. + if binary_installed: + continue + # No platform-specific <actions> recipe has yet resulted in a successful installation. install_via_fabric( app, tool_dependency, install_dir, package_name=package_name, actions_elem=actions_elem, action_elem=None ) - # Perform any final actions that have been defined within the actions_group tag set, but outside of - # an <actions> tag, such as a set_environment entry, or a download_file or download_by_url command to - # retrieve extra data for this tool dependency. Only do this if the tool dependency is not in an error - # state, otherwise skip this action. - if actions_elem.tag == 'action' and tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: - install_via_fabric( app, - tool_dependency, - install_dir, - package_name=package_name, - actions_elem=None, - action_elem=actions_elem ) - else: - # <actions> tags outside of an <actions_group> tag shall not check os or architecture, and if the attributes are - # defined, they will be ignored. All <actions> tags outside of an <actions_group> tag set shall always be processed. - # This is the default and original behavior of the install_package method. - install_via_fabric( app, - tool_dependency, - install_dir, - package_name=package_name, - actions_elem=actions_elems, - action_elem=None ) - sa_session.refresh( tool_dependency ) - if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: - print package_name, 'version', package_version, 'installed in', install_dir + sa_session.refresh( tool_dependency ) + if tool_dependency.status == app.model.ToolDependency.installation_status.INSTALLED: + # If an <actions> tag was found that matches the current platform, and the install_via_fabric method + # did not result in an error state, set binary_installed to True in order to skip any remaining + # platform-specific <actions> tags. + binary_installed = True + else: + # Process the next matching <actions> tag, or any defined <actions> tags that do not contain platform + # dependent recipes. + print 'Error downloading binary for %s version %s: %s' % \ + ( package_name, package_version, tool_dependency.error_message ) + else: + # If no <actions> tags have been defined that match our current platform, or none of the matching + # <actions> tags resulted in a successful tool dependency status, proceed with one and only one + # <actions> tag that is not defined to be platform-specific. + if not binary_installed: + print 'Binary installation did not occur, so proceeding with install and compile recipe.' + # Make sure to reset for installation if attempt at binary installation resulted in an error. + if tool_dependency.status != app.model.ToolDependency.installation_status.NEVER_INSTALLED: + removed, error_message = tool_dependency_util.remove_tool_dependency( app, tool_dependency ) + install_via_fabric( app, + tool_dependency, + install_dir, + package_name=package_name, + actions_elem=actions_elem, + action_elem=None ) + # Perform any final actions that have been defined within the actions_group tag set, but outside of + # an <actions> tag, such as a set_environment entry, or a download_file or download_by_url command to + # retrieve extra data for this tool dependency. Only do this if the tool dependency is not in an error + # state, otherwise skip this action. + if actions_elem.tag == 'action' and tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: + install_via_fabric( app, + tool_dependency, + install_dir, + package_name=package_name, + actions_elem=None, + action_elem=actions_elem ) + else: + # <actions> tags outside of an <actions_group> tag shall not check os or architecture, and if the attributes are + # defined, they will be ignored. All <actions> tags outside of an <actions_group> tag set shall always be processed. + # This is the default and original behavior of the install_package method. + install_via_fabric( app, + tool_dependency, + install_dir, + package_name=package_name, + actions_elem=actions_elems, + action_elem=None ) + sa_session.refresh( tool_dependency ) + if tool_dependency.status != app.model.ToolDependency.installation_status.ERROR: + print package_name, 'version', package_version, 'installed in', install_dir + else: + error_message = 'Version %s of the %s package cannot be installed because ' % ( str( package_version ), str( package_name ) ) + error_message += 'the recipe for installing the package is missing either an <actions> tag set or an <actions_group> ' + error_message += 'tag set.' + tool_dependency.status = app.model.ToolDependency.installation_status.ERROR + tool_dependency.error_message = error_message + sa_session.add( tool_dependency ) + sa_session.flush() + return tool_dependency else: raise NotImplementedError( 'Only install version 1.0 is currently supported (i.e., change your tag to be <install version="1.0">).' ) elif package_elem.tag == 'readme': diff -r 4beddecc0ebc6bf13b5d00dc48cbabe65c401e10 -r c4a7154555192be09051a3fbb1ad655a3926be3b lib/tool_shed/util/commit_util.py --- a/lib/tool_shed/util/commit_util.py +++ b/lib/tool_shed/util/commit_util.py @@ -344,10 +344,11 @@ Populate or unpopulate the tooshed and changeset_revision attributes of each <repository> tag defined within a tool_dependencies.xml file. """ altered = False + error_message = '' # Make sure we're looking at a valid tool_dependencies.xml file. tree, error_message = xml_util.parse_xml( tool_dependencies_config ) if tree is None: - return False, None + return False, None, error_message root = tree.getroot() if root.tag == 'tool_dependency': package_altered = False @@ -425,14 +426,20 @@ action_index, action_elem, unpopulate=unpopulate ) + else: + package_name = root_elem.get( 'name', '' ) + package_version = root_elem.get( 'version', '' ) + error_message = 'Version %s of the %s package cannot be installed because ' % ( str( package_version ), str( package_name ) ) + error_message += 'the recipe for installing the package is missing either an <actions> tag set or an <actions_group> ' + error_message += 'tag set.' if package_altered: package_elem[ actions_index ] = actions_elem if package_altered: root_elem[ package_index ] = package_elem if package_altered: root[ root_index ] = root_elem - return altered, root - return False, None + return altered, root, error_message + return False, None, error_message def repository_tag_is_valid( filename, line ): """ diff -r 4beddecc0ebc6bf13b5d00dc48cbabe65c401e10 -r c4a7154555192be09051a3fbb1ad655a3926be3b lib/tool_shed/util/export_util.py --- a/lib/tool_shed/util/export_util.py +++ b/lib/tool_shed/util/export_util.py @@ -150,7 +150,9 @@ shutil.move( tmp_filename, full_path ) elif name == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Eliminate the toolshed, and changeset_revision attributes from all <repository> tags. - altered, root_elem = commit_util.handle_tool_dependencies_definition( trans, full_path, unpopulate=True ) + altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, full_path, unpopulate=True ) + if error_message: + return None, error_message if altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem, use_indent=True ) shutil.move( tmp_filename, full_path ) diff -r 4beddecc0ebc6bf13b5d00dc48cbabe65c401e10 -r c4a7154555192be09051a3fbb1ad655a3926be3b lib/tool_shed/util/tool_dependency_util.py --- a/lib/tool_shed/util/tool_dependency_util.py +++ b/lib/tool_shed/util/tool_dependency_util.py @@ -48,6 +48,7 @@ else: tool_dependency = get_tool_dependency_by_name_type_repository( app, tool_shed_repository, name, type ) if tool_dependency: + # In some cases we should not override the current status of an existing tool_dependency, so do so only if set_status is True. if set_status: tool_dependency.status = status else: Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org