Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PackagesProposal - Added API for optional resolvables #519

Merged
merged 3 commits into from Nov 30, 2016

Conversation

lslezak
Copy link
Member

@lslezak lslezak commented Nov 30, 2016

This API enhancement is needed by yast2-packager to fix blocked installation after deselecting some default patterns in openQA tests (YaST complains about missing patterns and blocks the installation).

  • There are now two kinds of resolvables: required and optional, the optional ones are stored separately so the software proposal module can only complain for the missing required resolvables. User can deselect the optional resolvables without any problem.
  • The API is backward compatible, the added method parameter is optional with the backward compatible default value. We do not have to change the existing code.
  • Code cleanup - removed all Builtins and Convert calls
  • Refactoring - more Ruby-like code
  • Added unit tests for the PackagesProposal module (covers 100% of the module)
  • Improved the code documentation

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 51.371% when pulling 3156daa on optional_patterns into 336bcff on master.

@@ -32,8 +32,11 @@ library/*/testsuite/*.sum
library/*/testsuite/*.exp
library/*/testsuite/*.bak
library/*/test/*.log
library/*/test/*/*.log
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about modifying above to library/*/test/**/*.log

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's better, I didn't know that ** is supported...

library/*/test/*.trs
library/*/test/*/*.trs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and same here

if @resolvables_to_install != {}
Builtins.y2warning("Reseting all PackagesProposal items")
if !@resolvables_to_install.empty? || !@opt_resolvables_to_install.empty?
log.warn("Resetting all PackagesProposal items")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it is warning? you call method to reset it and it warn if it reset something?

@@ -73,34 +78,29 @@ def GetSupportedResolvables

def IsSupportedResolvableType(type)
if type.nil?
Builtins.y2error("Wrong type: %1", type)
log.error("Type cannot be nil")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think below return is not needed and can be only one liner.

)
log.info("Adding #{log_label(optional)} #{resolvables} of type #{type} for #{unique_ID}")

data(optional)[unique_ID][type].concat(resolvables)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice if CreateEmptyStructureIfMissing(unique_ID, type, optional: optional) just return that data(optional)[unique_ID][type] so maybe better name would be data_for_uid_and_type which create it if needed.

# sort the result and remove the duplicates
ret.sort!
ret.uniq!

deep_copy(ret)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is deep copy needed? do you expect someone will modify strings?

end

deep_copy(ret)
ret
end

# Return whether a unique ID is already in use.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in fact this is quite confusing, even if cleared in return part of doc

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 51.361% when pulling e12edb5 on optional_patterns into 336bcff on master.

@jreidinger
Copy link
Member

in proposal more removed lines then added, so LGTM for me. Just coverage decrease looks a bit suspicious.

@lslezak lslezak merged commit 0dd92b3 into master Nov 30, 2016
@lslezak lslezak deleted the optional_patterns branch November 30, 2016 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants