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

[modularity] use libmodulemd #1032

Merged
merged 2 commits into from Mar 21, 2018

Conversation

mhatina
Copy link

@mhatina mhatina commented Mar 6, 2018

No description provided.

@@ -33,6 +32,10 @@
from dnf.module.repo_module_dict import RepoModuleDict
from dnf.module.repo_module_version import RepoModuleVersion

import gi
gi.require_version('Modulemd', '1.0')
from gi.repository import Modulemd
Copy link
Member

Choose a reason for hiding this comment

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

[Flake8]

[E402] module level import not at top of file

Copy link
Author

Choose a reason for hiding this comment

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

Ignore


from dnf.module.exceptions import LoadCacheException, MissingYamlException

gi.require_version('Modulemd', '1.0')
from gi.repository import Modulemd
Copy link
Member

Choose a reason for hiding this comment

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

[Flake8]

[E402] module level import not at top of file

Copy link
Author

Choose a reason for hiding this comment

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

Ignore

Copy link
Contributor

@ignatenkobrain ignatenkobrain left a comment

Choose a reason for hiding this comment

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

spec dependencies should be (libmodulemd and pythonX-gobject-base)

@ignatenkobrain
Copy link
Contributor

generally looks good, but I don't see where get_dependencies() is used, is it just broken or dnf doesn't check moduel dependencies?

@mhatina
Copy link
Author

mhatina commented Mar 7, 2018

@ignatenkobrain it uses get_requires(), dnf doesn't really care about build requirements, or am I wrong?

@ignatenkobrain
Copy link
Contributor

Yeah, this is problematic.

get_requires(): This function was deprecated and is not valid for modulemd files of version 2 or later.

you should be using get_dependencies(), check that there is only one element (otherwise it's not really valid "built" module), and on first element call get_requires().

@ignatenkobrain
Copy link
Contributor

ignatenkobrain commented Mar 7, 2018

Sorry for confusing you, but it turned out to be much more complicated:

dependencies:
  - requires:
    gtk: [3]
    platform: [f28]
  - requires:
    gtk: [4]
    platform: [-f28]

is valid.

On solver level it should be represented as (((module(gtk) with module(gtk:3)) and (module(platform) with module(platform:f28))) or ((module(gtk) with module(gtk:4)) and (module(platform) without module(platform:f28))) which in readable form is ((gtk:3 & platform:f28) | (gtk:4 & platform:!f28))

@ignatenkobrain
Copy link
Contributor

I have actually implemented code to handle this: https://pagure.io/fm-orchestrator/c/0224f3995022c0f625f025507b4ad15ab11af97e

See _deps2reqs() function.

continue
visited.add(requires_ns)
version_dependencies.update(self.get_module_dependency_latest(requires_name,
requires_stream,
Copy link
Member

Choose a reason for hiding this comment

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

[Flake8]

[E501] line too long (102 > 100 characters)

Copy link
Contributor

@ignatenkobrain ignatenkobrain left a comment

Choose a reason for hiding this comment

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

still doesn't support multiple dependency entires and doesn't support "exclusion" of streams.

Copy link

@dmach dmach left a comment

Choose a reason for hiding this comment

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

Looks good in general, changes requested:

  • consider removing rich deps from spec
  • handle excludes properly or explain why it's skipped

dnf.spec Outdated
BuildRequires: python2-modulemd
Requires: python2-modulemd
BuildRequires: (libmodulemd and python2-gobject-base)
Requires: (libmodulemd and python2-gobject-base)
Copy link

Choose a reason for hiding this comment

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

Can you avoid using rich deps? We'll have to compile this under RHEL 7.

for requires_name, requires_streams in \
repo_module_version.requires():
for requires_stream in requires_streams:
if requires_stream[0] == '-':
Copy link

Choose a reason for hiding this comment

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

what does this mean? is it an exclude? is it handled somewhere?

Copy link
Author

Choose a reason for hiding this comment

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

yes, that's an exclude in modulemd

Copy link
Author

@mhatina mhatina Mar 21, 2018

Choose a reason for hiding this comment

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

dnf cannot handle module excludes yet, that's why it is skipped. As result, rpms of skipped module:stream won't get included

for requires_name, requires_streams in \
repo_module_version.requires():
for requires_stream in requires_streams:
if requires_stream[0] == '-':
Copy link

Choose a reason for hiding this comment

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

an exclude again?

Copy link
Author

Choose a reason for hiding this comment

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

same as above

@dmach dmach merged commit 21af0a1 into rpm-software-management:wip/modularity Mar 21, 2018
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

4 participants