def detect_name_and_version(repo, source, spec, options): """Determine name and version of the upstream project""" # Guess defaults for the package name and version from the # original tarball. (guessed_package, guessed_version) = source.guess_version() or ('', '') # Try to find the source package name if spec: sourcepackage = spec.name else: if options.interactive: sourcepackage = ask_package_name(guessed_package, RpmPkgPolicy.is_valid_packagename, RpmPkgPolicy.packagename_msg) else: if guessed_package: sourcepackage = guessed_package else: raise GbpError, "Couldn't determine upstream package name. Use --interactive." # Try to find the version. if options.version: version = options.version else: if options.interactive: version = ask_package_version( guessed_version, RpmPkgPolicy.is_valid_upstreamversion, RpmPkgPolicy.upstreamversion_msg) else: if guessed_version: version = guessed_version else: raise GbpError, "Couldn't determine upstream version. Use '-u<version>' or --interactive." return (sourcepackage, version)
def detect_name_and_version(repo, source, options): # Guess defaults for the package name and version from the # original tarball. guessed_package, guessed_version = source.guess_version() # Try to find the source package name try: cp = ChangeLog(filename='debian/changelog') sourcepackage = cp['Source'] except NoChangeLogError: try: # Check the changelog file from the repository, in case # we're not on the debian-branch (but upstream, for # example). cp = parse_changelog_repo(repo, options.debian_branch, 'debian/changelog') sourcepackage = cp['Source'] except NoChangeLogError: if options.interactive: sourcepackage = ask_package_name( guessed_package, DebianPkgPolicy.is_valid_packagename, DebianPkgPolicy.packagename_msg) else: if guessed_package: sourcepackage = guessed_package else: raise GbpError( "Couldn't determine upstream package name. Use --interactive." ) # Try to find the version. if options.version: version = options.version else: if options.interactive: version = ask_package_version( guessed_version, DebianPkgPolicy.is_valid_upstreamversion, DebianPkgPolicy.upstreamversion_msg) else: if guessed_version: version = guessed_version else: raise GbpError( "Couldn't determine upstream version. Use '-u<version>' or --interactive." ) return (sourcepackage, version)
def detect_name_version_and_component(self, repo, options): # Guess defaults for the package name, version, and component from the # original tarball. (guessed_package, guessed_version, guessed_component) = self._source.guess_version() or ('', '', '') # Try to find the source package name try: cp = ChangeLog(filename='debian/changelog') sourcepackage = cp['Source'] except NoChangeLogError: try: # Check the changelog file from the repository, in case # we're not on the debian-branch (but upstream, for # example). cp = parse_changelog_repo(repo, options.debian_branch, 'debian/changelog') sourcepackage = cp['Source'] except NoChangeLogError: if options.interactive: sourcepackage = ask_package_name(guessed_package, DebianPkgPolicy.is_valid_packagename, DebianPkgPolicy.packagename_msg) else: if guessed_package: sourcepackage = guessed_package else: raise GbpError("Couldn't determine upstream package name. Use --interactive.") # Try to find the version. if options.version: version = options.version else: if options.interactive: version = ask_package_version(guessed_version, DebianPkgPolicy.is_valid_upstreamversion, DebianPkgPolicy.upstreamversion_msg) else: if guessed_version: version = guessed_version else: raise GbpError("Couldn't determine upstream version. Use '-u<version>' or --interactive.") self.name = sourcepackage self.version = version self.component = guessed_component
def detect_name_and_version(repo, source, options): # Guess defaults for the package name and version from the # original tarball. guessed_package, guessed_version = source.guess_version() # Try to find the source package name try: cp = ChangeLog(filename="debian/changelog") sourcepackage = cp["Source"] except NoChangeLogError: try: # Check the changelog file from the repository, in case # we're not on the debian-branch (but upstream, for # example). cp = parse_changelog_repo(repo, options.debian_branch, "debian/changelog") sourcepackage = cp["Source"] except NoChangeLogError: if options.interactive: sourcepackage = ask_package_name( guessed_package, DebianPkgPolicy.is_valid_packagename, DebianPkgPolicy.packagename_msg ) else: if guessed_package: sourcepackage = guessed_package else: raise GbpError("Couldn't determine upstream package name. Use --interactive.") # Try to find the version. if options.version: version = options.version else: if options.interactive: version = ask_package_version( guessed_version, DebianPkgPolicy.is_valid_upstreamversion, DebianPkgPolicy.upstreamversion_msg ) else: if guessed_version: version = guessed_version else: raise GbpError("Couldn't determine upstream version. Use '-u<version>' or --interactive.") return (sourcepackage, version)