Skip to content

Commit

Permalink
call version_without_release
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed May 9, 2018
1 parent d4b3111 commit 38ae1af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
11 changes: 10 additions & 1 deletion src/lib/registration/sw_mgmt.rb
Expand Up @@ -134,7 +134,7 @@ def self.installer_update_base_product(self_update_id)
product_info = {
"name" => self_update_id,
"arch" => base_product.arch,
"version" => base_product.version,
"version" => version_without_release(base_product),
"release_type" => nil
}

Expand Down Expand Up @@ -254,6 +254,15 @@ def self.remote_product(product, version_release: true)
)
end

# remove relase string from version. E.g.: "15-0" --> "15"
# @param product [Y2Packager::Product] product
# @return [String] version
def self.version_without_release(product)
pkg_product = Yast::Pkg.ResolvableProperties(product.name,
:product, product.version).find_all.first
pkg_product ? pkg_product["version_version"] : product.version
end

# create UI label for a base product
# @param base_product [Hash] Product (hash from pkg-bindings)
# @return [String] UI Label
Expand Down
8 changes: 1 addition & 7 deletions src/lib/registration/ui/migration_repos_workflow.rb
Expand Up @@ -321,16 +321,10 @@ def load_migration_products_offline(activations)

return :empty unless migration_confirmed?(base_product, activations)

# evaluate pkg.product for version_version in order to use
# e.g. version "15" instead of "15-0"
# So converting a libzypp Version to SUSE::Connect::Remote::Product version
pkg_product = Yast::Pkg.ResolvableProperties(base_product.name,
:product, base_product.version).find_all.first

remote_product = OpenStruct.new(
arch: base_product.arch.to_s,
identifier: base_product.name,
version: pkg_product ? pkg_product["version_version"] : base_product.version,
version: SwMgmt.version_without_release(base_product),
# FIXME: not supported by Y2Packager::Product yet
release_type: nil
)
Expand Down

0 comments on commit 38ae1af

Please sign in to comment.