def get_changelogs(package, releaser_history=None): if releaser_history is None: warning("No historical releaser history, using current maintainer name " "and email for each versioned changelog entry.") releaser_history = {} if is_debug(): import logging logging.basicConfig() import catkin_pkg catkin_pkg.changelog.log.setLevel(logging.DEBUG) package_path = os.path.abspath(os.path.dirname(package.filename)) changelog_path = os.path.join(package_path, CHANGELOG_FILENAME) if os.path.exists(changelog_path): changelog = get_changelog_from_path(changelog_path) changelogs = [] maintainer = (package.maintainers[0].name, package.maintainers[0].email) for version, date, changes in changelog.foreach_version(reverse=True): changes_str = [] date_str = get_rfc_2822_date(date) for item in changes: changes_str.extend([' ' + i for i in to_unicode(item).splitlines()]) # Each entry has (version, date, changes, releaser, releaser_email) releaser, email = releaser_history.get(version, maintainer) changelogs.append(( version, date_str, '\n'.join(changes_str), releaser, email )) return changelogs else: warning("No {0} found for package '{1}'" .format(CHANGELOG_FILENAME, package.name)) return []
def get_changelogs(package, releaser_history=None): if releaser_history is None: warning( "No historical releaser history, using current maintainer name " "and email for each versioned changelog entry.") releaser_history = {} if is_debug(): import logging logging.basicConfig() import catkin_pkg catkin_pkg.changelog.log.setLevel(logging.DEBUG) package_path = os.path.abspath(os.path.dirname(package.filename)) changelog_path = os.path.join(package_path, CHANGELOG_FILENAME) if os.path.exists(changelog_path): changelog = get_changelog_from_path(changelog_path) changelogs = [] maintainer = (package.maintainers[0].name, package.maintainers[0].email) for version, date, changes in changelog.foreach_version(reverse=True): changes_str = [] date_str = get_rfc_2822_date(date) for item in changes: changes_str.extend( [' ' + i for i in to_unicode(item).splitlines()]) # Each entry has (version, date, changes, releaser, releaser_email) releaser, email = releaser_history.get(version, maintainer) changelogs.append( (version, date_str, '\n'.join(changes_str), releaser, email)) return changelogs else: warning("No {0} found for package '{1}'".format( CHANGELOG_FILENAME, package.name)) return []
def generate_substitutions_from_package(package, os_name, os_version, ros_distro, installation_prefix='/usr', deb_inc=0, peer_packages=None, releaser_history=None, fallback_resolver=None, native=False): peer_packages = peer_packages or [] data = {} # Name, Version, Description data['Name'] = package.name data['Version'] = package.version data['Description'] = format_description(package.description) # Websites websites = [str(url) for url in package.urls if url.type == 'website'] homepage = websites[0] if websites else '' if homepage == '': warning("No homepage set, defaulting to ''") data['Homepage'] = homepage # Debian Increment Number data['DebianInc'] = '' if native else '-{0}'.format(deb_inc) # Debian Package Format data['format'] = 'native' if native else 'quilt' # Package name data['Package'] = sanitize_package_name(package.name) # Installation prefix data['InstallationPrefix'] = installation_prefix # Resolve dependencies depends = package.run_depends + package.buildtool_export_depends build_depends = package.build_depends + package.buildtool_depends + package.test_depends unresolved_keys = depends + build_depends + package.replaces + package.conflicts # The installer key is not considered here, but it is checked when the keys are checked before this resolved_deps = resolve_dependencies( unresolved_keys, os_name, os_version, ros_distro, peer_packages + [d.name for d in package.replaces + package.conflicts], fallback_resolver) data['Depends'] = sorted(set(format_depends(depends, resolved_deps))) data['BuildDepends'] = sorted( set(format_depends(build_depends, resolved_deps))) data['Replaces'] = sorted( set(format_depends(package.replaces, resolved_deps))) data['Conflicts'] = sorted( set(format_depends(package.conflicts, resolved_deps))) # Set the distribution data['Distribution'] = os_version # Use the time stamp to set the date strings stamp = datetime.datetime.now(tz.tzlocal()) data['Date'] = stamp.strftime('%a, %d %b %Y %T %z') data['YYYY'] = stamp.strftime('%Y') # Maintainers maintainers = [] for m in package.maintainers: maintainers.append(str(m)) data['Maintainer'] = maintainers[0] data['Maintainers'] = ', '.join(maintainers) # Changelog changelogs = get_changelogs(package, releaser_history) if changelogs and package.version not in [x[0] for x in changelogs]: warning("") warning( "A CHANGELOG.rst was found, but no changelog for this version was found." ) warning( "You REALLY should have a entry (even a blank one) for each version of your package." ) warning("") if not changelogs: # Ensure at least a minimal changelog changelogs = [] if package.version not in [x[0] for x in changelogs]: changelogs.insert(0, ( package.version, get_rfc_2822_date(datetime.datetime.now()), ' * Autogenerated, no changelog for this version found in CHANGELOG.rst.', package.maintainers[0].name, package.maintainers[0].email)) bad_changelog = False # Make sure that the first change log is the version being released if package.version != changelogs[0][0]: error("") error("The version of the first changelog entry '{0}' is not the " "same as the version being currently released '{1}'.".format( package.version, changelogs[0][0])) bad_changelog = True # Make sure that the current version is the latest in the changelog for changelog in changelogs: if parse_version(package.version) < parse_version(changelog[0]): error("") error( "There is at least one changelog entry, '{0}', which has a " "newer version than the version of package '{1}' being released, '{2}'." .format(changelog[0], package.name, package.version)) bad_changelog = True if bad_changelog: error("This is almost certainly by mistake, you should really take a " "look at the changelogs for the package you are releasing.") error("") if not maybe_continue('n', 'Continue anyways'): sys.exit("User quit.") data['changelogs'] = changelogs # Use debhelper version 7 for oneric, otherwise 9 data['debhelper_version'] = 7 if os_version in ['oneiric'] else 9 # Summarize dependencies summarize_dependency_mapping(data, depends, build_depends, resolved_deps) def convertToUnicode(obj): if sys.version_info.major == 2: if isinstance(obj, str): return unicode(obj.decode('utf8')) elif isinstance(obj, unicode): return obj else: if isinstance(obj, bytes): return str(obj.decode('utf8')) elif isinstance(obj, str): return obj if isinstance(obj, list): for i, val in enumerate(obj): obj[i] = convertToUnicode(val) return obj elif isinstance(obj, type(None)): return None elif isinstance(obj, tuple): obj_tmp = list(obj) for i, val in enumerate(obj_tmp): obj_tmp[i] = convertToUnicode(obj_tmp[i]) return tuple(obj_tmp) elif isinstance(obj, int): return obj raise RuntimeError('need to deal with type %s' % (str(type(obj)))) for item in data.items(): data[item[0]] = convertToUnicode(item[1]) return data
def update_summary(track, repository, distro): global _original_version track_dict = get_tracks_dict_raw()['tracks'][track] last_version = track_dict['last_version'] # Actually current version now release_inc = track_dict['release_inc'] version = "{0}-{1}".format(last_version, release_inc) summary_file = get_summary_file() msg = """\ ## {repository} ({distro}) - {version} User `{user}@{hostname}` released the packages in the `{repository}` repository into the \ `{distro}` distro by running `{cmd}` on `{date}` """.format( repository=repository, distro=distro, date=get_rfc_2822_date(datetime.datetime.now()), user=getpass.getuser(), hostname=socket.gethostname(), cmd=' '.join(sys.argv), version=version ) packages = [p.name for p in get_packages().values()] if len(packages) > 1: msg += "These packages were released:\n" for p in sorted(packages): msg += "- `{0}`\n".format(p) else: package_name = packages[0] msg += "The `{0}` package was released.\n".format(package_name) ignored_packages = get_ignored_packages() if ignored_packages: msg += "\nThese packages were explicitly ignored:\n" for ip in ignored_packages: msg += "- `{0}`\n".format(ip) summary_file = get_summary_file() release_file = get_distribution_file(distro) reps = release_file.repositories distro_version = None if repository in reps and reps[repository].release_repository is not None: distro_version = reps[repository].release_repository.version msg += """ Version of package(s) in repository `{repo}`: - rosdistro version: `{rosdistro_pv}` - old version: `{old_pv}` - new version: `{new_pv}` Versions of tools used: - bloom version: `{bloom_v}` - catkin_pkg version: `{catkin_pkg_v}` - rosdep version: `{rosdep_v}` - rosdistro version: `{rosdistro_v}` - vcstools version: `{vcstools_v}` """.format( repo=repository, rosdistro_pv=distro_version or 'null', old_pv=_original_version, new_pv=version, bloom_v=bloom.__version__, catkin_pkg_v=catkin_pkg.__version__, # Until https://github.com/ros-infrastructure/rosdistro/issues/16 rosdistro_v=pkg_resources.require("rosdistro")[0].version, rosdep_v=rosdep2.__version__, vcstools_v=vcstools.__version__.version ) summary_file.write(msg)
def generate_substitutions_from_package( package, os_name, os_version, ros_distro, installation_prefix='/usr', deb_inc=0, peer_packages=None, releaser_history=None, fallback_resolver=None ): peer_packages = peer_packages or [] data = {} # Name, Version, Description data['Name'] = package.name data['Version'] = package.version data['Description'] = debianize_string(package.description) # Websites websites = [str(url) for url in package.urls if url.type == 'website'] homepage = websites[0] if websites else '' if homepage == '': warning("No homepage set, defaulting to ''") data['Homepage'] = homepage # Debian Increment Number data['DebianInc'] = deb_inc # Package name data['Package'] = sanitize_package_name(package.name) # Installation prefix data['InstallationPrefix'] = installation_prefix # Resolve dependencies depends = package.run_depends build_depends = package.build_depends + package.buildtool_depends unresolved_keys = depends + build_depends resolved_deps = resolve_dependencies(unresolved_keys, os_name, os_version, ros_distro, peer_packages, fallback_resolver) data['Depends'] = sorted( set(format_depends(depends, resolved_deps)) ) data['BuildDepends'] = sorted( set(format_depends(build_depends, resolved_deps)) ) # Set the distribution data['Distribution'] = os_version # Use the time stamp to set the date strings stamp = datetime.datetime.now(tz.tzlocal()) data['Date'] = stamp.strftime('%a, %d %b %Y %T %z') data['YYYY'] = stamp.strftime('%Y') # Maintainers maintainers = [] for m in package.maintainers: maintainers.append(str(m)) data['Maintainer'] = maintainers[0] data['Maintainers'] = ', '.join(maintainers) # Changelog changelogs = get_changelogs(package, releaser_history) if changelogs and package.version not in [x[0] for x in changelogs]: warning("") warning("A CHANGELOG.rst was found, but no changelog for this version was found.") warning("You REALLY should have a entry (even a blank one) for each version of your package.") warning("") if not changelogs: # Ensure at least a minimal changelog changelogs = [] if package.version not in [x[0] for x in changelogs]: changelogs.insert(0, ( package.version, get_rfc_2822_date(datetime.datetime.now()), ' * Autogenerated, no changelog for this version found in CHANGELOG.rst.', package.maintainers[0].name, package.maintainers[0].email )) data['changelogs'] = changelogs # Summarize dependencies summarize_dependency_mapping(data, depends, build_depends, resolved_deps) return data
def generate_substitutions_from_package( package, os_name, os_version, ros_distro, installation_prefix='/usr', deb_inc=0, peer_packages=None, releaser_history=None, fallback_resolver=None ): peer_packages = peer_packages or [] data = {} # Name, Version, Description data['Name'] = package.name data['Version'] = package.version data['Description'] = debianize_string(package.description) # Websites websites = [str(url) for url in package.urls if url.type == 'website'] homepage = websites[0] if websites else '' if homepage == '': warning("No homepage set, defaulting to ''") data['Homepage'] = homepage # Debian Increment Number data['DebianInc'] = deb_inc # Package name data['Package'] = sanitize_package_name(package.name) # Installation prefix data['InstallationPrefix'] = installation_prefix # Resolve dependencies depends = package.run_depends + package.buildtool_export_depends build_depends = package.build_depends + package.buildtool_depends + package.test_depends unresolved_keys = depends + build_depends resolved_deps = resolve_dependencies(unresolved_keys, os_name, os_version, ros_distro, peer_packages, fallback_resolver) data['Depends'] = sorted( set(format_depends(depends, resolved_deps)) ) data['BuildDepends'] = sorted( set(format_depends(build_depends, resolved_deps)) ) # Set the distribution data['Distribution'] = os_version # Use the time stamp to set the date strings stamp = datetime.datetime.now(tz.tzlocal()) data['Date'] = stamp.strftime('%a, %d %b %Y %T %z') data['YYYY'] = stamp.strftime('%Y') # Maintainers maintainers = [] for m in package.maintainers: maintainers.append(str(m)) data['Maintainer'] = maintainers[0] data['Maintainers'] = ', '.join(maintainers) # Changelog changelogs = get_changelogs(package, releaser_history) if changelogs and package.version not in [x[0] for x in changelogs]: warning("") warning("A CHANGELOG.rst was found, but no changelog for this version was found.") warning("You REALLY should have a entry (even a blank one) for each version of your package.") warning("") if not changelogs: # Ensure at least a minimal changelog changelogs = [] if package.version not in [x[0] for x in changelogs]: changelogs.insert(0, ( package.version, get_rfc_2822_date(datetime.datetime.now()), ' * Autogenerated, no changelog for this version found in CHANGELOG.rst.', package.maintainers[0].name, package.maintainers[0].email )) bad_changelog = False # Make sure that the first change log is the version being released if package.version != changelogs[0][0]: error("") error("The version of the first changelog entry '{0}' is not the " "same as the version being currently released '{1}'." .format(package.version, changelogs[0][0])) bad_changelog = True # Make sure that the current version is the latest in the changelog for changelog in changelogs: if parse_version(package.version) < parse_version(changelog[0]): error("") error("There is at least one changelog entry, '{0}', which has a " "newer version than the version of package '{1}' being released, '{2}'." .format(changelog[0], package.name, package.version)) bad_changelog = True if bad_changelog: error("This is almost certainly by mistake, you should really take a " "look at the changelogs for the package you are releasing.") error("") if not maybe_continue('n', 'Continue anyways'): sys.exit("User quit.") data['changelogs'] = changelogs # Use debhelper version 7 for oneric, otherwise 9 data['debhelper_version'] = 7 if os_version in ['oneiric'] else 9 # Summarize dependencies summarize_dependency_mapping(data, depends, build_depends, resolved_deps) def convertToUnicode(obj): if sys.version_info.major == 2: if isinstance(obj, str): return unicode(obj.decode('utf8')) elif isinstance(obj, unicode): return obj else: if isinstance(obj, bytes): return str(obj.decode('utf8')) elif isinstance(obj, str): return obj if isinstance(obj, list): for i, val in enumerate(obj): obj[i] = convertToUnicode(val) return obj elif isinstance(obj, type(None)): return None elif isinstance(obj, tuple): obj_tmp = list(obj) for i, val in enumerate(obj_tmp): obj_tmp[i] = convertToUnicode(obj_tmp[i]) return tuple(obj_tmp) elif isinstance(obj, int): return obj raise RuntimeError('need to deal with type %s' % (str(type(obj)))) for item in data.items(): data[item[0]] = convertToUnicode(item[1]) return data
def generate_substitutions_from_package( package, os_name, os_version, ros_distro, installation_prefix='/usr', deb_inc=0, peer_packages=None, releaser_history=None, fallback_resolver=None ): peer_packages = peer_packages or [] data = {} # Name, Version, Description data['Name'] = package.name data['Version'] = package.version data['Description'] = debianize_string(package.description) # Websites websites = [str(url) for url in package.urls if url.type == 'website'] homepage = websites[0] if websites else '' if homepage == '': warning("No homepage set, defaulting to ''") data['Homepage'] = homepage # Debian Increment Number data['DebianInc'] = deb_inc # Package name data['Package'] = sanitize_package_name(package.name) # Installation prefix data['InstallationPrefix'] = installation_prefix # Library directory location data['LibDir'] = None # Resolve dependencies depends = package.run_depends build_depends = package.build_depends + package.buildtool_depends unresolved_keys = depends + build_depends resolved_deps = resolve_dependencies(unresolved_keys, os_name, os_version, ros_distro, peer_packages, fallback_resolver) data['Depends'] = sorted( set(format_depends(depends, resolved_deps)) ) data['BuildDepends'] = sorted( set(format_depends(build_depends, resolved_deps)) ) # Set the distribution data['Distribution'] = os_version # Use the time stamp to set the date strings stamp = datetime.datetime.now(tz.tzlocal()) data['Date'] = stamp.strftime('%a, %d %b %Y %T %z') data['YYYY'] = stamp.strftime('%Y') # Maintainers maintainers = [] for m in package.maintainers: maintainers.append(str(m)) data['Maintainer'] = maintainers[0] data['Maintainers'] = ', '.join(maintainers) # Changelog changelogs = get_changelogs(package, releaser_history) if changelogs and package.version not in [x[0] for x in changelogs]: warning("") warning("A CHANGELOG.rst was found, but no changelog for this version was found.") warning("You REALLY should have a entry (even a blank one) for each version of your package.") warning("") if not changelogs: # Ensure at least a minimal changelog changelogs = [] if package.version not in [x[0] for x in changelogs]: changelogs.insert(0, ( package.version, get_rfc_2822_date(datetime.datetime.now()), ' * Autogenerated, no changelog for this version found in CHANGELOG.rst.', package.maintainers[0].name, package.maintainers[0].email )) data['changelogs'] = changelogs # Summarize dependencies summarize_dependency_mapping(data, depends, build_depends, resolved_deps) def convertToUnicode(obj): if sys.version_info.major == 2: if isinstance(obj, str): return unicode(obj.decode('utf8')) elif isinstance(obj, unicode): return obj else: if isinstance(obj, bytes): return str(obj.decode('utf8')) elif isinstance(obj, str): return obj if isinstance(obj, list): for i, val in enumerate(obj): obj[i] = convertToUnicode(val) return obj elif isinstance(obj, type(None)): return None elif isinstance(obj, tuple): obj_tmp = list(obj) for i, val in enumerate(obj_tmp): obj_tmp[i] = convertToUnicode(obj_tmp[i]) return tuple(obj_tmp) elif isinstance(obj, int): return obj raise RuntimeError('need to deal with type %s' % (str(type(obj)))) for item in data.items(): data[item[0]] = convertToUnicode(item[1]) return data
def generate_substitutions_from_package( package, os_name, os_version, ros_distro, installation_prefix='/usr', deb_inc=0, peer_packages=None, releaser_history=None, fallback_resolver=None, native=False ): peer_packages = peer_packages or [] data = {} # Name, Version, Description data['Name'] = package.name data['Version'] = package.version data['Description'] = format_description(package.description) # Websites websites = [str(url) for url in package.urls if url.type == 'website'] homepage = websites[0] if websites else '' if homepage == '': warning("No homepage set, defaulting to ''") data['Homepage'] = homepage # Debian Increment Number data['DebianInc'] = '' if native else '-{0}'.format(deb_inc) # Debian Package Format data['format'] = 'native' if native else 'quilt' # Package name data['Package'] = sanitize_package_name(package.name) # Installation prefix data['InstallationPrefix'] = installation_prefix # Resolve dependencies evaluate_package_conditions(package, ros_distro) depends = [ dep for dep in (package.run_depends + package.buildtool_export_depends) if dep.evaluated_condition is not False] build_depends = [ dep for dep in (package.build_depends + package.buildtool_depends + package.test_depends) if dep.evaluated_condition is not False] replaces = [ dep for dep in package.replaces if dep.evaluated_condition is not False] conflicts = [ dep for dep in package.conflicts if dep.evaluated_condition is not False] unresolved_keys = depends + build_depends + replaces + conflicts # The installer key is not considered here, but it is checked when the keys are checked before this resolved_deps = resolve_dependencies(unresolved_keys, os_name, os_version, ros_distro, peer_packages + [d.name for d in (replaces + conflicts)], fallback_resolver) data['Depends'] = sorted( set(format_depends(depends, resolved_deps)) ) data['BuildDepends'] = sorted( set(format_depends(build_depends, resolved_deps)) ) data['Replaces'] = sorted( set(format_depends(replaces, resolved_deps)) ) data['Conflicts'] = sorted( set(format_depends(conflicts, resolved_deps)) ) # Build-type specific substitutions. build_type = package.get_build_type() if build_type == 'catkin': pass elif build_type == 'cmake': pass elif build_type == 'ament_cmake': pass elif build_type == 'ament_python': # Don't set the install-scripts flag if it's already set in setup.cfg. package_path = os.path.abspath(os.path.dirname(package.filename)) setup_cfg_path = os.path.join(package_path, 'setup.cfg') data['pass_install_scripts'] = True if os.path.isfile(setup_cfg_path): setup_cfg = SafeConfigParser() setup_cfg.read([setup_cfg_path]) if ( setup_cfg.has_option('install', 'install-scripts') or setup_cfg.has_option('install', 'install_scripts') ): data['pass_install_scripts'] = False else: error( "Build type '{}' is not supported by this version of bloom.". format(build_type), exit=True) # Set the distribution data['Distribution'] = os_version # Use the time stamp to set the date strings stamp = datetime.datetime.now(tz.tzlocal()) data['Date'] = stamp.strftime('%a, %d %b %Y %T %z') data['YYYY'] = stamp.strftime('%Y') # Maintainers maintainers = [] for m in package.maintainers: maintainers.append(str(m)) data['Maintainer'] = maintainers[0] data['Maintainers'] = ', '.join(maintainers) # Changelog changelogs = get_changelogs(package, releaser_history) if changelogs and package.version not in [x[0] for x in changelogs]: warning("") warning("A CHANGELOG.rst was found, but no changelog for this version was found.") warning("You REALLY should have a entry (even a blank one) for each version of your package.") warning("") if not changelogs: # Ensure at least a minimal changelog changelogs = [] if package.version not in [x[0] for x in changelogs]: changelogs.insert(0, ( package.version, get_rfc_2822_date(datetime.datetime.now()), ' * Autogenerated, no changelog for this version found in CHANGELOG.rst.', package.maintainers[0].name, package.maintainers[0].email )) bad_changelog = False # Make sure that the first change log is the version being released if package.version != changelogs[0][0]: error("") error("The version of the first changelog entry '{0}' is not the " "same as the version being currently released '{1}'." .format(package.version, changelogs[0][0])) bad_changelog = True # Make sure that the current version is the latest in the changelog for changelog in changelogs: if parse_version(package.version) < parse_version(changelog[0]): error("") error("There is at least one changelog entry, '{0}', which has a " "newer version than the version of package '{1}' being released, '{2}'." .format(changelog[0], package.name, package.version)) bad_changelog = True if bad_changelog: error("This is almost certainly by mistake, you should really take a " "look at the changelogs for the package you are releasing.") error("") if not maybe_continue('n', 'Continue anyways'): sys.exit("User quit.") data['changelogs'] = changelogs # Use debhelper version 7 for oneric, otherwise 9 data['debhelper_version'] = 7 if os_version in ['oneiric'] else 9 # Summarize dependencies summarize_dependency_mapping(data, depends, build_depends, resolved_deps) # Copyright licenses = [] separator = '\n' + '=' * 80 + '\n\n' for l in package.licenses: if hasattr(l, 'file') and l.file is not None: license_file = os.path.join(os.path.dirname(package.filename), l.file) if not os.path.exists(license_file): error("License file '{}' is not found.". format(license_file), exit=True) license_text = open(license_file, 'r').read() if not license_text.endswith('\n'): license_text += '\n' licenses.append(license_text) data['Copyright'] = separator.join(licenses) def convertToUnicode(obj): if sys.version_info.major == 2: if isinstance(obj, str): return unicode(obj.decode('utf8')) elif isinstance(obj, unicode): return obj else: if isinstance(obj, bytes): return str(obj.decode('utf8')) elif isinstance(obj, str): return obj if isinstance(obj, list): for i, val in enumerate(obj): obj[i] = convertToUnicode(val) return obj elif isinstance(obj, type(None)): return None elif isinstance(obj, tuple): obj_tmp = list(obj) for i, val in enumerate(obj_tmp): obj_tmp[i] = convertToUnicode(obj_tmp[i]) return tuple(obj_tmp) elif isinstance(obj, int): return obj raise RuntimeError('need to deal with type %s' % (str(type(obj)))) for item in data.items(): data[item[0]] = convertToUnicode(item[1]) return data
def generate_substitutions_from_package(package, os_name, os_version, ros_distro, installation_prefix='/usr', deb_inc=0, peer_packages=None, releaser_history=None, fallback_resolver=None): peer_packages = peer_packages or [] data = {} # Name, Version, Description data['Name'] = package.name data['Version'] = package.version data['Description'] = debianize_string(package.description) # Websites websites = [str(url) for url in package.urls if url.type == 'website'] homepage = websites[0] if websites else '' if homepage == '': warning("No homepage set, defaulting to ''") data['Homepage'] = homepage # Debian Increment Number data['DebianInc'] = deb_inc # Package name data['Package'] = sanitize_package_name(package.name) # Installation prefix data['InstallationPrefix'] = installation_prefix # Resolve dependencies depends = package.run_depends build_depends = package.build_depends + package.buildtool_depends unresolved_keys = depends + build_depends resolved_deps = resolve_dependencies(unresolved_keys, os_name, os_version, ros_distro, peer_packages, fallback_resolver) data['Depends'] = sorted(set(format_depends(depends, resolved_deps))) data['BuildDepends'] = sorted( set(format_depends(build_depends, resolved_deps))) # Set the distribution data['Distribution'] = os_version # Use the time stamp to set the date strings stamp = datetime.datetime.now(tz.tzlocal()) data['Date'] = stamp.strftime('%a, %d %b %Y %T %z') data['YYYY'] = stamp.strftime('%Y') # Maintainers maintainers = [] for m in package.maintainers: maintainers.append(str(m)) data['Maintainer'] = maintainers[0] data['Maintainers'] = ', '.join(maintainers) # Changelog changelogs = get_changelogs(package, releaser_history) if changelogs and package.version not in [x[0] for x in changelogs]: warning("") warning( "A CHANGELOG.rst was found, but no changelog for this version was found." ) warning( "You REALLY should have a entry (even a blank one) for each version of your package." ) warning("") if not changelogs: # Ensure at least a minimal changelog changelogs = [] if package.version not in [x[0] for x in changelogs]: changelogs.insert(0, ( package.version, get_rfc_2822_date(datetime.datetime.now()), ' * Autogenerated, no changelog for this version found in CHANGELOG.rst.', package.maintainers[0].name, package.maintainers[0].email)) data['changelogs'] = changelogs # Summarize dependencies summarize_dependency_mapping(data, depends, build_depends, resolved_deps) return data
def update_summary(track, repository, distro): global _original_version track_dict = get_tracks_dict_raw()['tracks'][track] last_version = track_dict['last_version'] # Actually current version now release_inc = track_dict['release_inc'] version = "{0}-{1}".format(last_version, release_inc) summary_file = get_summary_file() msg = """\ ## {repository} - {version} User `{user}@{hostname}` released the packages in the `{repository}` repository by running `{cmd}` on `{date}` """.format( **{ 'repository': repository, 'date': get_rfc_2822_date(datetime.datetime.now()), 'user': getpass.getuser(), 'hostname': socket.gethostname(), 'cmd': ' '.join(sys.argv), 'version': version }) packages = [p.name for p in get_packages().values()] if len(packages) > 1: msg += "These packages were released:\n" for p in sorted(packages): msg += "- `{0}`\n".format(p) else: package_name = packages[0] msg += "The `{0}` package was released.\n".format(package_name) ignored_packages = get_ignored_packages() if ignored_packages: msg += "\nThese packages were explicitly ignored:\n" for ip in ignored_packages: msg += "- `{0}`\n".format(ip) summary_file = get_summary_file() release_file = get_release_file(distro) reps = release_file.repositories distro_version = reps[repository].version if repository in reps else None msg += """ Version of package(s) in repository `{repo}`: - rosdistro version: `{rosdistro_pv}` - old version: `{old_pv}` - new version: `{new_pv}` Versions of tools used: - bloom version: `{bloom_v}` - catkin_pkg version: `{catkin_pkg_v}` - rosdep version: `{rosdep_v}` - rosdistro version: `{rosdistro_v}` - vcstools version: `{vcstools_v}` """.format(**dict( repo=repository, rosdistro_pv=distro_version or 'null', old_pv=_original_version, new_pv=version, bloom_v=bloom.__version__, catkin_pkg_v=catkin_pkg.__version__, # Until https://github.com/ros-infrastructure/rosdistro/issues/16 rosdistro_v=pkg_resources.require("rosdistro")[0].version, rosdep_v=rosdep2.__version__, vcstools_v=vcstools.__version__.version)) summary_file.write(msg)